2023 AP CSA FRQ 3: WeatherData Solution + Rubric

May 2026 exam uses a NEW point structure — tap for details

This page shows the original 2023 FRQ 3, which the College Board scored on a 9-point rubric. The May 2026 exam uses a NEW point distribution and structure — the patterns and traps on this page still apply, but expect different point values and formats on test day.

FRQ 1: 7 points (2 parts: Part A 4pts + Part B 3pts) — Methods & Control Structures

FRQ 2: 7 points (single part) — Class Design

FRQ 3: 5 points (single part) — Data Analysis with ArrayList

FRQ 4: 6 points (single part) — 2D Array

Total Section II: 25 points = 45% of exam score. Only Question 1 has two parts on the 2026 exam; Questions 2, 3, and 4 each have a single part.

Sources: Official College Board CED, Exam Overview (page 145) · Skylight Publishing CED Sample FR Solutions (page 161 reference)

2023 AP CSA FRQ 3: WeatherData — Complete Solution & Rubric

Step-by-step solution to 2023 AP CSA FRQ 3 (WeatherData) with the official 9-point rubric, common mistakes that cost points, and a built-in 22-minute practice timer. Written by an AP Computer Science teacher whose students earn 5s at more than 2x the national rate.

Year: 2023 Question: 3 of 4 Points: 9 Topics: ArrayList, Traversal Difficulty: Medium
Recommended pace: 22:00 per FRQ 22:00

The Official 2023 FRQ 3 Question

The complete prompt is in the PDF below. Use the recap above the editor to keep the key requirements in mind while you write your response.

The PDF cannot be embedded on this device.

Open Prompt PDF in New Tab

Write Your Part A Response: cleanData

Read the prompt above and write your responses in the editors below — Part A in the first, Part B in the second. The real AP exam in Bluebook gives you the prompt and separate response areas per part with no requirement summary or hints. Practice like that here. When you’re done with both parts, click Reveal Solution & Scoring Rubric below to compare your code against the official rubric.

cleanData.java Tab indents | Enter auto-indents | Brackets auto-close
Drag bottom-right corner to resize editor ⇲

Write Your Part B Response: longestHeatWave

longestHeatWave.java Tab indents | Enter auto-indents | Brackets auto-close
Drag bottom-right corner to resize editor ⇲

Ready to self-grade? Compare your code against the official 9-point rubric below. AP FRQs are graded by trained human readers, so we don’t auto-score — you’ll learn more by checking your work against the rubric criteria yourself.

What the Prompt Was Asking

Before reading the solution, check whether your response covered each of these requirements:

Write: public void cleanData(double lower, double upper) — Part A; public int longestHeatWave(double threshold) — Part B

Required behavior:

  • Part A cleanData: iterate through temperatures and remove every element outside the range [lower, upper]. Use BACKWARD iteration to avoid index drift: for (int i = temperatures.size() - 1; i >= 0; i--). Test with || (outside means below lower OR above upper). Call temperatures.remove(i) on the instance variable.
  • Part B longestHeatWave: track TWO counters — currentWaveLength (running streak) and maxWaveLength (best so far). Loop through temperatures using an enhanced for loop. When temp > threshold, increment currentWaveLength and update maxWaveLength if needed.
  • Part B reset logic: when temp <= threshold, RESET currentWaveLength to 0 (the heat wave ended). After the loop completes, return maxWaveLength. Without the reset, a single non-heat-wave element doesn't end the count, breaking the algorithm.

How to Write the WeatherData Methods Step-by-Step

// Sample solution adapted from official scoring guidelines
// 2023 AP CSA FRQ 3: WeatherData (worth 9 points)

public void cleanData(double lower, double upper) {
    // Iterate BACKWARD to avoid index drift when removing elements
    for (int i = temperatures.size() - 1; i >= 0; i--) {
        double temp = temperatures.get(i);
        if (temp < lower || temp > upper) {
            temperatures.remove(i);
        }
    }
}

public int longestHeatWave(double threshold) {
    int currentLength = 0;
    int maxLength = 0;
    for (double temp : temperatures) {
        if (temp > threshold) {
            currentLength++;
            if (currentLength > maxLength) {
                maxLength = currentLength;
            }
        } else {
            currentLength = 0;  // Heat wave ended; reset the counter
        }
    }
    return maxLength;
}

Official 9-Point Scoring Rubric for WeatherData

Pts Criterion
+1 Traverses the temperatures ArrayList
+1 Determines elements outside [lower, upper] range using OR
+1 Calls temperatures.remove(i) on the instance variable
+1 Removes ALL and ONLY identified elements (no index drift, algorithm Part A)
+1 Traverses the temperatures ArrayList
+1 Compares each element to threshold
+1 Initializes and increments a heat-wave length counter
+1 Determines length of at least one heat wave (resets on miss, algorithm)
+1 Tracks and returns the maximum heat-wave length (algorithm, Part B)

Common Mistakes That Cost Points on FRQ 3

Mistake 1: Iterating forward through the ArrayList with remove(i), causing index drift that skips elements. Sample 3B and Sample 3C in the official commentary BOTH lost Point 4 for this reason. After temperatures.remove(i), the element at position i+1 shifts down to position i, but the for loop increments i, skipping that shifted element. Two fixes: iterate backward starting at size() - 1, OR decrement i (i--) after each remove call. Backward iteration is the cleaner pattern.
Mistake 2: Failing to reset the heat-wave counter when a heat wave ends. Sample 3B in the official commentary lost Point 8 because the variable count is never reset to zero, so the length of a given heat wave is not determined. Without the reset, the counter just keeps incrementing on every above-threshold day across the entire list, even with cool days in between. The fix: in the else branch (when temp <= threshold), set currentWaveLength = 0.
Mistake 3: Trying to compare both i-1 and i+1 elements (out-of-bounds at boundaries). Sample 3B in the official commentary lost Point 5 because the response attempted to access list elements at indices i + 1 and i - 1, causing out-of-bounds errors at the end and beginning of the list. A heat wave check needs only the CURRENT element compared to threshold — not previous or next. Use enhanced for-loop or simple indexed access without neighbor lookups.
Mistake 4: Returning the instance variable temperatures from within a void method. Sample 3C in the official commentary lost Point 4 because the response returns the instance variable temperatures from within the void method. cleanData is declared void — it MODIFIES the instance variable in place; it does NOT return anything. Adding return temperatures; produces a compile error and breaks the algorithm in the rubric's view.
Mistake 5: Failing to update the loop variable in a while loop, causing an infinite loop. Sample 3A in the official commentary lost Point 8 because the loop control variable i is not updated in the while loop, resulting in an infinite loop. While loops require manual increment — the loop variable doesn't auto-update like in a for loop. Either use a for loop (which auto-increments), or remember to add i++ at the end of the while body.
Key Insight: WeatherData teaches the most-tested ArrayList pattern in AP CSA: removing elements during iteration. The forward-iteration trap is so common it shows up in nearly every ArrayList FRQ — Sample 3B and 3C BOTH lost Point 4 to it. The mechanism: when you call remove(i), every element after position i shifts down by one. If your for loop then does i++, you skip the element that just shifted into position i. Two safe patterns: (1) iterate BACKWARD with for (int i = size() - 1; i >= 0; i--) — removing doesn't affect indices you haven't visited yet; (2) decrement i after each remove with i--. Backward iteration is preferred because it requires no special logic. A second insight specific to streak/longest-run algorithms: maintain TWO counters — one for the current streak (resets on miss), one for the best seen (only updates on increase). This pattern also appears in 2018 LightBoard and 2022 Game. The discipline: increment current on hit, reset current to 0 on miss, take max(best, current) inside the if. Sample 3B lost Point 8 by never resetting — without the reset, isolated above-threshold elements get counted as if they were part of one continuous streak.

FAQs About 2023 AP CSA FRQ 3

What does 2023 AP CSA FRQ 3 WeatherData test?

WeatherData tests two methods on an ArrayList: cleanData (Part A) removes elements outside [lower, upper], and longestHeatWave (Part B) returns the length of the longest run of consecutive temperatures above threshold. The hardest single point is Point 4: the cleanData algorithm must remove ALL identified elements without skipping any. Sample 3B and Sample 3C both lost Point 4 because forward iteration with .remove(i) skips the element immediately after each removal — the canonical fix is iterating BACKWARD with a for loop starting at size() - 1 and decrementing.

How many points is FRQ 3 worth?

9 points, awarded across the rubric criteria. FRQ 3 makes up about 11% of the AP CSA exam score.

What is the most common mistake on 2023 FRQ 3 WeatherData?

Iterating forward through the ArrayList while calling remove(i), causing index drift that skips elements. Sample 3B and 3C in the official commentary both lost Point 4 because after remove(i), the next element shifts into position i, but the for loop increments i, skipping the shifted element. Two fixes work: (1) iterate BACKWARD: for (int i = size() - 1; i >= 0; i--), or (2) decrement i after each remove: i--. Backward iteration is cleaner and recommended.

How long should I spend on FRQ 3?

Aim for 22 minutes per FRQ. The AP CSA free-response section is 90 minutes for 4 questions, so 22 minutes per question leaves a 2-minute buffer to review.

Is WeatherData still relevant for the 2026 AP CSA exam?

Yes. The current AP CSA 4-unit curriculum still tests ArrayList traversal and modification, so WeatherData is excellent practice for the 2026 exam format.

Where can I find the official scoring guidelines?

College Board publishes the official scoring guidelines as a PDF on AP Central. The rubric on this page mirrors those criteria. You can download the official scoring guidelines here.

Related AP CSA FRQs to Practice Next

If you found WeatherData useful, work through these next to lock in the same Java concepts:

Why 2023 FRQ 3 Still Matters for the 2026 AP CSA Exam

The 2026 AP CSA curriculum reorganized the topic list into 4 units, but the FRQ types stayed the same. 2023 FRQ 3 (WeatherData) tests ArrayList traversal and modification, which is still a core part of the exam. Practicing this question prepares you for the Bluebook digital test format and builds the muscle memory you need for the exam on Friday, May 15, 2026.

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]