← IGCSE Computer Science Paper 2

Using DIV and MOD together (8.1a)

DIV gives how many whole groups fit in the total, MOD gives what is left over. Together they split a total into whole units plus a remainder. E.g. 135 minutes is 2 hours 15.

Understanding Using DIV and MOD together (8.1a) in IGCSE Computer Science Paper 2

What it does: DIV(Total, Size) counts the whole groups. 12 goes into 50 four times, so there are 4 full boxes. MOD gives what is left over: MOD(200, 60) = 20. DIV(200, 60) = 3 is the number of whole hours. DIV(53, 8) = 6 full boxes (48 items) and MOD(53, 8) = 5 items left over.

Common mistakes: Cambridge pseudocode assigns a value with the ← operator, not =. The line should be TotalMinutes ← 135. The items left over after filling the boxes come from MOD, not DIV. DIV gives the number of full boxes. The line should be Left ← MOD(Total, BoxSize).

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 337–346) and word search (Modules 337–357).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which expression gives the whole hours in 135 minutes?
MOD(135, 60)DIV(135, 60)
Matches
Hours ← MOD(200, 60)
↓
MOD was used to find the whole hours. MOD gives the remainder (20), but whole hours need DIV, which gives 3.
Applying
Meanings
Term
DIV(Total, Size) and MOD(Total, Size)
Meaning
DIV gives how many whole groups fit in the total, MOD gives what is left over. Together they split a total into whole units plus a remainder. E.g. 135 minutes is 2 hours 15.
Practice
TotalMinutes ← 135
Testing
Gaps
Hours ← (TotalMinutes, 60)
Check Answer
Spots
1TotalMinutes = 135
2Hours ← DIV(TotalMinutes, 60)

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

The 'Sperm Whale' badge — Deep Sea Champion, 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. Which expression gives the whole hours in 135 minutes?
A. MOD(135, 60)
B. DIV(135, 60) ✓
DIV counts whole groups: DIV(135, 60) = 2 hours. MOD(135, 60) = 15 is the leftover minutes.
2. Which expression gives the leftover minutes after taking out whole hours from 200 minutes?
A. MOD(200, 60) ✓
B. DIV(200, 60)
MOD gives what is left over: MOD(200, 60) = 20. DIV(200, 60) = 3 is the number of whole hours.
3. 250 cents split with DIV(250, 100) and MOD(250, 100) gives which result?
A. 50 dollars and 2 cents
B. 2 dollars and 50 cents ✓
DIV(250, 100) = 2 whole dollars and MOD(250, 100) = 50 cents left over.
4. 47 items are packed in boxes of 10. Which tells you how many items are left loose?
A. MOD(47, 10) = 7 ✓
B. DIV(47, 10) = 4
DIV(47, 10) = 4 is the number of full boxes. MOD(47, 10) = 7 is the items left over.
5. Which pair of lines correctly splits 200 minutes into hours and minutes?
A. Hours ← DIV(200, 60) and Minutes ← MOD(200, 60) ✓
B. Hours ← MOD(200, 60) and Minutes ← DIV(200, 60)
DIV gives the whole units (3 hours) and MOD gives the remainder (20 minutes). Swapping them gives 20 hours and 3 minutes, which is wrong.

Match the Pairs

Hours ← DIV(135, 60) → Finds the number of whole hours in 135 minutes, which is 2
Left ← MOD(135, 60) → Finds the minutes left over after taking out whole hours, which is 15
To find how many full boxes of 12 are needed for 50 items, use DIV with the total and the box size → FullBoxes ← DIV(50, 12)
To find how many cents remain after taking out whole dollars from 275 cents, use MOD with the total and 100 → Cents ← MOD(275, 100)
Hours ← MOD(200, 60) → MOD was used to find the whole hours. MOD gives the remainder (20), but whole hours need DIV, which gives 3.
Spare ← DIV(50, 12) → DIV was used to find the items left over. DIV gives 4 full boxes, but the leftover items need MOD, which gives 2.

Key Term

DIV(Total, Size) and MOD(Total, Size)
DIV gives how many whole groups fit in the total, MOD gives what is left over. Together they split a total into whole units plus a remainder. E.g. 135 minutes is 2 hours 15.

Fill in the Blanks

1. Hours ← DIV(TotalMinutes, 60)
Hint: Type the function that gives how many whole hours fit into the minutes.
2. Minutes ← MOD(TotalMinutes, 60)
Hint: Type the function that gives the minutes left over after taking out whole hours.
3. Dollars ← DIV(Cents, 100)
Hint: Type the number of cents that make one whole dollar.
4. CONSTANT BoxSize ← 12 Boxes ← DIV(Items, BoxSize) Left ← MOD(Items, BoxSize)
Hint: Type the constant that holds how many items fit in one box.
5. Items ← 50 Boxes ← DIV(Items, 12) OUTPUT "Full boxes: ", Boxes
Hint: Type the variable that stores the number of full boxes.

Spot the Error

Question 1
A TotalMinutes = 135
B Hours ← DIV(TotalMinutes, 60)
C Mins ← MOD(TotalMinutes, 60)
D OUTPUT Hours, Mins
Line A — Cambridge pseudocode assigns a value with the ← operator, not =. The line should be TotalMinutes ← 135.
Question 2
A Total ← 47
B BoxSize ← 12
C Boxes ← DIV(Total, BoxSize)
D Left ← DIV(Total, BoxSize)
E OUTPUT Boxes, Left
Line D — The items left over after filling the boxes come from MOD, not DIV. DIV gives the number of full boxes. The line should be Left ← MOD(Total, BoxSize).
Question 3
A Cents ← 875
B Dollars ← DIV(Cents, 10)
C Change ← MOD(Cents, 100)
D OUTPUT Dollars, Change
Line B — There are 100 cents in a dollar, so the size to divide by is 100, not 10. The line should be Dollars ← DIV(Cents, 100).
Question 4
A DECLARE Eggs : REAL
B Eggs ← 50
C Cartons ← DIV(Eggs, 6)
D Spare ← MOD(Eggs, 6)
Line A — DIV and MOD work on whole numbers, and a count of eggs is a whole number. Eggs should be declared as INTEGER, not REAL.
Question 5
A Secs ← 200
B Mins ← DIV(Secs, 60)
C Rest ← MOD(Secs 60)
D OUTPUT Mins, Rest
Line C — The two arguments of MOD must be separated by a comma. The line should be Rest ← MOD(Secs, 60).

Student with a class code? Join your class →