AP CSA FRQ Guide
2021 FRQ 1: WordMatch
Write two methods for a word-matching game. The first scores a guess by counting overlapping substring matches inside the secret word and multiplying by the square of the guess length. The second chooses the better guess by score, using alphabetical order as the tie-breaker.
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: examine every possible substring of secret with the same length as guess.
- 2Count overlapping occurrences where the substring equals guess.
- 3Return the count multiplied by guess.length() squared.
- 4Part B: compute both scores using scoreGuess.
- 5Return the guess with the higher score; if scores tie, return the alphabetically greater guess using compareTo.
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 scoreGuess with int return type and one String parameter.
Part A returns the numeric score for a guess.
Loops through possible starting positions in secret.
The last start index is secret.length() - guess.length().
Extracts substrings with the same length as guess.
Use secret.substring(start, start + guess.length()).
Compares substrings to guess using equals.
String content should be compared with equals, not ==.
Counts each matching occurrence, including overlapping matches.
Move the start index by one each time, not by guess length.
Returns count times guess length squared.
The multiplier is guess.length() * guess.length().
Defines findBetterGuess with String return type and two String parameters.
Part B returns one of the two guesses.
Calls scoreGuess for both guesses.
Part B should rely on Part A behavior.
Practice Links
