AP CSA FRQ Guide

2025 FRQ 2: SignedText

Write a complete class that stores name information, builds a formatted signature, and returns text with the signature placed correctly based on whether it is missing, already at the end, or at the beginning.

Class Writing and String Processing22 minute targetclass writingconstructorsString methodssubstringindexOf

Skills Tested

What this FRQ is really practicing

class writingconstructorsString methodssubstringindexOf

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. 1Write the complete class header, instance variables, and constructor.
  2. 2Implement getSignature for empty and non-empty first-name cases.
  3. 3Implement addSignature for missing signature, signature already at the end, and signature at the beginning.

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

Writing method headers without public String return types.
Using == to test whether a String is empty.
Calling substring(0) instead of substring(0, 1) for the first initial.
Appending the signature even when it already appears at the end.
Removing the beginning signature but forgetting to append it to the end.

Self Check

Review questions before you submit

Uses the correct public class header.

The response should define the complete SignedText class.

Declares private String instance variables for the stored names.

Use private fields so the constructor can store both names.

Includes a constructor with two String parameters.

The constructor name must match the class name exactly.

Defines getSignature with no parameters and String return type.

This method should return the formatted signature string.

Handles the empty first-name case.

Check for an empty first name using equals("") or length() == 0.

Uses the first character of the first name for non-empty first names.

AP Computer Science A String indexing usually uses substring(0, 1).

Defines addSignature with one String parameter and String return type.

The method returns a revised copy, not void.

Finds where the signature occurs in the text.

indexOf is the most direct tool, but startsWith/endsWith can also work.

Practice Links

Where to go next