Ap Csa 2020 Frq 2 Checkdigit

FRQ Archive2020 FRQs › FRQ 2: CheckDigit
2020 AP CSA • Methods & Control Structures

AP CSA 2020 FRQ 2: CheckDigit

Complete solution, scoring rubric, and walkthrough — verified from the official College Board PDF

4 Points Easy-Medium Units 1 & 2
Question Type Methods & Control Structures
Skills Tested Integer modulo and division for digit extraction, helper method call, boolean return
Difficulty Easy-Medium
Recommended Time 22 minutes

What This Problem Asks

2020 AP CSA FRQ 2 CheckDigit was part of the special COVID take-home exam. isValid checks whether a number is a valid combination of a number and its check digit. The check digit is always the rightmost digit. Use % 10 to extract it and / 10 to get the number, then compare getCheck(num) to the extracted check digit.

What This FRQ Tests

This FRQ tests Unit 2: Selection & Iteration (modulo operator, integer division) and Unit 1 (calling static helper methods).

Official Question & PDF

Download Full FRQ PDF →

PDF cannot display on this device. Open PDF directly →

Timer 22:00

Provided Code

public class CheckDigit
{
    /** Returns the check digit for num.
     *  Precondition: 1-6 digits; num >= 0 */
    public static int getCheck(int num) { /* not shown */ }
    /** Returns true if numWithCheckDigit is valid (last digit is the correct check digit).
     *  Precondition: 2-7 digits; numWithCheckDigit >= 0 */
    public static boolean isValid(int numWithCheckDigit) { /* to be implemented in part (a) */ }
}

Part A — 4 Points

Write isValid: extract the check digit (last digit of numWithCheckDigit), extract the number (remaining digits), call getCheck on the number, and return whether it equals the extracted check digit.

Write Your Solution

Drag corner to expand ▽

 

Scoring Rubric (Part A — 4 points)

+1 Extracts the check digit from numWithCheckDigit (using % 10)
+1 Extracts the number without the check digit (using / 10)
+1 Calls getCheck appropriately with the extracted number
+1 Returns correct boolean comparison

Solution

public static boolean isValid(int numWithCheckDigit)
{
    int checkDigit = numWithCheckDigit % 10;
    int num = numWithCheckDigit / 10;
    return getCheck(num) == checkDigit;
}
Integer math: The rightmost digit is always numWithCheckDigit % 10. Removing the rightmost digit is numWithCheckDigit / 10 (integer division). For example, 1592: check = 1592 % 10 = 2; number = 1592 / 10 = 159. Then getCheck(159) == 2 → true.

Common Mistakes to Avoid

Confusing which part is the check digit

The check digit is always the RIGHTMOST (last) digit: numWithCheckDigit % 10. The number (without check digit) is numWithCheckDigit / 10.

Exam Tips

The 2020 exam was a special COVID take-home format with only 2 questions. Part (c) was a written design question, not code.
% 10 always gives the last digit. / 10 (integer division) always removes the last digit.

Scoring Summary

Part Method Points
Total (complete class) 4

Want the Complete 2020 FRQ Solutions?

Browse all past AP CSA FRQs with full solutions and scoring breakdowns.

FRQ Archive →

Related FRQs

Methods & Control Structures 2021 FRQ 1: WordMatch — Substring scoring with String methods

Study the Concepts

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.0Rating (451+ reviews)
1,845+Verified Hours
54.5%Score 5s

Book a Session ($150/hr) →

5-session packages at $125/hr. Venmo, Zelle, PayPal, or credit card.

Frequently Asked Questions

What was the 2020 AP CSA exam?

The 2020 AP CSA exam was a special COVID take-home format with only 2 FRQs instead of 4. Each had code parts (a) and (b) plus a written design part (c).

What does 2020 FRQ 2 CheckDigit test?

isValid tests integer modulo and integer division to extract digits, then calls getCheck on the extracted number to verify the check digit.

How do you extract the last digit of a number?

Use num % 10. For 1592: 1592 % 10 = 2.

How do you remove the last digit of a number?

Use num / 10 (integer division). For 1592: 1592 / 10 = 159.

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]