SLIDE 1 / 10
CSZone.co.uk
Click anywhere to advance · Arrow keys also work
AQA 7517 · Paper 1 · 4.1.1b

Arithmetic & Relational
Operators

AQA A-Level Computer Science · Section 4.1 Fundamentals of Programming

WHAT YOU'LL LEARN
Arithmetic operators (+ - * / DIV MOD ^) · Relational operators · Operator precedence
EXAM RELEVANCE
Appears in trace tables, program writing & error-finding questions
Arithmetic Operators

AQA 7517 Arithmetic Operators

OperatorMeaningExampleResult
+Addition17 + 522
-Subtraction17 - 512
*Multiplication17 * 585
/Real division17 / 53.4
DIVInteger division (quotient)17 DIV 53
MODModulo (remainder)17 MOD 52
^Exponentiation (power)2 ^ 8256
DIV & MOD

Understanding DIV and MOD

DIV — INTEGER DIVISION
Returns the whole-number quotient, discarding any remainder.

17 DIV 5 = 3 (5 goes into 17 three times)
100 DIV 7 = 14
MOD — MODULO (REMAINDER)
Returns the remainder after integer division.

17 MOD 5 = 2 (17 = 3×5 + 2)
100 MOD 7 = 2 (100 = 14×7 + 2)
Real-world uses of MOD: Testing if a number is even (n MOD 2 = 0), finding last digit (n MOD 10), wrapping array indices, clock arithmetic
Relational Operators

Comparison Operators

Relational operators compare two values and return a Boolean (True/False).

OperatorMeaningExampleResult
=Equal to5 = 5True
Not equal to5 ≠ 3True
<Less than3 < 7True
>Greater than9 > 4True
Less than or equal to5 ≤ 5True
Greater than or equal to6 ≥ 9False
⚠️ In AQA pseudocode, = is used for both assignment AND comparison (context determines meaning). Python uses == for comparison.
Precedence

Operator Precedence (BIDMAS)

ORDER (HIGHEST → LOWEST)
1. Brackets ( )
2. Exponent ^
3. Multiplication, Division * / DIV MOD
4. Addition, Subtraction + -
WORKED EXAMPLES
2 + 3 * 4 = 14 (not 20)
(2 + 3) * 4 = 20
2 ^ 3 + 1 = 9 (8 + 1)
10 DIV 3 + 1 = 4 (3 + 1)
Trace Table

Following Operator Expressions

AQA PSEUDOCODE
x ← 15
y ← 4
a ← x DIV y
b ← x MOD y
c ← x / y
OUTPUT a, b, c
VariableValueExplanation
a315 DIV 4 = 3 (quotient)
b315 MOD 4 = 3 (15 = 3×4 + 3)
c3.7515 / 4 = 3.75 (real division)
Real-World Context

Operators in Programs

MOD 2 = 0 — check if a number is even (e.g. for alternating rows, parity checks)
DIV 10 — extract digits (e.g. 153 DIV 10 = 15 removes last digit)
MOD 60 — convert seconds to minutes/seconds (clock arithmetic)
^ — calculate compound interest, exponential growth, bitwise powers of 2
Relational operators used in IF conditions and WHILE loops to control program flow
Example: IF score MOD 2 = 0 THEN OUTPUT "even" ENDIF
Python vs Pseudocode

AQA Pseudocode ↔ Python

OperationAQA PseudocodePython
Additiona + ba + b
Multiplicationa * ba * b
Real divisiona / ba / b
Integer divisiona DIV ba // b
Moduloa MOD ba % b
Exponentiationa ^ ba ** b
Not equal toa ≠ ba != b
AQA Exam Style

Practice Question

AQA 7517 — Paper 1 Style Question
A programmer writes the following pseudocode:

x ← 29
y ← 6
OUTPUT x MOD y
OUTPUT x DIV y
OUTPUT (x + y) ^ 2

State the output produced by each line.
[3 marks]
1 mark
x MOD y5 (29 = 4×6 + 5)
1 mark
x DIV y4 (6 goes into 29 four times)
1 mark
(x + y) ^ 21225 (35² = 1225)
Summary

Key Points to Remember

/ (division) returns a REAL result · DIV returns an INTEGER quotient
MOD returns the remainder after integer division — vital for even/odd checks
^ is the AQA power operator — Python uses **
Relational operators always return Boolean True/False
BIDMAS applies — use brackets to override precedence
Watch out: AQA uses ≠ not !=, and DIV not //
Exam trace table questions often test MOD and DIV
🎉 Lesson complete — move to the quiz!