nerdexam
Oracle

1Z0-809 · Question #184

Given the code fragment: String shirts[][] = new String[2][2]; shirts[0][0] = "red"; shirts[0][1] = "blue"; shirts[1][0] = "small"; shirts[1][1] = "medium"; Which code fragment prints red: blue…

The correct answer is B. for (int idx = 0; idx < 2; idx++) { for (int idx1 = 0; idx1 < 2; idx1++) { System.out.print (shirts[idx] [idx1] + ":"); } } idx++. You've hit your session limit · resets 10:20pm (America/New_York)

Question

Given the code fragment: String shirts[][] = new String[2][2]; shirts[0][0] = "red"; shirts[0][1] = "blue"; shirts[1][0] = "small"; shirts[1][1] = "medium"; Which code fragment prints red: blue: small1: medium: ?

Options

  • Afor (int idx = 1; idx < 2; idx++) { for (int idx1 = 0; idx1 < 2; idx1++) { System.out.print (shirts[idx] [idx1] + ":"); } }
  • Bfor (int idx = 0; idx < 2; idx++) { for (int idx1 = 0; idx1 < 2; idx1++) { System.out.print (shirts[idx] [idx1] + ":"); } } idx++;
  • Cfor (String s : colors) { for (String s : sizes) { System.out.print (s + ":"); } }
  • Dfor (int idx = 0; index < 2; ++index) { for (int idx1 = 0; idx1 < 2; idx1++) { System.out.print (shirts[idx] [idx] + ":"); } }

How the community answered

(48 responses)
  • A
    4% (2)
  • B
    77% (37)
  • C
    6% (3)
  • D
    13% (6)

Explanation

You've hit your session limit · resets 10:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice