nerdexam
Oracle

1Z0-409 · Question #24

What would be the output of the nested for loop given below? for (( i=1; i<=5; i++)) do for (( j=1; j<=5; j++)) do echo -n "$i" done echo #### done

The correct answer is A. 1 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 45 5 5 5 5. See the full explanation below for the reasoning.

Question

What would be the output of the nested for loop given below? for (( i=1; i<=5; i++)) do for (( j=1; j<=5; j++)) do echo -n "$i" done echo #### done

Options

  • A1 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 45 5 5 5 5
  • B1 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 5
  • C5 4 3 2 15 4 3 2 15 4 3 2 15 4 3 2 15 4 3 2 1
  • D5 5 5 5 54 4 4 4 43 3 3 3 32 2 2 2 21 1 1 1 1

How the community answered

(17 responses)
  • A
    82% (14)
  • B
    12% (2)
  • C
    6% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-409 Practice