Skip to main content

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.

Array Processing22 minute targetarraysmutationMath.abscopying

Skills Tested

What this FRQ is really practicing

arraysmutationMath.abscopying

Review these topics before attempting the problem.

Starter Approach

How to begin with your own plan

  1. 1Mutate samples whose absolute value exceeds the limit and count changes.
  2. 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

Clamping only positive samples.
Returning the limit instead of the number of changes.
Removing all zeros instead of only leading silence.
Returning an array from the void trimming method instead of updating samples.

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

Where to go next