2005 AP CSA FRQ 4: StudentRecord - Complete Solution

2005 AP CSA FRQ 4: StudentRecord

Topic: Arrays & Algorithms

Skills Tested: Array traversal, average calculation, boolean logic, method composition

Curriculum Alignment: Unit 2 (Selection/Iteration) (2025-2026 AP CSA)

Points: 9 | Time Estimate: ~22 minutes

Part (a)

Write the average method that calculates the arithmetic mean of scores between indices first and last (inclusive).

Try It First! Attempt to solve this part before viewing the solution. Use the concepts: Array traversal.

Solution

private double average(int first, int last)
{
    int sum = 0;
    int numScores = 0;
    
    for (int i = first; i <= last; i++)
    {
        sum += scores[i];
        numScores++;
    }
    
    return sum / (double) numScores;
}

Part (b)

Write the hasImproved method that returns true if each score is greater than or equal to the previous score.

Solution

private boolean hasImproved()
{
    for (int i = 1; i < scores.length; i++)
    {
        if (scores[i] < scores[i - 1])
            return false;
    }
    return true;
}

Part (c)

Write the finalAverage method that returns the average of all scores, or just the second half if the student improved.

Solution

public double finalAverage()
{
    int start = 0;
    
    if (hasImproved())
        start = scores.length / 2;
    
    return average(start, scores.length - 1);
}

Key Concepts

Cast to double to avoid integer division truncation
Use i <= last for inclusive bounds
Method composition: finalAverage calls hasImproved and average
scores.length / 2 gives the midpoint index

Common Mistakes to Avoid

Integer division: sum / numScores loses decimal precision
Off-by-one: using i < last instead of i <= last
Comparing wrong indices in hasImproved
Not using the helper methods in finalAverage

Scoring Guidelines

Total Points: 9

Points are awarded for:

  • Correct loop structure and bounds
  • Proper method calls and return statements
  • Correct conditional logic
  • Handling edge cases appropriately

Partial credit is available for demonstrating understanding even with minor syntax errors.

Official College Board Resources

About the Author: Tanner Crow is a certified AP Computer Science teacher with 11+ years of experience helping students succeed on the AP CSA exam.

Last updated: January 2026

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]