---
title: "AP Computer Science A Methods FRQ Practice"
description: "41 Methods and Control Structures questions written in the AP format, each scored part by part."
canonical: "https://fiveable.me/ap-comp-sci-a/frqs/methods-and-control-structures"
type: "frq-type-practice"
subject: "AP Computer Science A"
---

# AP Computer Science A Methods FRQ Practice

## What the Methods FRQ asks

Methods and Control Structures is FRQ 1 on the AP Computer Science A exam. You write two methods, or a constructor and a method, inside a given class, using loops, conditionals, String methods, and calls to other methods in the class.

- **90 min**: for all four FRQs
- **7 points**: 4 in part A, 3 in part B
- **45%**: of your score, for all four FRQs

| Part | What it asks | Points |
| --- | --- | --- |
| A: Loops and method calls | A method or constructor with loops or conditionals that calls methods in the class | 4 |
| B: String methods | A method or constructor that builds or searches a String | 3 |

## How Methods FRQ practice works

1. **Read the full question.** The class, the method headers, and both parts, laid out the way the exam shows them.
2. **Write on a 22-minute timer.** A pace that fits all four questions into the 90-minute section. Pause it or turn it off, and your response saves as you go.
3. **Submit for a score out of 7.** Your response is scored against the scoring guidelines written for that question. Your first score is included.

## All 41 questions

### Unit 2: Selection and Iteration (11)
- [Travel itinerary planning and time calculation](/ap-comp-sci-a/frq-practice?id=698a7858f06ff587401ec916&type=frq-1-methods-and-control-structures)
- [Video game session scoring and level tracking simulation](/ap-comp-sci-a/frq-practice?id=698a7a44f06ff587401ec927&type=frq-1-methods-and-control-structures)
- [Treasure hunting game move processing and substring counting](/ap-comp-sci-a/frq-practice?id=698a7b16f06ff587401ec92d&type=frq-1-methods-and-control-structures)
- [Server status logging and performance analysis](/ap-comp-sci-a/frq-practice?id=698a7b39f06ff587401ec92e&type=frq-1-methods-and-control-structures)
- [Event ticket sales management system](/ap-comp-sci-a/frq-practice?id=698a7bc9f06ff587401ec933&type=frq-1-methods-and-control-structures)
- [Server log entry retrieval and keyword counting](/ap-comp-sci-a/frq-practice?id=698a7c31f06ff587401ec937&type=frq-1-methods-and-control-structures)
- [Trivia game simulation with scoring and result tracking](/ap-comp-sci-a/frq-practice?id=698a7d20f06ff587401ec93f&type=frq-1-methods-and-control-structures)
- [Student enrollment management and prerequisite verification](/ap-comp-sci-a/frq-practice?id=698a817ef06ff587401ec957&type=frq-1-methods-and-control-structures)
- [Warehouse inventory management system with order processing](/ap-comp-sci-a/frq-practice?id=698a8339f06ff587401ec958&type=frq-1-methods-and-control-structures)
- [Event sequence tracking and keyword counting](/ap-comp-sci-a/frq-practice?id=698a8e3992eb6995a7632fda&type=frq-1-methods-and-control-structures)
- [Cyclic direction-state simulation and String rotation](/ap-comp-sci-a/frq-practice?id=6a95d082796870612d4bed0e&type=frq-1-methods-and-control-structures)

### Unit 3: Class Creation (29)
- [Trail simulation with landmark tracking and distance accumulation](/ap-comp-sci-a/frq-practice?id=69714b1e27fbc6ac12a18a52&type=frq-1-methods-and-control-structures)
- [Journey planning with sequential stops and travel time](/ap-comp-sci-a/frq-practice?id=698a77fff06ff587401ec911&type=frq-1-methods-and-control-structures)
- [Student enrollment capacity and prerequisite management](/ap-comp-sci-a/frq-practice?id=698a781bf06ff587401ec913&type=frq-1-methods-and-control-structures)
- [Charity fundraising progress tracking and badge generation](/ap-comp-sci-a/frq-practice?id=698a78e7f06ff587401ec919&type=frq-1-methods-and-control-structures)
- [Flight route planning and airport connectivity analysis](/ap-comp-sci-a/frq-practice?id=698a795af06ff587401ec91d&type=frq-1-methods-and-control-structures)
- [DNA sequence generation and pattern matching](/ap-comp-sci-a/frq-practice?id=698a79b4f06ff587401ec920&type=frq-1-methods-and-control-structures)
- [Course enrollment planning within credit limits](/ap-comp-sci-a/frq-practice?id=698a79d5f06ff587401ec923&type=frq-1-methods-and-control-structures)
- [Game state updates and answer masking logic](/ap-comp-sci-a/frq-practice?id=698a7a15f06ff587401ec925&type=frq-1-methods-and-control-structures)
- [Unique email generation system for employees](/ap-comp-sci-a/frq-practice?id=698a7a92f06ff587401ec92a&type=frq-1-methods-and-control-structures)
- [Token stream processing and community guideline flagging](/ap-comp-sci-a/frq-practice?id=698a7bfaf06ff587401ec935&type=frq-1-methods-and-control-structures)
- [Customer support ticket processing and code generation](/ap-comp-sci-a/frq-practice?id=698a7c57f06ff587401ec939&type=frq-1-methods-and-control-structures)
- [Music playlist generation with duration constraints](/ap-comp-sci-a/frq-practice?id=698a7caff06ff587401ec93b&type=frq-1-methods-and-control-structures)
- [Story plot sequence generation and event processing](/ap-comp-sci-a/frq-practice?id=698a7cbcf06ff587401ec93c&type=frq-1-methods-and-control-structures)
- [Song lyrics generation and substring counting methods](/ap-comp-sci-a/frq-practice?id=698a7d2ff06ff587401ec940&type=frq-1-methods-and-control-structures)
- [Archaeological artifact excavation and collection tracking](/ap-comp-sci-a/frq-practice?id=698a7d7df06ff587401ec943&type=frq-1-methods-and-control-structures)
- [Charitable fundraiser donation tracking and donor identification](/ap-comp-sci-a/frq-practice?id=698a7da0f06ff587401ec945&type=frq-1-methods-and-control-structures)
- [Travel route distance tracking and coding](/ap-comp-sci-a/frq-practice?id=698a7e06f06ff587401ec949&type=frq-1-methods-and-control-structures)
- [Flight path sequences and distance calculations](/ap-comp-sci-a/frq-practice?id=698a7e7df06ff587401ec94e&type=frq-1-methods-and-control-structures)
- [Story construction through chained sentence building](/ap-comp-sci-a/frq-practice?id=698a7ebcf06ff587401ec94f&type=frq-1-methods-and-control-structures)
- [Playlist generation with song duration constraints](/ap-comp-sci-a/frq-practice?id=698a7ee7f06ff587401ec951&type=frq-1-methods-and-control-structures)
- [Game event logging and score tracking system](/ap-comp-sci-a/frq-practice?id=698a7f49f06ff587401ec952&type=frq-1-methods-and-control-structures)
- [Gene sequence generation and initial extraction](/ap-comp-sci-a/frq-practice?id=698a7fb6f06ff587401ec953&type=frq-1-methods-and-control-structures)
- [Robot tour path planning and distance calculation](/ap-comp-sci-a/frq-practice?id=698a802df06ff587401ec954&type=frq-1-methods-and-control-structures)
- [Security system access code validation and batch processing](/ap-comp-sci-a/frq-practice?id=698a80acf06ff587401ec955&type=frq-1-methods-and-control-structures)
- [Text message filtering and keyword detection](/ap-comp-sci-a/frq-practice?id=6a95b67ec8c49870fb13de51&type=frq-1-methods-and-control-structures)
- [Ride-sharing driver acceptance and earnings simulation](/ap-comp-sci-a/frq-practice?id=6a95b71bc8c49870fb13de56&type=frq-1-methods-and-control-structures)
- [Promotional transaction processing and substring matching](/ap-comp-sci-a/frq-practice?id=6a95b7f3c8c49870fb13de5e&type=frq-1-methods-and-control-structures)
- [Longest consecutive active run and shared String prefix](/ap-comp-sci-a/frq-practice?id=6a95d043796870612d4bed09&type=frq-1-methods-and-control-structures)
- [Nonzero error-sign transitions and bracketed-text removal](/ap-comp-sci-a/frq-practice?id=6a95d0e8b26defeca3d98e38&type=frq-1-methods-and-control-structures)

### Unit 4: Data Collections (1)
- [Data Collections: FRQ 1 – Methods and Control Structures unit practice](/ap-comp-sci-a/frq-practice?id=6aab99f131078d3ba4fcd2de&type=frq-1-methods-and-control-structures)

## Sample question

**Travel itinerary planning and time calculation**

Opening Text: This question involves planning a trip with multiple stops using the TripPlanner class. The TripPlanner class manages a travel itinerary and calculates the total travel time. You will write a constructor and a method in the TripPlanner class.

Class Code:
  Language: java
public class TripPlanner
{
 private String itinerary; // To be initialized in part (a)
 private int totalMinutes; // To be initialized in part (a)

 /**
 * Returns the name of the next destination based on the current stop.
 * Returns null if there are no further destinations.
 * Precondition: currentStop is a valid location name.
 */
 public String getNextStop(String currentStop)
 { /* implementation not shown */ }

 /**
 * Returns the travel time in minutes between two locations.
 * Precondition: from and to are valid location names.
 */
 public int getTravelMinutes(String from, String to)
 { /* implementation not shown */ }

 /**
 * Constructs a TripPlanner object.
 * Initializes itinerary with the departure city and totalMinutes to 0.
 * Simulates the trip by repeatedly calling getNextStop until it returns null.
 * Updates itinerary and totalMinutes as described in part (a).
 * Precondition: departure is a non-empty string.
 */
 public TripPlanner(String departure)
 { /* to be implemented in part (a) */ }

 /**
 * Generates and returns a ticket code based on the itinerary.
 * The code consists of the first two letters of each location in the itinerary,
 * converted to uppercase.
 * Precondition: itinerary contains valid locations separated by " -> ".
 * Each location has at least two characters.
 */
 public String generateCode()
 { /* to be implemented in part (b) */ }

 /* There may be instance variables, constructors, and methods
 that are not shown. */
}

Part a (4 points):
  Prompt: Write the constructor for the TripPlanner class. The constructor initializes the itinerary instance variable to the departure parameter and sets totalMinutes to 0. It then builds the rest of the trip by repeatedly calling the getNextStop method. Each valid next stop returned by getNextStop should be appended to itinerary preceded by " -> ", and the travel time between the current stop and the next stop (obtained by calling getTravelMinutes) should be added to totalMinutes. The process continues until getNextStop returns null.
  Helper Explanation: A helper method, getNextStop, has been provided to determine the next destination. A second helper method, getTravelMinutes, returns the time required to travel between two specific locations. Consecutive calls to getNextStop are guaranteed to eventually return null.
  Completion Instruction: Complete the TripPlanner constructor. You must use getNextStop and getTravelMinutes appropriately in order to receive full credit.
  Method Signature: ```java
/**
 * Constructs a TripPlanner object.
 * Initializes itinerary with the departure city and totalMinutes to 0.
 * Simulates the trip by repeatedly calling getNextStop until it returns null.
 * Updates itinerary and totalMinutes as described in part (a).
 * Precondition: departure is a non-empty string.
 */
public TripPlanner(String departure)
```
  Example 1:
    Label: Example 1
    Intro: Consider the following calls to helper methods made within the TripPlanner constructor.
    Example Table:
      Headers: Method Call | Return Value
      getNextStop("Denver") | "Chicago"
      getTravelMinutes("Denver", "Chicago") | 120
      getNextStop("Chicago") | "Boston"
      getTravelMinutes("Chicago", "Boston") | 150
      getNextStop("Boston") | null
    Explanation: Based on these return values, a call to new TripPlanner("Denver") should set the instance variable itinerary to "Denver -> Chicago -> Boston" and should set the instance variable totalMinutes to 270 (120 + 150).
  Example 2:
    Label: Example 2
    Intro: Consider the following calls to helper methods made within the TripPlanner constructor.
    Example Table:
      Headers: Method Call | Return Value
      getNextStop("Miami") | "Orlando"
      getTravelMinutes("Miami", "Orlando") | 240
      getNextStop("Orlando") | null
    Explanation: Based on these return values, a call to new TripPlanner("Miami") should set the instance variable itinerary to "Miami -> Orlando" and should set the instance variable totalMinutes to 240.

Part b (3 points):
  Prompt: Write the generateCode method, which returns a string generated from the itinerary. The code is formed by taking the first two characters of each location in the itinerary, converting them to uppercase, and concatenating them. You may assume that itinerary contains location names separated by " -> " and that every location name has at least two characters.
  Completion Instruction: Complete the generateCode method.
  Method Signature: ```java
/**
 * Generates and returns a ticket code based on the itinerary.
 * The code consists of the first two letters of each location in the itinerary,
 * converted to uppercase.
 * Precondition: itinerary contains valid locations separated by " -> ".
 * Each location has at least two characters.
 */
public String generateCode()
```
  Example 1:
    Label: Example 1
    Explanation: If the value of itinerary is "Denver -> Chicago -> Boston", then generateCode() should return "DECHBO".
  Example 2:
    Label: Example 2
    Explanation: If the value of itinerary is "Paris -> London", then generateCode() should return "PALO".

## Questions

**How many responses can I get scored?**

You can read every question without a plan. Your first scored response is included. A plan unlocks unlimited scoring.

**Can I type Java in the editor?**

Yes. Type your code the way you would on the digital exam. The Java Quick Reference is available while you write.

**How is FRQ 1 different from FRQ 2?**

FRQ 1 gives you the class and asks for two methods, or a constructor and a method. FRQ 2 asks you to write a whole class from a specification.

**Do small syntax slips cost points?**

On the exam, a slip like a missing semicolon usually doesn’t cost a point when your logic is clear. Wrong method calls and wrong comparisons do.

**Are these real College Board questions?**

No. We wrote them in the AP format, with the same two parts, and wrote scoring guidelines for each one.

## Related

- [Methods FRQ exam guide](/ap-comp-sci-a/ap-computer-science-a-exam/ap-comp-sci-a-frq-1-methods-and-control-structures/study-guide/ap-comp-sci-a-frq-1-methods-and-control-structures)
- [AP Computer Science A Class Design FRQ practice](/ap-comp-sci-a/frqs/class-design)
- [AP Computer Science A ArrayList FRQ practice](/ap-comp-sci-a/frqs/arraylist)
- [AP Computer Science A 2D Array FRQ practice](/ap-comp-sci-a/frqs/2d-array)
- [AP Computer Science A FRQs](/ap-comp-sci-a/frqs)
- Any question by id: the `get_frq` tool on the [Fiveable MCP server](/mcp/docs)

## About This Document

Canonical Fiveable pages are available as Markdown at the same path plus `.md`.

- [llms.txt](https://fiveable.me/llms.txt): index of Fiveable's sections and URL patterns
- [llms-full.txt](https://fiveable.me/llms-full.txt): complete subject and unit listing
- [MCP server](https://fiveable.me/mcp): call Fiveable as tools instead of fetching pages (`https://fiveable.me/api/mcp`)
- [MCP server for AP teachers](https://fiveable.me/mcp/teachers): a teacher's classes, assignments and AP-rubric grading (`https://fiveable.me/api/mcp/teacher`)
