Question 1 of 10
A kiln logs unused glaze pots in a new grid. What text does this Java code display?
int[][] glaze = new int[2][3];
System.out.print(glaze[0][2]);
- A. 2
- B. 0
- C. 3
- D. null
A kiln logs unused glaze pots in a new grid. What text does this Java code display?
int[][] glaze = new int[2][3];
System.out.print(glaze[0][2]);
A ferry stores ticket prices in an initializer list. What text does this Java code display?
int[][] fares = { {12, 18, 21}, {9, 15, 27} };
System.out.print(fares[1][0]);
A mural wall is allocated as a 4-by-6 tile grid. What text does this Java code display?
int[][] tiles = new int[4][6];
System.out.print(tiles.length + "," + tiles[0].length);
A bakery treats one tray row as a 1D array. What text does this Java code display?
int[][] trays = { {3, 8, 1}, {5, 2, 9} };
int[] middle = trays[1];
System.out.print(middle[2]);
A lighthouse stores whether each lamp is lit. What text does this Java code display?
boolean[][] lamps = new boolean[3][2];
System.out.print(lamps[2][1]);
A kiosk allocates poster titles but has not stored any yet. What text does this Java code display?
String[][] posters = new String[2][2];
System.out.print(posters[1][0]);
A pond survey allocates depth readings. What text does this Java code display?
double[][] depths = new double[2][4];
System.out.print(depths[0][1]);
A quilt shop stores square IDs. Which access throws ArrayIndexOutOfBoundsException?
int[][] quilt = { {7, 2}, {4, 8}, {1, 5} };
A harbor clerk updates one crate count. What text does this Java code display?
int[][] bins = { {10, 20}, {30, 40} };
bins[0][1] = 99;
System.out.print(bins[1][1] + "," + bins[0][1]);
A recital lighting board stores dimmer values. The table shows the contents of board after the initializer runs. What text does this Java code display?
| row | Column 0 | Column 1 | Column 2 |
|---|---|---|---|
| Row 0 | 5 | 8 | 3 |
| Row 1 | 2 | 9 | 4 |
int[][] board = { {5, 8, 3}, {2, 9, 4} };
System.out.print(board[1][0]);