← IGCSE Computer Science Paper 2

MOD: remainder (8.1c)

Returns the remainder left when a is divided by b. MOD(10, 3) is 1. The result is 0 when b divides a exactly. Example: MOD(130, 60) gives the 10 leftover minutes.

Understanding MOD: remainder (8.1c) in IGCSE Computer Science Paper 2

What it does: 130 minutes is 2 hours (120 minutes) with 10 minutes left, and MOD(130, 60) gives that remainder 10. An even number divides by 2 exactly, so MOD(Number, 2) is 0. Odd numbers leave a remainder of 1. 10 divided by 3 is 3 remainder 1. MOD gives the remainder, so the answer is 1. MOD gives the remainder. The whole-number quotient is given by DIV. MOD(130, 60) is 10, the leftover minutes after 2 whole hours. The first argument is the number being divided. MOD needs two arguments, a and b. MOD(17, 5) returns 2. 7 divided by 2 is 3 remainder 1. MOD returns the remainder 1, not the quotient 3.

Common mistakes: The arguments are the wrong way round. MOD(a, b) is the remainder when a is divided by b, so the total minutes must come first: MOD(TotalMins, 60) gives the 10 leftover minutes. The two arguments of MOD must be separated by a comma. It should be MOD(Num, 3), which gives 1.

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 429–438) and word search (Modules 419–438).

Take this worksheet further — free with Cloodit

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

Learning
Duo
What does MOD(10, 3) return?
31
Matches
OUTPUT MOD(10)
↓
MOD needs two arguments, a and b. Only one was given, so it cannot work out a remainder. It should be MOD(10, 3).
Applying
Meanings
Term
MOD(a, b)
Meaning
Returns the remainder left when a is divided by b. MOD(10, 3) is 1. The result is 0 when b divides a exactly. Example: MOD(130, 60) gives the 10 leftover minutes.
Practice
TotalMinutes ← 130
Testing
Gaps
OUTPUT (10, 3)
Check Answer
Spots
3DECLARE Left : INTEGER
4Left ← MOD(60, TotalMins)

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

The 'Pufferfish' badge — Error Handler, 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 does MOD(10, 3) return?
A. 1 ✓
B. 3
10 divided by 3 is 3 remainder 1. MOD gives the remainder, so the answer is 1.
2. Which statement describes MOD(a, b)?
A. It returns the whole-number part of a divided by b
B. It returns the remainder left when a is divided by b ✓
MOD gives the remainder. The whole-number quotient is given by DIV.
3. What does MOD(12, 4) return?
A. 3
B. 0 ✓
4 divides 12 exactly (3 times) with nothing left over, so the remainder is 0. The 3 would be the result of DIV(12, 4).
4. A student wants the leftover minutes after converting 130 minutes into hours. Which expression is correct?
A. MOD(130, 60) ✓
B. MOD(60, 130)
MOD(130, 60) is 10, the leftover minutes after 2 whole hours. The first argument is the number being divided.
5. If MOD(a, b) gives 0, what do we know?
A. b divides a exactly ✓
B. a is smaller than b
A remainder of 0 means b goes into a an exact number of times, with nothing left over.

Match the Pairs

MOD(10, 3) → Gives 1, because 3 goes into 10 three times (9) and 1 is left over
MOD(12, 4) → Gives 0, because 4 divides 12 exactly with nothing left over
Find the leftover minutes after taking 130 minutes and removing whole hours → leftover ← MOD(130, 60)
Check whether a whole number is even by testing if the remainder after dividing by 2 is 0 → IF MOD(Number, 2) = 0 THEN
OUTPUT MOD(10) → MOD needs two arguments, a and b. Only one was given, so it cannot work out a remainder. It should be MOD(10, 3).
OUTPUT MOD(3, 10) → The arguments are in the wrong order. To get the remainder of 10 divided by 3 it should be MOD(10, 3), which gives 1. MOD(3, 10) gives 3.

Key Term

MOD(a, b)
Returns the remainder left when a is divided by b. MOD(10, 3) is 1. The result is 0 when b divides a exactly. Example: MOD(130, 60) gives the 10 leftover minutes.

Fill in the Blanks

1. OUTPUT MOD(10, 3)
Hint: Type the library routine that returns the remainder after division.
2. Minutes ← MOD(130, 60)
Hint: Type the divisor: the number of minutes in one hour.
3. LeftoverMinutes ← MOD(130, 60) OUTPUT LeftoverMinutes
Hint: Type the variable that stores the remainder so it can be output.
4. IF MOD(Number, 2) = 0 THEN OUTPUT "Even" ENDIF
Hint: Type the value MOD returns when 2 divides the number exactly.
5. Hours ← 130 DIV 60 Minutes ← MOD(130, 60) OUTPUT Hours, Minutes
Hint: Type the routine that gives the leftover minutes after the whole hours.

Spot the Error

Question 1
A DECLARE TotalMins : INTEGER
B TotalMins ← 130
C DECLARE Left : INTEGER
D Left ← MOD(60, TotalMins)
E OUTPUT Left
Line D — The arguments are the wrong way round. MOD(a, b) is the remainder when a is divided by b, so the total minutes must come first: MOD(TotalMins, 60) gives the 10 leftover minutes.
Question 2
A Num ← 10
B Rem ← MOD(Num 3)
C OUTPUT Rem
Line B — The two arguments of MOD must be separated by a comma. It should be MOD(Num, 3), which gives 1.
Question 3
A DECLARE Number : INTEGER
B Number ← 12
C IF MOD(Number, 2) = 1 THEN
D OUTPUT "Even"
E ENDIF
Line C — An even number divides exactly by 2, so the remainder is 0, not 1. The condition should be MOD(Number, 2) = 0.
Question 4
A TotalMins ← 130
B Mins ← TotalMins DIV 60
C OUTPUT Mins
Line B — DIV gives the whole number of hours (2), not the leftover minutes. The leftover minutes need the remainder, so use MOD(TotalMins, 60), which gives 10.
Question 5
A A ← 17
B B ← 5
C R = MOD(A, B)
D OUTPUT R
Line C — Assignment in IGCSE pseudocode uses the ← arrow, not =. It should be R ← MOD(A, B), which stores 2.

Student with a class code? Join your class →