← IGCSE Computer Science Paper 2

Arithmetic operators including DIV and MOD

Arithmetic operators beside + - * /. DIV gives the whole-number quotient (17 DIV 5 = 3). MOD gives the remainder (17 MOD 5 = 2). Number MOD 2 = 0 tests for even. Brackets set the order.

Understanding Arithmetic operators including DIV and MOD in IGCSE Computer Science Paper 2

What it does: An even number has remainder 0 when divided by 2, so Number MOD 2 = 0 is the standard even test. Brackets are worked out first, so Price + Tax is added before the result is multiplied by 3. DIV gives the whole-number quotient: 5 goes into 17 three times. The remainder 2 is what MOD gives. MOD gives the remainder after dividing. 17 = 3 x 5 + 2, so 17 MOD 5 is 2. Multiplication is done before addition: 3 * 4 = 12, then 12 + 2 = 14. Use brackets (2 + 3) * 4 to get 20.

Common mistakes: MOD gives the remainder (2), not the number of full boxes. The whole-number quotient needs DIV: Items DIV BoxSize gives 3. DIV gives the whole-number quotient, so it cannot test for even. Use the remainder: Number MOD 2 = 0.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 358–368) and word search (Modules 358–378).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What is the value of 17 DIV 5?
23
Matches
IF Number DIV 2 = 0 THEN
↓
DIV gives the whole-number quotient, not the remainder. To test for even, use MOD 2 = 0.
Applying
Meanings
Term
DIV and MOD
Meaning
Arithmetic operators beside + - * /. DIV gives the whole-number quotient (17 DIV 5 = 3). MOD gives the remainder (17 MOD 5 = 2). Number MOD 2 = 0 tests for even. Brackets set the order.
Practice
DECLARE Number : INTEGER
Testing
Gaps
OUTPUT 17 5
Check Answer
Spots
3// number of full boxes
4Boxes <- Items MOD BoxSize

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Space Turtle' badge — Speed in Zero-G, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What is the value of 17 DIV 5?
A. 3 ✓
B. 2
DIV gives the whole-number quotient: 5 goes into 17 three times. The remainder 2 is what MOD gives.
2. What is the value of 17 MOD 5?
A. 2 ✓
B. 3
MOD gives the remainder after dividing. 17 = 3 x 5 + 2, so 17 MOD 5 is 2.
3. Which condition correctly tests whether Number is even?
A. Number MOD 2 = 0 ✓
B. Number DIV 2 = 0
An even number leaves remainder 0 when divided by 2, so use MOD. Number DIV 2 gives the quotient, not the remainder.
4. What is the value of 20 MOD 4?
A. 5
B. 0 ✓
4 goes into 20 exactly five times, so nothing is left over. The remainder is 0, so 5 is the DIV result.
5. What is the value of 2 + 3 * 4?
A. 20
B. 14 ✓
Multiplication is done before addition: 3 * 4 = 12, then 12 + 2 = 14. Use brackets (2 + 3) * 4 to get 20.

Match the Pairs

17 DIV 5 → Gives the whole-number quotient, which is 3
17 MOD 5 → Gives the remainder after dividing, which is 2
Test whether a number is even by checking that dividing by 2 leaves no remainder → IF Number MOD 2 = 0 THEN
Use brackets so the addition is worked out before the multiplication → Total <- (Price + Tax) * 3
IF Number DIV 2 = 0 THEN → DIV gives the whole-number quotient, not the remainder. To test for even, use MOD 2 = 0.
Average <- A + B / 2 → Division is worked out before addition, so only B is halved. Brackets are needed: (A + B) / 2.

Key Term

DIV and MOD
Arithmetic operators beside + - * /. DIV gives the whole-number quotient (17 DIV 5 = 3). MOD gives the remainder (17 MOD 5 = 2). Number MOD 2 = 0 tests for even. Brackets set the order.

Fill in the Blanks

1. OUTPUT 17 DIV 5
Hint: Type the operator that gives the whole-number quotient, ignoring any remainder.
2. Remainder ← 17 MOD 5
Hint: Type the operator that gives the remainder after division.
3. IF Number MOD 2 = 0 THEN OUTPUT "Even" ENDIF
Hint: Type the remainder that an even number leaves when divided by 2.
4. Average ← (Mark1 + Mark2) / 2
Hint: Type the arithmetic operator for division. The brackets make the addition happen first.
5. Minutes ← Total DIV 60 Seconds ← Total MOD 60
Hint: Type the operator that finds the seconds left over after the whole minutes are taken out.

Spot the Error

Question 1
A Items <- 17
B BoxSize <- 5
C // number of full boxes
D Boxes <- Items MOD BoxSize
E OUTPUT Boxes
Line D — MOD gives the remainder (2), not the number of full boxes. The whole-number quotient needs DIV: Items DIV BoxSize gives 3.
Question 2
A INPUT Number
B IF Number DIV 2 = 0 THEN
C OUTPUT "Even"
D ENDIF
Line B — DIV gives the whole-number quotient, so it cannot test for even. Use the remainder: Number MOD 2 = 0.
Question 3
A Sweets <- 23
B Left <- Sweets % 4
C OUTPUT "Left over: ", Left
Line B — % is not a Cambridge pseudocode operator. The remainder is found with MOD: Sweets MOD 4 gives 3.
Question 4
A Hours <- 135 / 60
B Mins <- 135 MOD 60
C OUTPUT Hours, Mins
Line A — / gives a real number (2.25), not a whole number of hours. Whole hours need DIV: 135 DIV 60 gives 2.
Question 5
A Maths <- 80
B Average <- Maths + 70 / 2
C OUTPUT Average
Line B — Division is done before addition, so only 70 is halved. Brackets are needed to add first: (Maths + 70) / 2.

Student with a class code? Join your class →