AP CSP 3.3 Exercise 2: Mathematical Expressions Applied Challenge

Big Idea 3: Algorithms and Programming · Topic 3.3 · Exercise 2

Mathematical Expressions: Applied Challenge

Six expressions where order of operations and MOD decide the answer.

How this one is different

MOD is the operator the exam leans on hardest and students practice least. Half of these turn on it.

Applied Practice

6 questions · scenario driven · every answer is recorded for your teacher

Question 1 of 6Trace
What is the value of the expression 17 MOD 5?
Correct. MOD gives the remainder. 17 divided by 5 is 3 with 2 left over.
Incorrect. 3 is the whole number quotient, not the remainder.
Incorrect. 3.4 is the exact division result. MOD returns only what is left over.
Incorrect. 85 is the product, not a division result.
Question 2 of 6Trace
What does this segment display?
n <- 2 + 3 * 4 DISPLAY n
Incorrect. 24 is the product of all three values.
Incorrect. 9 does not follow from any reading of the expression.
Incorrect. 20 comes from adding first, which ignores that multiplication binds tighter.
Correct. Multiplication happens before addition, so it is 2 + 12, which is 14.
Question 3 of 6Apply
Which expression is true exactly when the value in num is even?
Incorrect. MOD 0 is undefined, and the comparison is backwards besides.
Incorrect. A remainder of 1 identifies odd numbers.
Correct. An even number divides by 2 with nothing left over, so its remainder is 0.
Incorrect. This is true only when num itself is 0.
Question 4 of 6Transfer
A program must wrap a position around a circular track of 12 slots.
If pos may exceed 12, which expression keeps it within 0 to 11?
Incorrect. Subtracting once fails for any value more than 24, and it needs repeating.
Correct. MOD is exactly the wraparound operator. Any value maps into 0 through 11 in one step.
Incorrect. Division gives how many full laps, not the position within a lap.
Incorrect. This reverses the operands and asks the remainder of 12 divided by the position.
Question 5 of 6Trace
What does this segment display?
a <- 10 b <- 4 DISPLAY (a + b) MOD 7
Correct. The parentheses force the addition first, giving 14, and 14 divides by 7 exactly, leaving 0.
Incorrect. 1 would be the remainder of 15 divided by 7.
Incorrect. 2 would be the remainder of 16 divided by 7.
Incorrect. 7 is the divisor and can never be the remainder when dividing by 7.
Question 6 of 6Analyze
A program computes an average with total / count and count can be zero.
What kind of error is possible, and what is the fix?
Incorrect. The expression parses fine. Parentheses change grouping, not this failure.
Incorrect. Overflow concerns values too large to store, not division by zero.
Incorrect. MOD by zero is undefined too, so it fixes nothing.
Correct. Division by zero stops execution when it happens, which is a runtime error, and the standard guard is a conditional around the division.

Where to go next

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]