Question 1 of 10
An ice rink lists locker numbers with an initializer. What text does this Java code display?
int[] lockers = {11, 14, 9};
System.out.print(lockers.length);
- A. 3
- B. 2
- C. 11
- D. 0
An ice rink lists locker numbers with an initializer. What text does this Java code display?
int[] lockers = {11, 14, 9};
System.out.print(lockers.length);
A greenhouse starts humidity slots. What text does this Java code display?
double[] humid = new double[2];
System.out.print(humid[0] + " " + humid[1]);
A studio records whether lamps are on. What text does this Java code display?
boolean[] open = {true, false, true};
System.out.print(open[1]);
A dye vat count in the middle slot is replaced. What text does this Java code display?
int[] vats = {5, 5, 5};
vats[1] = 12;
System.out.print(vats[0] + vats[1] + vats[2]);
A bolt drawer tries to print one count. What happens when this Java code runs?
int[] bolts = {4, 6};
System.out.print(bolts[2]);
A cloth stall stores dye names. What text does this Java code display?
String[] dyes = {"red", "navy", "gold"};
System.out.print(dyes[0].length() + dyes[2].length());
A clerk creates int[] row = new int[8];. Which statement is true?
A pair of ferry lanes is swapped using []. What text does this Java code display?
int[] pair = {3, 9};
int temp = pair[0];
pair[0] = pair[1];
pair[1] = temp;
System.out.print(pair[0] + " " + pair[1]);
A scoreboard creates int[] marks = new int[10];. Which expression refers to the last element?
A conservatory updates one recorded temperature. What text does this Java code display?
double[] temps = {16.0, 18.5, 17.0};
temps[2] = temps[0] + 1.5;
System.out.print(temps[2]);