3 min read•june 18, 2024
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: [object Object] 8
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?
A. 8
B. 9
C. 10
D. 46
3. What is located at index[3][2]?
A. "Daniel"
B. "Taylor"
C. "Fletcher"
D. "Amir"
4. What will print when the following code executes?
A. 3
B. 4
C. 5
D. 6
5. What are the index values for "apple", "grapefruit", and "cherries" in the following 2D array?
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?
A. NullPointerException
B. InterruptedException
C. ArrayIndexOutOfBoundsException
D. Runtime Exception
8. Where is the error in the program? What should it be fixed to?
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)
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?
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?
A. I
B. III
C. I, III
D. I, II, III
15. How do you find the last element of the last row?
A.
B.
C.
D.
Time to Check Your Answers on Unit 8 Practice Questions Answers and Review! 🙌