AP CSA FRQ Guide

2024 FRQ 1: Feeder

Write two methods for a bird feeder simulation. One method simulates a single day with either normal bird feeding or an abnormal event. The other repeatedly simulates days and counts how many days food was available.

Methods, Random Values, and Simulation22 minute targetmethodssimulationrandom valuesinstance variablesloops

Skills Tested

What this FRQ is really practicing

methodssimulationrandom valuesinstance variablesloops

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: use randomness to distinguish normal feeding from the abnormal event.
  2. 2Under normal conditions, compute total food eaten from the number of birds and a random per-bird amount.
  3. 3Update currentFood so it never drops below zero.
  4. 4Part B: simulate up to numDays while food remains and return the number of days food was found.

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

Using Math.random() * 40 + 10, which misses one of the required possible per-bird amounts.
Subtracting food and accidentally allowing currentFood to become negative.
Forgetting that the abnormal event empties the feeder immediately.
Counting all requested days even after currentFood reaches 0.
Rewriting part A logic in part B instead of calling simulateOneDay.

Self Check

Review questions before you submit

Defines simulateOneDay with one int parameter and void return type.

The one-day method should not return a value.

Uses Math.random to represent the abnormal 5 percent event.

Use a random decimal check such as Math.random() < 0.05.

Sets currentFood to zero for the abnormal event.

The abnormal condition empties the feeder.

Generates a normal per-bird amount from 10 through 50.

A common expression is (int)(Math.random() * 41) + 10.

Multiplies the per-bird amount by numBirds.

Normal food consumed is based on all birds.

Prevents currentFood from becoming negative.

Use Math.max or an if statement that sets currentFood to 0 when needed.

Defines simulateManyDays with two int parameters and int return type.

The many-days method returns the number of days food was available.

Calls simulateOneDay inside simulateManyDays.

Part B should use the part A helper method.

Practice Links

Where to go next