QuestionQ100

Creating and Using Arrays

Given the following code fragment:

Question Image

Which option shows the state of the num array after the outer loop completes successfully?

  • A
  • B
  • C
  • D
Explanation

new int[1][3] creates a two-dimensional array with one row and three columns. The outer loop executes for row 0, and the inner loop assigns 10 to each element in that row: num[0][0], num[0][1], and num[0][2].

Community Discussion

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