← IGCSE Computer Science Paper 2

Arithmetic operators in Cambridge pseudocode

Arithmetic operators: + - * / calculate with numbers, and / gives a real result. DIV gives the whole-number quotient and MOD the remainder, so 17 DIV 5 is 3 and 17 MOD 5 is 2.

Understanding Arithmetic operators in Cambridge pseudocode in IGCSE Computer Science Paper 2

What it does: / always gives a real (decimal) answer, so Result holds 3.5, not 3. Brackets are worked out first: (2 + 3) is 5 and 5 * 4 is 20. Without brackets, 2 + 3 * 4 would be 14. DIV gives the whole-number quotient. 5 goes into 17 three times, so 17 DIV 5 is 3. The remainder 2 comes from MOD. MOD gives the remainder after dividing. 17 - 15 = 2, so 17 MOD 5 is 2. Multiplication happens before addition: 3 * 4 = 12, then 12 + 2 = 14. Brackets set the order. (2 + 3) * 4 = 5 * 4 = 20. The other one is 2 + 12 = 14.

Common mistakes: DIV gives the whole-number quotient (3). The remainder is found with MOD, so the line should be Rem ← Num MOD 5, which gives 2. MOD gives the remainder (15), not the number of whole hours. Whole hours need DIV: Hours ← Minutes DIV 60, which gives 2.

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 265–274) and word search (Modules 254–274).

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
Pages ← 17 / 5 OUTPUT Pages (meant to find whole pages, expecting 3)
↓
/ gives the real result 3.4, not the whole number 3. Use 17 DIV 5 to get the whole-number quotient.
Applying
Meanings
Term
+ - * / DIV MOD
Meaning
Arithmetic operators: + - * / calculate with numbers, and / gives a real result. DIV gives the whole-number quotient and MOD the remainder, so 17 DIV 5 is 3 and 17 MOD 5 is 2.
Practice
Minutes ← 135
Testing
Gaps
Quotient ← 17 5
Check Answer
Spots
2Num ← 17
3Rem ← Num DIV 5

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

The 'Tree Frog' badge — Leap of Logic, 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. 2
B. 3 ✓
DIV gives the whole-number quotient. 5 goes into 17 three times, so 17 DIV 5 is 3. The remainder 2 comes from MOD.
2. What is the value of 17 MOD 5?
A. 3
B. 2 ✓
MOD gives the remainder after dividing. 17 - 15 = 2, so 17 MOD 5 is 2.
3. Which result does 7 / 2 give in Cambridge pseudocode?
A. 3.5 ✓
B. 3
The / operator gives a REAL result, so 7 / 2 is 3.5. Use DIV if you want the whole-number answer 3.
4. Which expression gives the whole-number quotient of 20 divided by 6?
A. 20 DIV 6 ✓
B. 20 MOD 6
DIV gives the quotient (3). MOD gives the remainder (2).
5. What is the value of 2 + 3 * 4?
A. 14 ✓
B. 20
Multiplication happens before addition: 3 * 4 = 12, then 12 + 2 = 14.

Match the Pairs

17 DIV 5 → Gives the whole-number quotient, so the result is 3
17 MOD 5 → Gives the remainder after dividing, so the result is 2
The / operator gives a real result, so dividing 7 by 2 gives 3.5 → Result ← 7 / 2
Brackets set the order, so the addition is done before the multiplication and the answer is 20 → Total ← (2 + 3) * 4
Pages ← 17 / 5 OUTPUT Pages (meant to find whole pages, expecting 3) → / gives the real result 3.4, not the whole number 3. Use 17 DIV 5 to get the whole-number quotient.
IF Number DIV 2 = 0 THEN (meant to test for an even number) → DIV gives the quotient, not the remainder. To test for even, use Number MOD 2 = 0.

Key Term

+ - * / DIV MOD
Arithmetic operators: + - * / calculate with numbers, and / gives a real result. DIV gives the whole-number quotient and MOD the remainder, so 17 DIV 5 is 3 and 17 MOD 5 is 2.

Fill in the Blanks

1. Quotient ← 17 DIV 5
Hint: Type the operator that gives only the whole-number part of a division.
2. Remainder ← 17 MOD 5
Hint: Type the operator that gives what is left over after dividing.
3. Average ← Total / Count
Hint: Type the division symbol that gives a real (decimal) result.
4. Hours ← TotalMins DIV 60 Mins ← TotalMins MOD 60
Hint: Type the operator that finds how many whole hours fit into the minutes.
5. Mean ← (Score1 + Score2) / 2
Hint: Type the symbol that opens the group so the addition happens before the division.

Spot the Error

Question 1
A DECLARE Rem : INTEGER
B Num ← 17
C Rem ← Num DIV 5
D OUTPUT Rem
Line C — DIV gives the whole-number quotient (3). The remainder is found with MOD, so the line should be Rem ← Num MOD 5, which gives 2.
Question 2
A Minutes ← 135
B Hours ← Minutes MOD 60
C Left ← Minutes MOD 60
D OUTPUT Hours, Left
Line B — MOD gives the remainder (15), not the number of whole hours. Whole hours need DIV: Hours ← Minutes DIV 60, which gives 2.
Question 3
A INPUT Num
B IF Num DIV 2 = 0 THEN
C OUTPUT "Even"
D ENDIF
Line B — To test for an even number, check that the remainder after dividing by 2 is 0. That needs MOD, not DIV: IF Num MOD 2 = 0 THEN.
Question 4
A A ← 80
B B ← 70
C C ← 90
D Avg ← A + B + C / 3
E OUTPUT Avg
Line D — Division is done before addition, so only C is divided by 3. Brackets are needed to add first: Avg ← (A + B + C) / 3.
Question 5
A Price ← 4.50
B Total ← Price x 3
C OUTPUT Total
Line B — The letter x is not a multiplication operator in Cambridge pseudocode. Multiplication is *, so it should be Total ← Price * 3.

Student with a class code? Join your class →