SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
AQA 8525 · Section 3.2 · 3.2.2a

Variables, Constants
& Operators

Assignment · Constants · Arithmetic · Input & Output

CSZoneAQA GCSE Computer Science 8525
Learning Objectives

By the end of this lesson you will be able to...

Explain the difference between a variable and a constant
Write AQA pseudocode using assignment (), INPUT and OUTPUT
Use arithmetic operators (+, -, *, /, DIV, MOD) correctly
Choose appropriate names for variables and constants
Variables vs Constants

Storing Data in Programs

VARIABLE
A named storage location whose value can change during program execution.
score ← 0
score ← score + 10
name ← USERINPUT
CONSTANT
A named value that is fixed throughout the program — it cannot change once set.
CONST MAX_SCORE ← 100
CONST PI ← 3.14159
CONST PASS_MARK ← 50
Why constants?Constants make code easier to read and update — change the constant once, it updates everywhere.
AQA Pseudocode — Input & Output

Getting and Displaying Data

READING INPUT
name ← USERINPUT
age ← INT(USERINPUT)
score ← REAL(USERINPUT)
USERINPUT always returns a String — cast when needed!
DISPLAYING OUTPUT
OUTPUT 'Hello World'
OUTPUT score
OUTPUT 'Score: ' + STR(score)
OUTPUT name + ', age: ' + STR(age)
String concatenation:Use + to join strings: 'Name: ' + name
Arithmetic Operators

AQA Arithmetic — All 6 Operators

OperatorMeaningExampleResult
+Addition5 + 38
-Subtraction10 - 46
*Multiplication3 * 412
/Division (real)7 / 23.5
DIVInteger division7 DIV 23
MODRemainder7 MOD 21
⚡ Exam Tip:DIV and MOD are frequently tested. Know that 17 DIV 5 = 3 and 17 MOD 5 = 2.
Exam Practice

Have a go at this question

AQA-style question
Write a pseudocode program that:
• Reads a number of seconds from the user
• Calculates and outputs the number of complete minutes (use DIV)
• Calculates and outputs the remaining seconds (use MOD)
4 marks
MODEL ANSWER
seconds ← INT(USERINPUT)
minutes ← seconds DIV 60
remaining ← seconds MOD 60
OUTPUT minutes
OUTPUT remaining
Key Takeaways

What to Remember

Variable = value can change · Constant = value fixed for entire program
AQA uses ← for assignment and USERINPUT (always returns a String)
DIV = integer division (floor) · MOD = remainder after division
Cast with INT() or REAL() when reading numbers from input