QuestionQ184

Using Loop Constructs

Given the following code fragment:

Question Image

What is the outcome?

  • A A B C
  • B A B C D E
  • C A B D E
  • D Compilation fails.
Explanation

break exits the innermost loop only. When the first row reaches "B", the inner loop stops, so "C" is not printed. The outer loop proceeds to the second row, which prints "D" and "E".

Community Discussion

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