This study notes covers Deep Dive: DIV and MOD within Operators for GCSE Computer Science. Revise Operators in 3.2 Programming for GCSE Computer Science with 15 exam-style questions and 8 flashcards. This topic appears less often, but it can still be a useful differentiator on mixed-topic papers. It is section 4 of 7 in this topic. Use this study notes to connect the idea to the wider topic before moving on to questions and flashcards.
Deep Dive: DIV and MOD
DIV (integer division) - divides and throws away the remainder:
- 17 DIV 5 = 3 (17 ÷ 5 = 3 remainder 2)
- 10 DIV 3 = 3
MOD (modulus) - gives only the remainder:
- 17 MOD 5 = 2
- 10 MOD 3 = 1
Common uses:
- Check if even:
number MOD 2 == 0 - Get last digit:
number MOD 10 - Cycle through 0-9:
counter MOD 10
Practice questions for Operators
Which symbol is used as the equality comparison operator in OCR pseudocode?
Describe how each of the three Boolean operators AND, OR, and NOT work. Include when each returns TRUE.