2D Array Creation and Access FRQ Practice

Responses receive AI feedback against a rubric after submission. Scores are practice estimates.

Question 1 of 5

An orchard club stores bushel counts with this initializer. Complete the table, then answer the questions.

int[][] bushels = { {4, 7, 1}, {8, 3, 6} };
row Column 0 Column 1 Column 2
Row 0
Row 1

(a) Fill every cell with the stored int. (b) State bushels.length and bushels[0].length. (c) Write the expression that reads the 6.

Question 2 of 5

A kiln shelf is created, then one pot count is written.

int[][] kiln = new int[3][2];
kiln[1][0] = 4;

(a) State the values in kiln[0][0], kiln[1][0], and kiln[2][1]. (b) State kiln.length and kiln[0].length. (c) Explain why later code cannot add a fourth row by writing kiln.length = 4.

Question 3 of 5

A greenhouse keeps vent settings in this rectangular map.

Bay East West Roof
A 2 5 1
B 4 0 3

(a) Write a Java initializer for int[][] vents that matches the East/West/Roof numbers in bay order A then B. (b) Write the access that reads Roof in bay A. (c) Explain what vents[1] refers to.

Question 4 of 5

A dock clerk traces this cargo grid:

int[][] dock = { {2, 5, 1}, {8, 0, 4} };

(a) For each of dock[0][3], dock[1][2], and dock[2][0], state whether the access is legal or throws ArrayIndexOutOfBoundsException. (b) Use dock.length and dock[0].length to justify the illegal cases. (c) State the value read by the legal access.

Question 5 of 5

A festival booth allocates sign text, then fills one cell.

String[][] signs = new String[2][3];
signs[0][2] = "GATE";
String[] top = signs[0];

(a) State what System.out.print(signs[1][1]); displays before any later assignment to that cell. (b) State what top[2] displays after the assignment shown. (c) State top.length. (d) Explain why signs stores nulls at creation while an int[][] of the same size would store zeros.