AP CSA FRQ Guide

2015 FRQ 2: HiddenWord

Write a hint method for a word-guessing game that compares each guessed character with the hidden word.

String Comparison Game22 minute targetStringcharAtcontainsloops

Skills Tested

What this FRQ is really practicing

StringcharAtcontainsloops

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

  1. 1Compare each character position in the guess with the hidden word.
  2. 2Use the prompt symbols for exact match, present elsewhere, and not present.

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

Checking contains before checking exact-position matches.
Comparing strings with == instead of character/string content.
Returning early after only one character.

Self Check

Review questions before you submit

Loops across every character position.

The guess and hidden word have matching lengths in the prompt.

Checks same-position character matches first.

Exact matches take priority over contains checks.

Checks whether a character appears elsewhere in the hidden word.

Use indexOf or contains after the exact-position check fails.

Builds a result string one symbol at a time.

Append the correct symbol for each character position.

Practice Links

Where to go next