2007 AP CSA FRQ 3: StudentAnswerSheet - Complete Solution

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 ("?").

Try It First! Attempt to solve this part before viewing the solution.

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

Use equals() for String comparison, not ==
Blank answers ("?") don't affect score
Standard find-max algorithm: track index of maximum
Start loop at 1 when comparing to index 0

Common Mistakes to Avoid

Using == instead of .equals() for String comparison
Wrong penalty calculation (should be -0.25, not -0.5)
Not handling blank answers correctly
Returning score instead of name in part (b)

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

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]