Skip to main content

Java Topic Practice

2D Array Basics

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

For practice use only.

2D Array Basics MCQ Practice

2D Array Basics 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 Basics: track the final printed value.

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