nerdexam
Oracle

1Z0-803 · Question #35

Given the code fragment: How many times is 2 printed?

The correct answer is B. once. The outer loop will run three times, one time each for the elements in table. The break statement breaks the inner loop immediately each time. 2 will be printed once only. Note: If the line int ii = 0; is missing the program would not compile.

Using Loop Constructs

Question

Given the code fragment:

How many times is 2 printed?

Exhibit

1Z0-803 question #35 exhibit

Options

  • Azero
  • Bonce
  • Ctwice
  • Dthrice
  • Eit is not printed because compilation fails

How the community answered

(50 responses)
  • A
    2% (1)
  • B
    82% (41)
  • C
    2% (1)
  • D
    6% (3)
  • E
    8% (4)

Explanation

The outer loop will run three times, one time each for the elements in table. The break statement breaks the inner loop immediately each time. 2 will be printed once only. Note: If the line int ii = 0; is missing the program would not compile.

Topics

#loops#conditional statements#output prediction#iteration count

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice