2D Array Creation and Access FRQ Practice

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

Question 1 of 5

A clay studio stores glaze test chips. Complete the table from this initializer.

int[][] chips = { {9, 2}, {4, 8}, {1, 6} };
row Column 0 Column 1
Row 0
Row 1
Row 2

(a) Fill every cell. (b) State chips.length and chips[0].length. (c) Write the expression that reads the 8.

Question 2 of 5

A bird-box map is allocated, then one box is labeled occupied.

boolean[][] boxes = new boolean[2][4];
boxes[0][3] = true;

(a) State boxes[0][0], boxes[0][3], and boxes[1][2]. (b) State boxes.length and boxes[0].length. (c) Explain why the map cannot later gain a fifth column by assigning boxes[0].length = 5.

Question 3 of 5

A ferry snack cart stores prices in this rectangular layout.

Cart Cocoa Pretzel
Upper 3 4
Lower 2 5

(a) Write a Java initializer for int[][] prices matching Upper then Lower. (b) Write the access that reads the pretzel on the lower cart. (c) Explain what prices[0] refers to.

Question 4 of 5

A lantern festival stores wick counts:

int[][] wicks = { {4, 1, 9, 2}, {6, 3, 8, 5} };

(a) For each of wicks[1][3], wicks[0][4], and wicks[2][0], state legal or ArrayIndexOutOfBoundsException. (b) Justify using wicks.length and wicks[0].length. (c) State the value of the legal access.

Question 5 of 5

A poster kiosk allocates titles, then copies a row reference.

String[][] titles = new String[2][2];
titles[1][0] = "NOON";
String[] bottom = titles[1];
bottom[1] = "DUSK";

(a) State what print(titles[0][1]) displays. (b) State what print(titles[1][0]) and print(titles[1][1]) display. (c) Explain why assigning through bottom changes titles[1][1]. (d) Contrast those String defaults with new int[2][2] defaults.