2006 AP CSA FRQ 1: DailySchedule - Complete Solution

2006 AP CSA FRQ 1: DailySchedule

Topic: ArrayList & Object Interaction

Skills Tested: ArrayList traversal, object method calls, removing while iterating, boolean logic

Curriculum Alignment: Unit 4 (Data Collections) (2025-2026 AP CSA)

Points: 9 | Time Estimate: ~22 minutes

Part (a)

Write the conflictsWith method that returns true if this appointment's time overlaps with another appointment's time.

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

Solution

public boolean conflictsWith(Appointment other)
{
    return getTime().overlapsWith(other.getTime());
}

Part (b)

Write the clearConflicts method that removes all appointments from the schedule that conflict with the given appointment.

Solution

public void clearConflicts(Appointment appt)
{
    int i = 0;
    
    while (i < apptList.size())
    {
        Appointment listAppt = (Appointment) apptList.get(i);
        if (appt.conflictsWith(listAppt))
            apptList.remove(i);
        else
            i++;
    }
}

Part (c)

Write the addAppt method that adds an appointment to the schedule, clearing conflicts first if it's an emergency.

Solution

public boolean addAppt(Appointment appt, boolean emergency)
{
    if (emergency)
    {
        clearConflicts(appt);
        apptList.add(appt);
        return true;
    }
    
    for (int i = 0; i < apptList.size(); i++)
    {
        Appointment listAppt = (Appointment) apptList.get(i);
        if (appt.conflictsWith(listAppt))
            return false;
    }
    
    apptList.add(appt);
    return true;
}

Key Concepts

Use helper methods (conflictsWith) when they're provided
While loop for removal prevents skipping elements
Only increment index when NOT removing
Check emergency flag first for early return pattern

Common Mistakes to Avoid

Using for-each loop when removing causes ConcurrentModificationException
Incrementing index after removal skips elements
Not using the provided conflictsWith method
Forgetting to add the appointment after clearing conflicts

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]