AP CSA Unit-Level MCQ

Code Tracing: 2D Array Basics

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

For practice use only.

Code Tracing: 2D Array Basics MCQ Practice

Code Tracing: 2D Array Basics AP Computer Science A topic practice with 50 original Java MCQs and immediate explanations.

Question 1 of 50

Answered 0 of 50

Choose one answer.

What is printed by this 2D Array Basics code trace?

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);