time() && $theuser1!="1234") die(); ?> AP CS
notes intro/old submit AP Problems the dump links

Quiz 16a - 2d arrays



1. int[ ][ ] scores = { {1,2,3,4,5} , {6,7,8,9,10}, {11,12,13,14,15} }
scores[2][0] would be:

3 6 8 11

2. True or false: you can not use an initializer list with 2d arrays true false

3. True or false: A 2d array needs to be rectangular (all rows must have same number of columns) true false

4. To print out the 2d array scores in one long line, we could do:

for (int i=0; i < scores.length;i++)
    for (int j=0; j<scores[i].length;j++)
for (int[] row:scores)
    for (int val:row)
for (int i=0; i<3;i++)
    for (int j=0; j<5;j++)


I only II only III only I and II All of the above



5. If we wanted to declare a jeopardy board for the questions and values (which is the Question class) we could say:

Question[] jeopardy = new Question[5][6];

Question[][] jeopardy = new Question[5][6];

Question jeopardy = new Question[5];

jeopary=new Question[6];

Question jeopardy = new Question[5][6];

Error, you cant send an array as a parameter