2007 AP CSA FRQ 3: StudentAnswerSheet
Topic: ArrayList & Scoring Algorithms
Skills Tested: Parallel ArrayList traversal, scoring logic, finding maximum
Curriculum Alignment: Unit 4 (Data Collections) (2025-2026 AP CSA)
Points: 9 | Time Estimate: ~22 minutes
Part (a)
Write the getScore method that calculates a student's score: +1 for correct, -0.25 for wrong, 0 for blank ("?").
Solution
public double getScore(ArrayList key)
{
double score = 0;
for (int i = 0; i < key.size(); i++)
{
if (answers.get(i).equals(key.get(i)))
score += 1;
else if (!answers.get(i).equals("?"))
score -= 0.25;
}
return score;
}
Part (b)
Write the highestScoringStudent method that returns the name of the student with the highest score.
Solution
public String highestScoringStudent(ArrayList key)
{
int maxIndex = 0;
for (int i = 1; i < sheets.size(); i++)
{
if (sheets.get(i).getScore(key) > sheets.get(maxIndex).getScore(key))
{
maxIndex = i;
}
}
return sheets.get(maxIndex).getName();
}
Key Concepts
Common Mistakes to Avoid
Official College Board Resources
About the Author: Tanner Crow is a certified AP Computer Science teacher with 11+ years of experience.
Last updated: January 2026