Thinking Through an FRQ
A Step-by-Step Guide to AP Computer Science A Free Response Questions
1. The Mindset Shift
When students tell me they "don't know where to start" on an FRQ, the problem isn't usually their Java knowledge. It's their approach. They're treating the FRQ like a creative writing assignment where they need to invent something from scratch.
Here's the truth: Every FRQ is a translation problem. The prompt tells you exactly what to do in English. Your job is to convert that English into Java using patterns you've seen dozens of times before.
2. The 4-Step Framework
Use this framework for every single FRQ part. It works whether you're writing a simple getter method or a complex 2D array traversal.
READ and HIGHLIGHT
Circle the method signature. Underline what to return. Box any conditions or rules. Mark example inputs/outputs.
PLAIN ENGLISH FIRST
Before writing any Java, describe what you need to do in simple sentences. "I need to go through each item and check if..."
PATTERN MATCH
Connect your plain English description to Java patterns. "Go through each" = for loop. "Check if" = if statement.
WRITE and CHECK
Translate to Java. Then trace through with the given example to verify. Fix any issues before moving on.
3. Step 1: Read and Highlight
Most FRQ mistakes come from misreading the prompt. Train yourself to highlight these elements before writing any code:
What to Circle (Method Signature)
- Method name - spell it exactly as given
- Return type - this tells you what your method must produce
- Parameters - these are your inputs; note their types
- Access modifier (public/private) - usually public for FRQs
What to Underline (Return Value)
- "returns the total..." - you need a sum/accumulator
- "returns true if..." - you need a boolean condition
- "returns an ArrayList containing..." - you need to build and return a list
- "returns the index of..." - you need to track position
What to Box (Conditions and Rules)
- "only if..." - this becomes an if statement
- "for each..." - this becomes a loop
- "at least" or "at most" - check your comparison operators
- "in order" or "from left to right" - standard forward traversal
Example: Reading a Prompt
Your highlights:
CIRCLE: countLongWords (method name), returns...number (return type = int), words (parameter)
UNDERLINE: "returns the number" = I'm counting something
BOX: "more than 5 characters" = condition to check (> 5, not >= 5)
4. Step 2: Plain English First
This is the most important step that students skip. Before writing a single line of Java, describe your approach in plain English sentences.
Why This Works
When you try to think in Java immediately, you're doing two hard things at once: figuring out the logic AND remembering syntax. By separating these tasks, each becomes easier.
Template for Plain English Planning
| Question | Your Answer |
|---|---|
| What am I being asked to produce? | (return type tells you) |
| What inputs do I have? | (parameters tell you) |
| Do I need to look at every element? | (usually yes = loop) |
| What do I check for each element? | (conditions = if statements) |
| Do I need to keep track of something? | (count, sum, list = variable) |
Example: Plain English for countLongWords
"I need to return a count (integer).
I have an array of words as input.
I need to look at every word in the array.
For each word, I check if its length is greater than 5.
If yes, I add 1 to my count.
After checking all words, I return the count."
You're Halfway There!
Enter your email to unlock the rest of this guide, including:
- The Translation Dictionary (English to Java)
- 7 Reusable Code Patterns for FRQs
- Practice Problem with Full Solution
- Quick Reference Card
- Downloadable PDF Version
No spam, ever. Unsubscribe anytime.
5. Step 3: Pattern Matching
Now convert each English sentence into its Java equivalent. This is where knowing your patterns pays off...
| Plain English | Java Pattern |
|---|---|
| "Go through each element" | for (Type item : array) |
| "Keep a count" | int count = 0; count++; |
5. Step 3: Pattern Matching
Now convert each English sentence into its Java equivalent. This is where knowing your patterns pays off.
The Translation Dictionary
| Plain English | Java Pattern |
|---|---|
| "Go through each element" | for (Type item : array) |
| "Go through by index" | for (int i = 0; i < array.length; i++) |
| "Keep a count" | int count = 0; ... count++; |
| "Keep a running total" | int sum = 0; ... sum += value; |
| "Build a list of results" | ArrayList |
| "Add to the list" | result.add(item); |
| "Check if something is true" | if (condition) { ... } |
| "Otherwise do something else" | else { ... } |
| "Return when found" | if (found) return item; |
| "Return false if none found" | return false; // after loop |
Example: Pattern Matching for countLongWords
English: "Go through each word" --> for (String word : words)
English: "Keep a count" --> int count = 0;
English: "If length is greater than 5" --> if (word.length() > 5)
English: "Add 1 to count" --> count++;
English: "Return the count" --> return count;
6. Step 4: Write and Check
Now assemble your code and verify it works. Don't skip the verification - it's how you catch mistakes before they cost you points.
The Final Code
public int countLongWords(String[] words) { int count = 0; for (String word : words) { if (word.length() > 5) { count++; } } return count; }
Verification Checklist
- Trace through with the example from the prompt
- Check that your return type matches what's required
- Verify comparison operators (> vs >= vs ==)
- Make sure you're returning, not just printing
- Check that you initialized variables before using them
- Verify loop bounds (off-by-one errors are common)
int count; instead of int count = 0;. Always initialize!
7. Common FRQ Patterns
These patterns appear in FRQs year after year. Master them and you'll recognize them instantly.
int count = 0; for (Type item : collection) { if (/* condition */) { count++; } } return count;
ArrayListresult = new ArrayList<>(); for (Type item : collection) { if (/* condition */) { result.add(item); } } return result;
for (Type item : collection) { if (/* condition */) { return item; // or return true/index } } return null; // or return false/-1
for (int row = 0; row < grid.length; row++) { for (int col = 0; col < grid[0].length; col++) { // process grid[row][col] } }
int sum = 0; // or double for decimals for (Type item : collection) { sum += item.getValue(); } return sum;
String result = ""; for (int i = 0; i < str.length(); i++) { if (/* condition on character */) { result += str.substring(i, i + 1); } } return result;
for (int i = list.size() - 1; i >= 0; i--) { if (/* condition to remove */) { list.remove(i); } }
8. Practice Exercise
Apply the 4-step framework to this problem. Work through each step before revealing the solution.
Problem
Write the method removeShortWords that takes an ArrayList of Strings called words and removes all strings with 3 or fewer characters. The method returns nothing (void).
Step 1: Read and Highlight
What do you circle, underline, and box?
Write your answer here...
Step 2: Plain English
Describe your approach in sentences:
Write your plan here...
Step 3: Pattern Match
Which Java patterns will you use?
Identify patterns here...
Step 4: Write Your Code
Write your solution here...
Solution Walkthrough
Step 1 Analysis:
CIRCLE: removeShortWords, void, ArrayList
UNDERLINE: removes all strings (modifying the list)
BOX: 3 or fewer characters (<= 3)
"I need to go through the ArrayList and remove words that are too short. Since I'm removing while traversing, I should go backwards to avoid skipping elements. For each word, if its length is 3 or less, I remove it."
Step 3 Patterns:
- Backwards traversal (for removing from ArrayList)
- Condition check (if length <= 3)
- ArrayList remove method
Final Code
public void removeShortWords(ArrayListwords) { // Traverse backwards to avoid index issues when removing for (int i = words.size() - 1; i >= 0; i--) { if (words.get(i).length() <= 3) { words.remove(i); } } }
Quick Reference Card
The 4-Step Framework
Key Translations
Ready for More Practice?
Put these strategies to work with real AP CSA FRQs from past exams.