๐Ÿ“š

ย >ย 

๐Ÿ’ปย 

ย >ย 

๐Ÿ’พ

7.9 MC Answers and Review

5 min readโ€ขdecember 24, 2021


AP Computer Science Aย ๐Ÿ’ป

130ย resources
See Units

Answers and Review for Multiple Choice Practice on ArrayList

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-OrA4tHUKIEIe.png?alt=media&token=d00c355e-f96c-49e8-a309-819d39c8c69b

Image Fr om Medium.

ย 
โ›”STOP!โ›” Before you look at the answers make sure you gave this practice quiz a try so you can assess your understanding of the concepts covered in unit 7. Click here for the practice questions: AP CSA Unit 7 Multiple Choice Questions.
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. Vehicles are classified based on their total interior volume. The classify method is intended to return a vehicle classification String value based on total interior volume, in cubic feet, as shown in the table (below, see table and sample code). The classify method works as intended for some but not all values of the parameter volume. For which of the following values of volume would the correct value be returned when the classify method is executed?

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-48kJIZKFqZd5.png?alt=media&token=d42cc8e4-de78-454d-86a5-d91ec4ae14df
A. 115
B. 109
C. 105
D. 90
Answer:ย Since 115 is smaller than 120 the first ELSE loop will execute. which will give correct result.
๐Ÿ“„ Study AP CSA, Unit 7.3: Traversing ArrayListย 

2. Which of the following is a reason to use an ArrayList instead of an array?

A. An ArrayList can allocate more space than it needs.
B. You can store objects in an ArrayList, but not in an array.
C. An ArrayList can grow or shrink as needed, while an array is always the same size.
D. An ArrayList can grow or shrink as needed, while an array is always the same size.
Answer:ย Main benefit to using an ArrayList.... and every time an ArrayList fills up a new array is created that is twice as big. This can lead to extra space that is wasted.
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

3. What will print when the following code executes?

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-wmvaojt7t3Lw.png?alt=media&token=8034d0fa-3d53-4ac8-9a6d-5811b5006127
A. ["Destini", "Layla", "Sharrie", "Sarah"]
B. ["Sarah", "Layla", "Sharrie"]
C. ["Sarah", "Destini", "Layla", "Sharrie"]
D. ["Sarah", "Destini", "Anaya", "Layla", "Sharrie"]
Answer:ย The list is first ["Anaya", "Layla", "Sharrie"] and then ["Destini, "Layla", "Sharrie"] and finally ["Sarah", "Destini, "Layla", "Sharrie"]
๐Ÿ“„ย Study AP CSA, Unit 7.2:ย ArrayList Methods

4. What will print when the following code executes?

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-iWwvcmqOADlr.png?alt=media&token=cd374224-d415-40c9-af01-857ea88e9375
A. [1, 2, 3, 4, 5]
B. [1, 2, 5, 4, 6]
C. [1, 2, 4, 5, 6]
D. [1, 5, 2, 4, 6]
Answer:ย "add" method that takes an object as a parameter & adds that object to the end of the list. "set" replaces the value at that index with the new value. "add" with index & object parameters puts the passed object at that index and moves any existing values one to the right (increments).
๐Ÿ“„ย Study AP CSA, Unit 7.2:ย ArrayList Methods

5. Given the following code, assume that nums is initially [0, 0, 4, 2, 5, 0, 3], what will nums contain as a result of executing numQuest?

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-CscK5WJsWHn6.png?alt=media&token=2d704e67-40b8-4b10-ae71-edf23b60e0ab
A. [0, 0, 0, 4, 2, 5, 3]
B. [4, 2, 5, 3]
C. [0, 0, 4, 2, 5, 0, 3]
D. [0, 4, 2, 5, 3]
Answer:ย This shows all zeros removed. Since k is only incremented if a value wasn't removed this will work correctly.
๐Ÿ“„ย Study AP CSA, Unit 7.3:ย Traversing ArrayListย 

6. Which of the following best describes the behavior of process1 and process2?

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-8TBeqVjAm6ax.png?alt=media&token=7cdee591-0917-45ee-93ae-094e8c0fad29
A. Both methods produce the same result and take the same amount of time.
B. The two methods produce different results and take the same amount of time.
C. The two methods produce different results, and process1 is faster than process2.
D. The two methods produce different results, and process2 is faster than process1.
Answer:ย Both process1 & process2 add to the end of the list each time through the loop. The only difference would be if there were values in the list in process2, existing values would be moved to the right. But, there are no existing values in the list at that index or beyond.
๐Ÿ“„ย Study AP CSA, Unit 7.3:ย Traversing ArrayListย 

7. Which of the following best describes a mutable list of object references

A. Method
B. Array
C. ArrayList
D. Object
Answer:ย definition of ArrayList
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

8. Which of the following is a constructor for a new ArrayList?

A. set ArrayList<E>()
B. new ArrayList<E>()
C. new ArrayList {E}()
D. new ArrayList E;
Answer:ย proper syntax
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

9. Which of the following is a common error when trying to modify an ArrayList while using an enhanced for loop.

A. OverflowException
B. runtime error
C. Overflow error
D. ConcurrentModificationException
Answer:ย definition
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

10. Which of the following best describes the information about a person that can be found online?

A. personal privacy
B. personal data
C. security
D. digital footprint
Answer:ย definition of digital footprint
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

11. Which term defines rules and conventions for communication between network devices

A. network protocols
B. network rules
C. device security
D. network footprints
Answer:ย definition of network protocol
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

12. Which of the following terms can be described as a method for finding a target value within a list by sequentially checking each element of the list for the target value until a match is found or until all the elements have been searched.

A. binary search
B. sort protocol
C. linear search
D. parallel search
Answer:ย definition of linear search
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

13. Which of the following terms means to sort an array by repeatedly finding the minimum value, and moving it to the front of the array.

A. MinChoice sort
B. selection sort
C. parallel sort
D. minimum sort
Answer:ย definition of selection sort
๐Ÿ“„ย Study AP CSA, Unit 7.1:ย Introduction to ArrayListย 

14. Which of the following correctly illustrates the ArrayList L after the given code segment executes?

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-Hbayx4EidR8Z.png?alt=media&token=1c1399c2-cdcf-4071-b076-9659ad14406f
A. [!, ?, !, ?, ?]
B. [!, !, ?, !, ?, !]
C. [!, !, ?, !, ?]
D. [!, ?, !, ?, !]
Answer:ย % means remainder when 2 integers are divided: for example 126 % 10 = 6 because 126/10 is 12 with a remainder of 6
๐Ÿ“„ย Study AP CSA, Unit 7.4:ย Developing Algorithms Using ArrayList

15. Which of the following is not a method included in the ArrayList class?

A. int size()
B. int length()
C. Object get(int index)
D. boolean isEmpty()
Answer:ย knowledge relating to ArrayList
๐Ÿ“„ย Study AP CSA, Unit 7.2:ย ArrayList Methods

What can we help you do now?

๐Ÿ” Study for Unit 8
๐Ÿฆ˜ Jump to AP CSA Unit 8 Multiple Choice Questions
๐Ÿค Connect with other students studying AP CSA with Hours
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.