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).
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
Common Mistakes to Avoid
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
Continue Studying
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