Ap Csa 2018 Frq 1 Frogsimulation

FRQ Archive2018 FRQs › FRQ 1: FrogSimulation
2018 AP CSA • Methods & Control Structures

AP CSA 2018 FRQ 1: FrogSimulation

Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF

9 Points Medium Units 1 & 2
Question Type Methods & Control Structures
Skills Tested While loop with three stop conditions, simulation runner, double proportion
Difficulty Medium
Recommended Time 22 minutes

What This Problem Asks

2018 AP CSA FRQ 1 FrogSimulation asks students to write two methods. simulate runs one hop simulation stopping when the goal is reached, position goes negative, or max hops are exhausted. runSimulations runs num simulations and returns the proportion that succeeded.

What This FRQ Tests

This FRQ tests Unit 2: Selection & Iteration (while loop with compound conditions, counting) and Unit 1 (calling private helper methods).

Official Question & PDF

Download Full FRQ PDF →

PDF cannot display on this device. Open PDF directly →

Timer 22:00

Provided Code

public class FrogSimulation { private int goalDistance; private int maxHops; private int hopDistance() { } public boolean simulate() { } public double runSimulations(int num) {
    }
}

Part A — 4 Points

Write simulate: return true if frog reached or passed goalDistance. Three stop conditions: goal reached, negative position, or max hops exhausted.

Write Your Solution

Drag corner to expand ▽

Scoring Rubric (Part A — 4 points)

+1 Updates frog position using hopDistance() in a loop
+1 Loop terminates when max hops exhausted
+1 Loop terminates when frog reaches goal OR goes negative
+1 Returns correct boolean (algorithm)

Solution

public boolean simulate()
{
    int position = 0;
    int hops = 0;
    while (position < goalDistance && position >= 0 && hops < maxHops)
    {
        position += hopDistance();
        hops++;
    }
    return position >= goalDistance;
}
Three stop conditions: goal reached, negative position, max hops used. The while loop continues WHILE none are true.

Part B — 5 Points

Write runSimulations: run num simulations and return the proportion that returned true as a double.

Write Your Solution

Drag corner to expand ▽

Scoring Rubric (Part B — 5 points)

+1 Loops num times
+1 Calls simulate() each iteration
+1 Counts successes when simulate() returns true
+1 Calculates proportion as double
+1 Returns correct proportion (algorithm)

Solution

public double runSimulations(int num)
{
    int successes = 0;
    for (int i = 0; i < num; i++)
    {
        if (simulate())
        {
            successes++;
        }
    }
    return (double) successes / num;
}

Common Mistakes to Avoid

Missing the negative-position stop condition

Wrong

while (position < goalDistance && hops < maxHops)

Correct

while (position < goalDistance && position >= 0 && hops < maxHops)

Exam Tips

Write all three stop conditions before coding, then negate them for the while.
Cast to double: (double) successes / num.

Scoring Summary

Part Method Points
Part A Write 4
Part B Write 5
Total 9

Want the Complete 2018 FRQ Solutions?

Browse all past AP CSA FRQs with full solutions and scoring breakdowns.

FRQ Archive →

Related FRQs

Methods & Control Structures2023 FRQ 1: AppointmentBook — Consecutive-block scheduling

Study the Concepts

Unit 2 Study Guide →

Struggling with FRQs? Get 1-on-1 Help

Work directly with Tanner — AP CS teacher with 11+ years experience and 1,845+ verified tutoring hours. 54.5% of students score 5s (vs. 25.5% national average).

5.0Rating (451+ reviews)
1,845+Verified Hours
54.5%Score 5s

Book a Session ($150/hr) →

5-session packages at $125/hr. Venmo, Zelle, PayPal, or credit card.

Frequently Asked Questions

What does 2018 AP CSA FRQ 1 FrogSimulation test?

FRQ 1 tests a while loop with three termination conditions and a simulation-runner returning a double proportion.

How many points is 2018 FRQ 1 worth?

9 points: 4 for Part A (simulate) and 5 for Part B (runSimulations).

What are the three stop conditions?

Goal reached (position >= goalDistance), negative position (position < 0), or max hops used (hops >= maxHops).

How do you avoid integer division in runSimulations?

Cast: (double) successes / num.

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]