AP CSA FRQ Guide

2018 FRQ 1: FrogSimulation

Write two methods for a frog hopping simulation. The first runs one attempt until the frog reaches the goal, drops below zero, or uses all hops. The second runs many attempts and returns the success proportion.

Simulation and Repeated Trials22 minute targetsimulationloopshelper methodsboolean returndouble proportion

Skills Tested

What this FRQ is really practicing

simulationloopshelper methodsboolean returndouble proportion

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. 1Part A: start the frog at position 0.
  2. 2Call hopDistance once per hop and update the current position.
  3. 3Stop successfully as soon as the position reaches or passes goalDistance.
  4. 4Stop unsuccessfully if the position becomes negative or maxHops are used without success.
  5. 5Part B: run num independent simulations.
  6. 6Count how many simulations return true and return the success count divided by num as a double.

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 only after all hops instead of stopping immediately when the frog reaches the goal.
Using exactly maxHops successful hops as a failure because of an off-by-one loop.
Ignoring negative hop distances.
Returning an integer ratio from runSimulations.
Calling hopDistance more than once for a single hop.

Self Check

Review questions before you submit

Initializes the frog position at zero.

The simulation begins at the starting position before any hop.

Uses a loop bounded by maxHops.

The frog may not hop more than the allowed maximum.

Calls hopDistance for each attempted hop.

Do not invent the hop value; use the provided helper method.

Adds the hop distance to the current position.

The hop can be positive or negative, so update a running position.

Returns true when the position reaches or passes the goal.

Passing the goal still counts as success.

Returns false when the position becomes negative.

A negative position ends the simulation unsuccessfully.

Runs exactly num simulations in runSimulations.

Use a loop controlled by num.

Calls simulate inside runSimulations.

Part B should rely on the simulation method.

Practice Links

Where to go next