Skip to main content

Java Topic Practice

2D Array Traversal

Practice mode with 15 Java-focused questions, immediate answer checks, and explanations.

For practice use only.

2D Array Traversal MCQ Practice

2D Array Traversal Java practice with 15 questions, code tracing, and a worked explanation for every answer.

Question 1 of 15

Answered 0 of 15

Choose one answer.

Code Tracing 01 - 2D Array Traversal: track the final printed value.

int[][] grid = {
  {2, 5, 1},
  {4, 3, 6},
  {7, 0, 8}
};
String out = "";
for (int c = 0; c < grid[0].length; c++) {
  for (int r = 0; r < grid.length; r++) {
    out += grid[r][c] + " ";
  }
}
System.out.print(out.trim());
Choose one answer.