QuestionQ181

Using Loop Constructs

Given the following code fragment:

Question Image

Which action allows it to print AB?

  • A Comment lines 18 to 21.
  • B Comment line 20.
  • C Comment line 19.
  • D Comment line 16.
Explanation

Removing the continue statement allows the print statement in the else block to execute for "A" and "B". When the iterator reaches "C", the break statement terminates the loop before "C" is printed, so the output is AB.

Community Discussion

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