2D Arrays in AP Computer Science A
Which of the following is the correct double-index notation to access the element in the third row and second column of a 2D array named "arrayG"?
arrayG[3][2]
arrayG[1][2]
arrayG[2][1]
arrayG[2][3]
What exception is thrown if you use an index that is out of the allowed range in a 2D array?
IllegalArgumentException
ArithmeticException
ArrayIndexOutOfBoundsException
NullPointerException
Which of the following statements is true regarding 2D arrays?
The length of the inner array represents the number of columns.
2D arrays cannot have varying sizes for their inner arrays.
2D arrays are always pre-initialized with values.
All 2D arrays have the same number of rows and columns.
Which of the following statements is true regarding 2D arrays?
The inner arrays within a 2D array can vary in size.
The length of the outer array represents the number of columns.
2D arrays can only store integers.
2D arrays are always rectangular in shape.
Which of the following statements about 2D arrays is FALSE?
The row indices of a 2D array range from 0 to firstDimension - 1.
A 2D array can have varying sizes for its inner arrays.
Java uses single-index notation to access elements in a 2D array.
The column indices of a 2D array range from 0 to secondDimension - 1.
How would you initialize a pre-existing 2D array with the values: {1, 2, 3, 4} in the first row, {5, 6, 7, 8} in the second row, and {9, 10, 11, 12} in the third row?
int arrayB[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
int[][] arrayB = new int[3][4];
int[][] arrayB = new int{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
int[][] arrayB = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
In the memory representation of a 2D array, the outer array contains:
Indices of the 2D array.
Columns of the 2D array.
Elements of the 2D array.
Rows of the 2D array.

How are we doing?
Give us your feedback and let us know how we can improve
What is the result of the following code snippet? int[][] arrayE = {{1, 2, 3}, {4, 5, 6}}; System.out.println(arrayE.length);
3
2
4
6
Which of the following statements is true regarding 2D arrays?
2D arrays are always rectangular in shape.
The length of the outer array represents the number of columns.
2D arrays can only store integers.
The inner arrays within a 2D array can vary in size.
What is the correct way to declare an empty 2D array with 2 rows and 3 columns of strings?
String[2][3] arrayC = new String[][];
String arrayD[2][3] = new String[][];
String[][] arrayA = new String[2][3];
String[][] arrayB = new String[][]{{}, {}};