AP CSA FRQ Guide
2018 FRQ 3: CodeWordChecker
Write a complete CodeWordChecker class. The class stores valid length bounds and a forbidden substring, supports two constructor forms, and reports whether a candidate string satisfies all rules.
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
- 1Write the complete class header for CodeWordChecker.
- 2Store minimum length, maximum length, and the forbidden substring as instance variables.
- 3The three-parameter constructor should store the custom bounds and forbidden substring.
- 4The one-parameter constructor should use the default bounds described in the official prompt.
- 5isValid should return true only when the length is within bounds and the forbidden substring is absent.
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 CodeWordChecker as a complete class implementing StringChecker.
The legacy prompt describes CodeWordChecker as a StringChecker.
Declares fields for min length, max length, and forbidden text.
The object needs to remember all three rule values.
Includes the constructor with int, int, String parameters.
This constructor sets custom bounds and the forbidden substring.
Includes the one-parameter constructor.
This constructor receives only the forbidden substring.
Uses the default length bounds in the one-parameter constructor.
The prompt supplies default minimum and maximum lengths.
Defines isValid with boolean return type and a String parameter.
This method implements the StringChecker behavior.
Checks the candidate string length.
Both the minimum and maximum bounds matter.
Rejects strings shorter than the minimum length.
Use >= min length or an equivalent false condition.
Practice Links
