Revision Notes
OxfordAQA IGCSE Computer Science (9210): Arithmetic operations in a programming language – Revision Notes
Revision notes for OxfordAQA IGCSE Computer Science 9210 section 3.2.3: arithmetic operators, real division, DIV and MOD patterns, exam traps and a self-test.
- Subject
- Computer Science
- Level
- IGCSE
- Topic
- Topic 2 – Programming
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to OxfordAQA IGCSE Computer Science (9210), For teaching from September 2017, exams from May/June 2019. Official specification .
Syllabus page (what it covers and how it is assessed): OxfordAQA IGCSE Computer Science.
Syllabus points this page covers
9210
- 3.2.3 Arithmetic operations in a programming language
Found an error? Report a correction.
Need help with this topic? Request a free trial class for IGCSE Computer Science (9210).
Condensed notes for section 3.2.3 Arithmetic operations in a programming language of OxfordAQA International GCSE Computer Science (9210). Worked examples and full explanations are in the arithmetic operations study guide.
What the specification asks
Be familiar with and be able to use: addition, subtraction, multiplication, real division, integer division
including remainders. Integer division is “usually a two-stage process”: 11 DIV 2 = 5 (integer quotient) and
11 MOD 2 = 1 (remainder).
Operator table
| Operator | Meaning | 17 ? 5 |
20 ? 4 |
|---|---|---|---|
+ |
Addition | 22 | 24 |
- |
Subtraction | 12 | 16 |
* |
Multiplication | 85 | 80 |
/ |
Real division | 3.4 | 5.0 |
DIV |
Integer quotient | 3 | 5 |
MOD |
Remainder | 2 | 0 |
Language names vary: Python // and %; Visual Basic \ and Mod; C# % for remainder. Use DIV and
MOD in exam answers where the question uses them.
Rules to remember
/in the specification’s pseudocode is real division:9 / 2 = 4.5.DIVgives a whole number, always rounding the answer down for positive values:9 DIV 2 = 4.MODgives the remainder, always smaller than the divisor:9 MOD 2 = 1.- Check:
(a DIV b) * b + (a MOD b) = a. - If
a < b:a DIV b = 0anda MOD b = a(e.g.4 DIV 9 = 0,4 MOD 9 = 4). - If
bdividesaexactly:a MOD b = 0.
Standard patterns
| Purpose | Code | Example |
|---|---|---|
| Even test | n MOD 2 = 0 |
30 MOD 2 = 0 → even |
| Odd test | n MOD 2 = 1 |
31 MOD 2 = 1 → odd |
| Factor/multiple test | a MOD b = 0 |
45 MOD 9 = 0 → 9 is a factor of 45 |
| Last digit | n MOD 10 |
386 MOD 10 = 6 |
| Drop last digit | n DIV 10 |
386 DIV 10 = 38 |
| Hours and minutes | m DIV 60, m MOD 60 |
135 min → 2 h 15 min |
| Full groups and leftovers | items DIV size, items MOD size |
29 pupils, teams of 4 → 7 teams, 1 left |
| Every nth item | i MOD n = 0 |
Do something on every 3rd pass |
Order of operations
Brackets → *, /, DIV, MOD → +, -. So 10 - 6 / 2 = 7 but (10 - 6) / 2 = 2.
Averages need brackets: (a + b + c) / 3.
Quick trace to remember
n ← 247
tens ← (n DIV 10) MOD 10
OUTPUT tens
247 DIV 10 = 24, then 24 MOD 10 = 4, so 4 (the tens digit) is output. Combining DIV to shift the number
right and MOD to keep the last digit picks out any digit: (n DIV 100) MOD 10 gives the hundreds digit, 2.
Questions often hide this pattern inside a loop, so trace each expression in its own column.
Key terms
| Term | Meaning |
|---|---|
| Operator | A symbol or keyword that performs an operation on values |
| Operand | A value an operator acts on |
| Real division | Division that gives a result that can have a fractional part |
Integer division (DIV) |
Division that gives only the whole-number quotient |
Remainder (MOD) |
What is left over after integer division |
| Modular arithmetic | Arithmetic using remainders, as MOD does |
| Quotient | The result of a division |
Exam traps
- DIV/MOD swapped: “quotient” means
DIV, “remainder” meansMOD. MODwritten as a decimal:13 MOD 4is 1, not 0.25./used for counts of boxes, pages or teams, giving a non-whole answer.- Missing brackets in averages and percentages.
- Even/odd reversed:
MOD 2 = 0is even. - Integer stored where a real is needed: the result of
/belongs in a real variable. - Language habits: writing
%without saying it means remainder; in the exam, useMODor name the operation.
Self-test
- Calculate
29 DIV 6and29 MOD 6. - Calculate
29 / 4. - State the value of
5 MOD 12. - Write a condition that is true when
yearis a multiple of 4. - State the value of
3 + 4 * 2. - A box holds 15 pens. Write expressions for the number of full boxes and the pens left over from
pens. - Give the expression that returns the last digit of
code. - Convert 500 seconds into minutes and seconds using
DIVandMOD. - Explain why
total / 3is wrong for the number of teams of three that can be made fromtotalpeople. - Find the error:
mean ← x + y / 2. - Use the check rule to verify that
47 DIV 8 = 5and47 MOD 8 = 7. - State the value of
naftern ← 731,n ← n DIV 10,n ← n MOD 10.
Answers:
- 4 and 5 (6 × 4 = 24, 29 − 24 = 5).
- 7.25.
-
year MOD 4 = 0.-
pens DIV 15andpens MOD 15.code MOD 10.- 8 minutes 20 seconds (
500 DIV 60 = 8,500 MOD 60 = 20). - Real division may give a fractional answer such as 6.33, but the number of teams must be whole; use
total DIV 3. - Only
yis divided by 2; it should bemean ← (x + y) / 2. - 5 × 8 + 7 = 47, so both values are consistent.
- 3 (
731 DIV 10 = 73, then73 MOD 10 = 3).
More resources on this topic
Related resources
-
Study guides
OxfordAQA IGCSE Computer Science (9210): Boolean operations in a programming language
Study guide to OxfordAQA IGCSE Computer Science 9210 section 3.2.5: NOT, AND and OR in loop and IF conditions, evaluation order, and common logic errors.
Computer Science · OxfordAQA · IGCSE
Read guide -
Practice questions
OxfordAQA IGCSE Computer Science (9210): Boolean operations in a programming language – Practice Questions
Original OxfordAQA IGCSE Computer Science 9210 practice questions with answers on NOT, AND and OR in compound conditions for loops and selection.
Computer Science · OxfordAQA · IGCSE
Try questions -
Revision notes
OxfordAQA IGCSE Computer Science (9210): Boolean operations in a programming language – Revision Notes
Revision notes for OxfordAQA IGCSE Computer Science 9210 section 3.2.5: NOT, AND and OR, compound conditions, range checks, evaluation order and a self-test.
Computer Science · OxfordAQA · IGCSE
Revise topic
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.