PCEP-30-02 · Question #94
Which expression evaluates to 7?
The correct answer is A. 9%3+7. Option A (9%3+7) evaluates to 7 because % is the modulo operator, which returns the remainder of division - 9%3 equals 0 (since 9 divides evenly by 3), and 0+7 = 7. Option B (9-37) is wrong because multiplication is evaluated before subtraction: 37 = 21, giving 9-21 = -12…
Question
Options
- A9%3+7
- B9-3*7
- C9/3-7
- D9/3*7
How the community answered
(61 responses)- A84% (51)
- B2% (1)
- C5% (3)
- D10% (6)
Explanation
Option A (9%3+7) evaluates to 7 because % is the modulo operator, which returns the remainder of division - 9%3 equals 0 (since 9 divides evenly by 3), and 0+7 = 7. Option B (9-3*7) is wrong because multiplication is evaluated before subtraction: 3*7 = 21, giving 9-21 = -12. Option C (9/3-7) performs division first, yielding 3-7 = -4. Option D (9/3*7) applies division then multiplication left-to-right: 9/3 = 3, then 3*7 = 21.
Memory tip: Remember PEMDAS/BODMAS - % (modulo) shares the same precedence level as * and /, so it's resolved before + or -. When you see %, ask "what's left over?" - if a number divides evenly, the remainder is always 0.
Community Discussion
No community discussion yet for this question.