Unit 4 Cycle 2 Day 28: Comprehensive Unit 4 Final Review
Share
Comprehensive Unit 4 Final Review
Section Mixed — Review: All Unit 4
Key Concept
This Unit 4 final review covers all data collection topics at exam-level difficulty. Unit 4 represents approximately 17-22% of the AP CSA exam. The most critical topics are: ArrayList removal during traversal (forward removal bug and ConcurrentModificationException), binary search tracing on sorted arrays, selection and insertion sort pass-by-pass execution, 2D array traversal in row-major versus column-major order, and the ArrayList removal ambiguity. These topics appear in both multiple-choice and free-response sections every year.
Consider the following code segment.
What is printed?
Answer: (A) 20
list = [0, 1, 4, 9, 16, 25]. Even values: 0, 4, 16. Sum = 0+4+16 = 20.
Why Not the Others?
(B) 35 is the sum of ALL odd values (1+9+25).
(C) 14 does not match any subset sum.
(D) 4 is just one even element.
Common Mistake
i*i generates squares: 0,1,4,9,16,25. Filter even values: 0,4,16. The backward traversal does not affect the sum (addition is commutative).
AP Exam Tip
Combining ArrayList construction, traversal, and filtering in one problem is typical of AP exam questions. Trace each step carefully.