QuestionQ5

Control Structures and Iteration

How many lines does the following code print?

Question Image

  • A 0
  • B 1
  • C 99
  • D 199
  • E 2
Explanation

The loop increments x to 1 on its first iteration. Because 1 < 100, it executes one print statement and immediately exits the loop with break, so exactly one line is printed.

Community Discussion

No comments yet. Be the first to start the discussion!