AP CSP Practice Test On Arrays (ArrayList And 2D Arrays)

Access More Questions
Which of the following initializes an 8 × 10 matrix with integer values that are perfect squares? (0 is a perfect square.) I int[][] mat = new int[8][10]; II int[][] mat = new int[8][10]; for (int r = 0; r < mat.length; r++) for (int c = 0; c < mat[r].length; c++) mat[r][c] = r * r; III int[][] mat = new int[8][10]; for (int c = 0; c < mat[r].length; c++) for (int r = 0; r < mat.length; r++) mat[r][c] = c * c;
Correct Answer:
I and II only
Explanation:
Correct answer: I and II only

Access more questions from this quiz

Continue to AP CSP Practice Test on Arrays (ArrayList and 2D arrays) for more practice questions and the full quiz experience.

Access More Questions