nerdexam
Oracle

1Z0-803 · Question #23

Given the code fragment: What values of x, y, z will produce the following result? 1 2 3 4 1 2 3 4 1 2 3 4 ------ 1 2 3 4 ------

The correct answer is E. X = 2, Y = 3, Z = 4. Z is for the innermost loop. Should print 1 2 3 4. So Z must be 4. Y is for the middle loop. Should print three lines of 1 2 3 4. So Y must be set 3. X is for the outmost loop. Should print 2 lines of ----. So X should be 2.

Using Loop Constructs

Question

Given the code fragment:

What values of x, y, z will produce the following result? 1 2 3 4 1 2 3 4 1 2 3 4 ------ 1 2 3 4 ------

Exhibit

1Z0-803 question #23 exhibit

Options

  • AX = 4, Y = 3, Z = 2
  • BX = 3, Y = 2, Z = 3
  • CX = 2, Y = 3, Z = 3
  • DX = 4, Y = 2, Z= 3
  • EX = 2, Y = 3, Z = 4

How the community answered

(29 responses)
  • A
    10% (3)
  • B
    3% (1)
  • C
    7% (2)
  • E
    79% (23)

Explanation

Z is for the innermost loop. Should print 1 2 3 4. So Z must be 4. Y is for the middle loop. Should print three lines of 1 2 3 4. So Y must be set 3. X is for the outmost loop. Should print 2 lines of ----. So X should be 2.

Topics

#nested loops#loop control#output prediction

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice