Ap Csa 2019 Frq 1 Apcalendar
AP CSA 2019 FRQ 1: APCalendar
Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF
| Question Type | Methods & Control Structures |
| Skills Tested | Static method calls, loop with helper call, modulo arithmetic, day-of-week formula |
| Difficulty | Medium |
| Recommended Time | 22 minutes |
What This Problem Asks
2019 AP CSA FRQ 1 APCalendar asks students to write two static methods. numberOfLeapYears counts leap years between year1 and year2 using the provided isLeapYear helper. dayOfWeek uses firstDayOfYear and dayOfYear with the formula (firstDay + dayNum - 1) % 7.
What This FRQ Tests
This FRQ tests Unit 1 (calling static helper methods) and Unit 2 (loops, modulo operator).
Official Question & PDF
PDF cannot display on this device. Open PDF directly →
Provided Code
public class APCalendar
{
private static boolean isLeapYear(int year) { /* not shown */ }
public static int numberOfLeapYears(int year1, int year2) {
/* part (a) */
}
private static int firstDayOfYear(int year) { /* not shown */ }
private static int dayOfYear(int month, int day, int year) { /* not shown */ }
public static int dayOfWeek(int month, int day, int year) {
/* part (b) */
}
}
Part A — 4 Points
Write numberOfLeapYears: return the count of leap years between year1 and year2 inclusive, using isLeapYear.
Write Your Solution
Scoring Rubric (Part A — 4 points)
| +1 | Loops from year1 through year2 inclusive |
| +1 | Calls isLeapYear in the context of the loop |
| +1 | Counts the number of leap years |
| +1 | Returns the correct count |
Solution
public static int numberOfLeapYears(int year1, int year2)
{
int count = 0;
for (int year = year1; year <= year2; year++)
{
if (isLeapYear(year))
{
count++;
}
}
return count;
}
Part B — 5 Points
Write dayOfWeek: return the day of week (0=Sunday, 6=Saturday) for the given date, using firstDayOfYear and dayOfYear.
Write Your Solution
Scoring Rubric (Part B — 5 points)
| +1 | Calls firstDayOfYear(year)
|
| +1 | Calls dayOfYear(month, day, year)
|
| +1 | Uses correct formula combining first day and day of year |
| +1 | Uses modulo 7 to get day of week in range 0–6 |
| +1 | Returns the correct day of week (algorithm) |
Solution
public static int dayOfWeek(int month, int day, int year)
{
int firstDay = firstDayOfYear(year);
int dayNum = dayOfYear(month, day, year);
return (firstDay + dayNum - 1) % 7;
}
firstDayOfYear gives the day-of-week for Jan 1. dayOfYear gives how many days into the year the date is (Jan 1 = day 1). The day of week = (firstDay + dayNum - 1) % 7. The -1 accounts for Jan 1 being day 1 (not day 0).Common Mistakes to Avoid
dayOfYear returns 1 for January 1 (not 0). The formula must subtract 1: (firstDay + dayNum - 1) % 7. Without the -1, January 1 would give (firstDay + 1) % 7 which is wrong.
Exam Tips
Scoring Summary
| Part | Method | Points |
|---|---|---|
| Part A | Write |
4 |
| Part B | Write |
5 |
| Total | 9 |
Want the Complete 2019 FRQ Solutions?
Browse all past AP CSA FRQs with full solutions and scoring breakdowns.
Related FRQs
Methods & Control Structures 2023 FRQ 1: AppointmentBook — Consecutive-block scheduling algorithm Methods & Control Structures 2018 FRQ 1: FrogSimulation — Loop with three termination conditionsStudy the Concepts
Unit 1 Study Guide → Unit 2 Study Guide →
Struggling with FRQs? Get 1-on-1 Help
Work directly with Tanner — AP CS teacher with 11+ years experience and 1,845+ verified tutoring hours. 54.5% of students score 5s (vs. 25.5% national average).
5-session packages at $125/hr. Venmo, Zelle, PayPal, or credit card.
Frequently Asked Questions
What does 2019 AP CSA FRQ 1 APCalendar test?
FRQ 1 tests static method calls with helper functions. numberOfLeapYears loops year1 to year2 counting isLeapYear calls. dayOfWeek uses a formula combining firstDayOfYear and dayOfYear with modulo 7.
How many points is 2019 FRQ 1 worth?
9 points: 4 for Part A (numberOfLeapYears) and 5 for Part B (dayOfWeek).
What is the formula for dayOfWeek?
(firstDayOfYear(year) + dayOfYear(month, day, year) - 1) % 7. The -1 is because dayOfYear returns 1 for January 1 (not 0).
Why use static methods here?
APCalendar uses all static methods (no instance needed) for calendar calculations. Static is appropriate when methods don't depend on any object state.
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.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]