AP CSA FRQ Guide
2011 FRQ 1: Sound
Limit sample amplitudes to a maximum absolute value, then replace the stored sample array with a copy that omits leading silence.
Skills Tested
What this FRQ is really practicing
Review these topics before attempting the problem.
Starter Approach
How to begin with your own plan
- 1Mutate samples whose absolute value exceeds the limit and count changes.
- 2Find the first nonzero sample, copy the remaining values into a new array, and assign that array to samples; the method returns no value.
Attempt the problem before opening the solution.
Common Mistakes
Mistakes to watch for while writing
Self Check
Review questions before you submit
Checks absolute amplitude against the limit.
Both positive and negative samples can exceed the limit.
Clamps large positive and negative values correctly.
Positive values become limit and negative values become -limit.
Counts how many samples were changed.
Return the number of mutated entries.
Replaces samples with the new array after removing leading zeros.
The void method must assign the trimmed array to samples, rather than return it.
Practice Links
