πŸ“š

Β >Β 

πŸ’»Β 

Β >Β 

πŸ’»

8.3 Multiple Choice Questions

3 min readβ€’december 31, 2022


AP Computer Science AΒ πŸ’»

130Β resources
See Units

Multiple Choice Practice for 2D Array

Welcome to Unit 8 AP Computer Science A Multiple Choice Questions! Grab some paper and a pencil πŸ“„ to record your answers as you go. You can see how you did on the Unit 8 Practice Questions Answers and Review sheet once you're done. Don't worry, we have tons of resources available if you get stumped πŸ˜• on a question. And if solo study is not your thing, join a group in Hours!
Not ready to take a quiz yet? Start studying unit 8 Here: Intro to Unit 8
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-kaKLNOBVv2yi.png?alt=media&token=039170c1-17a6-485c-9227-71c13a503569

Image From Wikibooks.

Facts about the test: The AP Computer Science A exam has 40 multiple choice questions and you will be given 90 minutes to complete the section. That means it should take you around 34 minutes to complete 15 questions.

*The following questions were not written by CollegeBoard and although they cover information outlined in the AP Computer Science A Course and Exam Description the formatting on the exam may be different.


1. Which of these is a correct way to declare and initialize a 2D Array?
A. int[][] arrayRectangle = new int[][];
B. int[][] arrayRectangle = new String[5][4];
C. int[][] arrayRectangle = new int[5][4];
D. int arrayRectangle[][] = new int[5][4];

2. What will print when the following code executes?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-BGaWi2I0Pgkh.png?alt=media&token=050c6503-fcd2-45f2-bea4-eb10691562a9
A. 8
B. 9
C. 10
D. 46

3. What is located at index[3][2]?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-0W29Bz8KGCcZ.png?alt=media&token=0c029ad4-b36a-48a1-859a-b5ca466c6d7e
A. "Daniel"
B. "Taylor"
C. "Fletcher"
D. "Amir"

4. What will print when the following code executes?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-4NLT5VfKRRow.png?alt=media&token=2bc4559f-cd99-4e49-b965-d6da4e443af2
A. 3
B. 4
C. 5
D. 6

5. What are the index values for "apple", "grapefruit", and "cherries" in the following 2D array?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-QNqmQEXNDxhq.png?alt=media&token=96aec1c5-346d-4f09-b1cb-f984dcfc0091
A. [1][3], [0][1], [2][2]
B. [2][4], [1][2], [3][3]
C. [3][1], [1][0], [2][2]
D. [4][2], [2][1], [3][3]

6. For any 2D array, what does array.length return?
A. The number of rows and columns averaged
B. The number of columns
C. The number of rows and columns
D. The number of rows

7. What error will show up when trying to run this program?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-vmkoge49jaRt.png?alt=media&token=646e5c68-2495-41c6-88f9-fb089d999c18
A. NullPointerException
B. InterruptedException
C. ArrayIndexOutOfBoundsException
D. Runtime Exception

8. Where is the error in the program? What should it be fixed to?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-MAnfpgN0j0gP.png?alt=media&token=497abca2-600d-4e2f-8517-d4ded0e9e326
A. row < arrayFour.length()
B. arrayFour[0].length
C. row <= arrayFour.length()
D. arrayFour[].length

9. For each method, determine if it is a row-wise traversal or column-wise traversal. Form: nestedLoopOne(array), nestedLoopTwo(array)
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-dfcxhTdTl5Hn.png?alt=media&token=b5739d90-d50e-4d37-8e66-bb41cfb2f339
A. row-wise traversal, row-wise traversal
B. row-wise traversal, column-wise traversal
C. column-wise traversal, row-wise traversal
D. column-wise traversal, column-wise traversal

10. What does arrayFive look like after the code below executes?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-GGd6hpqr3HGS.png?alt=media&token=d117e21f-cd59-4475-adba-b425e763be06
A. {{"#", "#', "#", "$", "#"}, {"#", "#", "#", "S", "#"}}
B. {{"#", "#', "#", "$"}, {"#", "#", "S", "#"}}
C. {{"$", "#', "#", "$", "#"}, {"$", "#", "#", "S", "#"}}
D. {{"$", "#', "#", "$"}, {"$", "#", "#", "S"}}

11. What do the two bracketed numbers in double-index notation represent?
A. [row][column]
B. [column][row]
C. [size][column]
D. [column][length]

12. For all 2D arrays, can different rows have a different number of columns?
A. No
B. Yes
C. Only int arrays
D. Only String arrays

13. What is the default value for 2D arrays?
A. All values are defaulted to 0.0
B. All values are defaulted to null
C. It depends on the type of value and isn't the same for all
D. All values are defaulted to false

14. Given an array as shown below, which enhanced for loops and/or nested loops are able to successfully perform a row-wise traversal with no errors?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-wEzYy5GPZuVW.png?alt=media&token=39faed9f-01e1-49f9-bc54-af22a6906b1e
A.Β I
B.Β III
C.Β I, III
D.Β I, II, III

15. How do you find the last element of the last row?
A.Β 
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-OSYrcU4K1m67.png?alt=media&token=80043488-64ca-453b-a45d-dff142283e36
B.Β 
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-rIOvuFl2OCbb.png?alt=media&token=2810f0c5-4abe-4a07-91e2-92c45c444722
C.Β 
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-O1jZqGBWV0AI.png?alt=media&token=7d32a7ca-de49-4f0c-aa34-1a8343c2bf94
D.Β 
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-f2aWKu2FiHNm.png?alt=media&token=714973b1-f858-4afe-8d5b-c0a282393d88

Time to Check Your Answers onΒ Unit 8 Practice Questions Answers and Review! πŸ™Œ
Browse Study Guides By Unit
βž•Unit 1 – Primitive Types
πŸ“±Unit 2 – Using Objects
πŸ–₯Unit 3 – Boolean Expressions & if Statements
πŸ•ΉUnit 4 – Iteration
βš™οΈUnit 5 – Writing Classes
⌚️Unit 6 – Array
πŸ’ΎUnit 7 – ArrayList
πŸ’»Unit 8 – 2D Array
πŸ–²Unit 9 – Inheritance
πŸ–±Unit 10 – Recursion
πŸ™Exam Reviews

Fiveable
Fiveable
Home
Stay Connected

Β© 2023 Fiveable Inc. All rights reserved.


Β© 2023 Fiveable Inc. All rights reserved.