In AP Computer Science Principles, the modulus operator (written as MOD on the exam reference sheet) is an arithmetic operator that evaluates to the remainder when one integer is divided by another. For example, 17 MOD 5 evaluates to 2, because 5 goes into 17 three times with 2 left over.
The modulus operator gives you the remainder of a division problem, not the quotient. Think back to long division in elementary school. 17 divided by 5 is "3 remainder 2." Regular division cares about the 3. MOD cares about the 2. So 17 MOD 5 evaluates to 2.
On the AP CSP exam reference sheet, modulus appears as a MOD b, and the CED tells you exactly what to assume (EK AAP-2.C.2): a is an integer greater than or equal to 0, and b is an integer greater than 0. MOD is one of the five arithmetic operators the exam provides, alongside +, -, *, and / (EK AAP-2.C.3). The most common job MOD does in programs is checking divisibility. If num MOD 2 equals 0, the number is even. If it equals 1, the number is odd. Any time a MOD b equals 0, you know b divides evenly into a.
Modulus lives in Topic 3.3 (Mathematical Expressions) in Unit 3: Algorithms and Programming, under learning objective AP Comp Sci P 3.3.C, which asks you to evaluate expressions that use arithmetic operators. EK AAP-2.C.1 names modulus explicitly as one of the arithmetic operators in most programming languages, and EK AAP-2.C.2 defines exactly how a MOD b behaves on the exam. This matters because Unit 3 is the heart of the AP CSP multiple-choice section, and MOD shows up constantly in code-reading questions. If you can't evaluate 19 MOD 5 quickly and correctly, you'll misread loops, conditionals, and algorithms built on it.
Keep studying AP® Computer Science Principles Unit 3
Arithmetic Operators (Unit 3)
MOD is the fifth member of the arithmetic operator family on the reference sheet, joining +, -, *, and /. It follows the same order-of-operations rules as multiplication and division when you evaluate expressions (EK AAP-2.B.5), so treat MOD at that same priority level when you trace code.
Selection and Conditionals (Unit 3)
MOD's real power shows up inside IF statements. The classic move is IF (num MOD 2 = 0) to test for even numbers. The exam loves pairing MOD with selection because it tests two skills at once, evaluating the expression and following the branch.
Iteration and Loops (Unit 3)
MOD often appears inside loops to do something every nth time, like printing every 3rd value when i MOD 3 = 0. When you trace a loop on the exam, evaluating MOD correctly at each step is usually the whole question.
Expressions and Sequencing (Unit 3)
An expression like 17 MOD 5 evaluates to a single value (EK AAP-2.B.4), and that value can feed into a variable assignment, a display statement, or a condition. MOD is a great example of how small expressions get chained together in sequential code (AP Comp Sci P 3.3.B).
MOD is multiple-choice territory. The most common question types ask you to evaluate an expression directly ("What does 19 MOD 5 evaluate to?" Answer: 4), pick the right operator for a task ("Which expression determines if a number is odd?" Answer: something using num MOD 2), or trace code where MOD controls a loop or conditional. The Create Performance Task doesn't require MOD, but it's a handy tool if your program needs divisibility checks or cycling behavior. Two things to lock down. First, MOD gives the remainder, never the quotient. Second, the exam guarantees a is 0 or greater and b is greater than 0, so you never have to worry about negative numbers or dividing by zero.
Division and modulus split the same long-division problem into two answers. 17 / 5 gives you the quotient (how many times 5 fits into 17), while 17 MOD 5 gives you the remainder (what's left over, which is 2). Students lose easy points by computing the quotient when the question asks for MOD. If you see MOD, ignore how many times it divides and report only the leftover.
The modulus operator a MOD b evaluates to the remainder when a is divided by b, so 17 MOD 5 equals 2.
MOD is one of the five arithmetic operators on the AP CSP exam reference sheet, along with +, -, *, and /.
The exam assumes a is an integer greater than or equal to 0 and b is an integer greater than 0, so you never deal with negatives or division by zero.
If a MOD b equals 0, then b divides evenly into a, which is how programs check divisibility.
The classic exam pattern is num MOD 2, which equals 0 for even numbers and 1 for odd numbers.
MOD returns the remainder, not the quotient. Division (/) handles the quotient.
It's the arithmetic operator, written as MOD on the exam reference sheet, that evaluates to the remainder when one integer is divided by another. For example, 17 MOD 5 evaluates to 2 because 5 fits into 17 three times with 2 left over.
It evaluates to 4. Five goes into 19 three times (making 15), and 19 minus 15 leaves a remainder of 4.
No. Division (/) gives you the quotient, while MOD gives you the remainder. For 17 and 5, division focuses on the 3 (how many times 5 fits) and MOD gives you the 2 (what's left over).
Use num MOD 2. If it evaluates to 1, the number is odd; if it evaluates to 0, the number is even. This is one of the most common MOD questions on the AP CSP exam.
You won't see that. The CED (EK AAP-2.C.2) says to assume a is an integer greater than or equal to 0 and b is an integer greater than 0 in a MOD b, so negative values and dividing by zero are off the table.
Connect this key term to the AP exam workflow: review the course, practice questions, and check related study tools.
Review units, study guides, and course resources.
Check this vocabulary in multiple-choice context.
Apply key concepts in written AP responses.
Estimate the exam score you are working toward.
Review the highest-yield facts before practice.
Put the full course together before test day.