AP CSA FRQ Guide
2023 FRQ 3: WeatherData
Write two methods for analyzing daily high temperatures. The first removes values outside an inclusive valid range while preserving order. The second finds the length of the longest streak of temperatures above a threshold.
Skills Tested
What this FRQ is really practicing
Treat these skills as the study checklist. If any tag feels shaky, review that topic before attempting the full written response.
Starter Approach
How to begin without copying a solution
- 1Part A: remove every temperature less than lower or greater than upper.
- 2Keep all values from lower through upper, inclusive, and preserve the order of remaining values.
- 3Part B: count consecutive temperatures greater than threshold.
- 4Return the maximum length of any heat wave streak.
Write a first attempt before revealing any solution outline. Most AP CSA FRQ progress comes from tracing your own code and finding the missing case.
Common Mistakes
Mistakes to watch for while writing
Self Check
Review questions before you submit
Defines cleanData with void return type and lower/upper parameters.
Part A modifies the temperatures list directly.
Traverses the temperatures ArrayList.
Use temperatures.size() and temperatures.get(index), or an equivalent traversal.
Removes values lower than lower or greater than upper.
The invalid condition uses < lower OR > upper.
Removes safely without skipping elements.
Traverse backward, or only increment after keeping an element.
Defines longestHeatWave with int return type and a threshold parameter.
Part B returns the length of the longest streak.
Checks for temperatures greater than threshold.
A heat wave day must be strictly greater than threshold.
Tracks the current consecutive heat-wave length.
Increment a current counter for heat-wave days.
Resets the current streak when a temperature does not qualify.
A non-heat-wave day breaks the consecutive sequence.
Practice Links
