This mini-lesson covers AQA 3.2 — Programming: data types, variables & constants, the three programming constructs (sequence, selection, iteration), operators, arrays, subroutines, string & file handling, basic SQL and validation.
Work through each screen, answer the questions as you go (some are wordy, some are calculations) and collect ⭐ stars. Press Start when you're ready.
Data types
The five data types
Every value your program stores has a data type. AQA expects you to know these five:
Integer — a whole number, positive or negative, with no decimal part (e.g. -7, 42).
Real (also called float) — a number with a decimal part (e.g. 3.14, -0.5).
Boolean — one of only two values: True or False.
Character — a single letter, digit or symbol (e.g. 'A', '?').
String — a sequence of characters (e.g. "Hello").
Why it matters: choosing the right type saves memory and prevents errors — e.g. store a person's age as an integer, a price as a real, and a yes/no flag as a Boolean.
Quick check
Which data type?
?A program needs to store a temperature that could be a whole number and could be below zero (e.g. -8). Which data type best fits a whole number that can be negative?
Variables & constants
Variables vs constants
Both are named stores for data, but they differ in whether the value can change:
A variable holds a value that can change while the program runs (e.g. a running score).
A constant holds a value that is set once and never changes while the program runs (e.g. PI ← 3.142 or VAT ← 0.20).
# assignment uses the ← arrowCONSTANT VAT ← 0.20 # fixed
price ← 50 # a variable
price ← price + 5 # price can change
Remember: using a constant makes code easier to read and safer — you can't accidentally overwrite a value that's meant to stay fixed.
Programming constructs
Sequence, selection & iteration
Every program is built from just three constructs:
Sequence — statements run one after another, top to bottom.
Selection — a choice is made with a condition (IF … THEN … ELSE).
Iteration — code repeats. A count-controlled loop (FOR) runs a set number of times; a condition-controlled loop (WHILE) repeats until a condition is met.
# selection + iteration togetherFOR i ← 1 TO 3
IF i > 1 THEN
OUTPUT 'big'ELSE
OUTPUT 'small'ENDIFNEXT i
Key contrast: a FOR loop is count-controlled (you know how many times up front); a WHILE loop is condition-controlled (it repeats while a condition stays true).
Sort it
Which construct is it?
Tap a description, then tap the construct it belongs to.
➡️ Sequence
🔀 Selection
🔁 Iteration
Operators
Arithmetic, relational & Boolean operators
AQA groups operators into three families:
Arithmetic:+-*/, plus MOD (remainder), DIV (integer division) and ^ (exponent / "to the power of").
Relational:=, <, >, <=, >= and != (not equal) — they compare two values and give a Boolean.
Boolean:AND, OR, NOT — combine or reverse conditions.
MOD and DIV worked out
17 MOD 5 = 2 (the remainder: 17 = 3×5 + 2)
17 DIV 5 = 3 (integer division: how many whole 5s fit in 17)
2 ^ 3 = 8 (2 to the power of 3)
Tip: MOD gives the left-over; DIV gives the whole number of times. MOD is handy for testing "is a number even?" — n MOD 2 = 0 means even.
Calculate
Your turn — MOD
1Work out 17 MOD 5 (the remainder when 17 is divided by 5).
Hint: 17 = 3×5 + 2, so the remainder is 2.
Calculate
Your turn — DIV
2Work out 17 DIV 5 (integer division — how many whole 5s fit into 17).
Hint: 5 goes into 17 three whole times (3×5 = 15), with a bit left over that DIV throws away.
Arrays
Arrays (1D and 2D)
An array stores many values under one name, each reached by an index. In AQA pseudocode arrays are zero-indexed — the first item is at index 0.
A 1D array. A 2D array is like a grid (rows & columns), e.g. grid[row][column].
Watch out: because arrays start at 0, an array with 5 items has indexes 0 to 4 — there is no index 5.
Calculate
Your turn — array index
3An array scores ← [4, 8, 15, 16, 23] is zero-indexed. What is the value of scores[2]?
Hint: index 0 = 4, index 1 = 8, index 2 = 15.
Subroutines
Procedures & functions
A subroutine is a named block of code you can call whenever you need it. AQA distinguishes two kinds:
A functionreturns a value back to the code that called it (e.g. a function that returns the square of a number).
A procedure carries out a task but does not return a value (e.g. a procedure that just prints a message).
# a FUNCTION returns a valueFUNCTION square(n)
RETURN n * n
ENDFUNCTION# a PROCEDURE does not returnPROCEDURE greet()
OUTPUT 'Hello!'ENDPROCEDURE
The key difference: a function returns a value you can use in an expression; a procedure just does its job with no value handed back.
Quick check
Function or procedure?
?What is the main difference between a function and a procedure?
String & file handling
Strings & text files
String handling operations you must know:
LENGTH — how many characters, e.g. LENGTH("cat") = 3.
SUBSTRING / indexing — pull out part of a string by position.
Concatenation — join two strings together, e.g. "Hello" + " world".
.UPPER / .LOWER — convert a string to upper- or lower-case.
File handling follows four steps: open a text file, read from or write to it, then close it.
# reading a text file
myFile ← openRead('names.txt')
line ← myFile.readLine()
myFile.close()
Remember: always close a file when you're finished — leaving it open can lose data or lock the file.
Match it
Match term to meaning
Tap a description on the left, then its matching term on the right.
Description
Term
SQL & validation
SQL basics & validation
SQL (Structured Query Language) fetches data from a database table. The basic query is SELECT … FROM … WHERE:
SELECT name, age
FROM Students
WHERE age >= 16
Validation checks that input is sensible and allowablebefore the program uses it. Common checks:
Range check — is the value between allowed limits? (e.g. age 0–120)
Length check — is it the right number of characters?
Presence check — has something actually been entered?
Type check — is it the right data type? (e.g. a number, not text)
Don't confuse:validation checks input is reasonable/allowable; verification checks input was entered correctly (e.g. typing a password twice to confirm it matches).
Quick check
Count or condition?
?Which statement about loops is correct?
Quick check
What is validation?
?In programming, what does validation mean?
Recap
The big ideas to know
Data types: integer · real/float · Boolean · character · string
Variables vs constants: variable can change · constant is fixed
You've covered all of AQA 3.2 — data types, constructs, operators, arrays, subroutines, strings, files, SQL and validation. Press Finish to see your score.
🏆
Mini-lesson complete!
⭐⭐⭐
You've worked through Programming for AQA GCSE Computer Science. 🎉
Your stars: 0 / 0
Next: test yourself in the Evaluate stage Confidence Quiz, then lock it in with Verify.
📣 Smashed it? Share your score
Challenge a mate to beat your stars, or show a parent how you got on.