Type Match
Meet the five data types. Then nail the grade-9 skill: picking (and justifying) the right one for any real-world value.
Work it through together, step by step
A free interactive activity that works the method through with a class, step by step.
Start revising freeWhat you'll cover
What type is it?
Every value a program stores has a **data type**: a label that tells the computer how to store the value and what it is allowed to do with it. Pick the right type and everything just works. Pick the wrong one and you lose easy marks, and break real programs. Let's meet the five you need for the exam.
The famous five
AQA GCSE uses exactly five data types. Learn each one by what it is allowed to hold.
Whole, or not?
A running app records how many laps a runner completed and their finishing time in seconds. Which pair of types fits best?
- Laps as an integer, finishing time as a real
- Laps as a real, finishing time as an integer
- Both as integers, since a runner cannot have half a lap
- Both as reals, since either value might need a decimal
Stock the shop
An online shop stores each item's price as a _____, the number left in stock as an _____, and whether it is on sale as a _____.
Why it matters
The type you choose decides three things: • **Memory**: how much space the value takes up. • **Operations**: what you are allowed to do. You can add two integers, but you can't add two Booleans. • **What survives**: a string keeps a leading zero (`007`); store that as an integer and it becomes plain `7`.
Divide and see
Dry-run these three lines for each pair of numbers. Watch which result needs a **real** type and which stay whole.
The classic trap
A phone number *looks* like a number, but you should store it as a **string**. Three reasons: • It can start with a **0** (`07…`); an integer would silently drop the leading zero. • You never do **arithmetic** on it. Nobody adds two phone numbers together. • It can contain `+`, spaces or brackets, which a number type can't hold. The same reasoning makes **postcodes** and **ID numbers** strings too.
Store the number
Which data type should hold a mobile phone number like `07700 900123`?
- String
- Integer
- Real
- Character
One symbol, or many?
**Character** and **string** are easy to mix up. If a value is only ever a single symbol, character is the tighter, more precise fit.
Just one letter
A student's exam grade is a single letter from A to U, and **character** is the tightest fit. Which reason justifies that best?
- The value is always exactly one symbol, so no extra length is ever needed
- A character is always stored in fewer bits than any other data type
- Only a character can be compared with < and > so the grades can be sorted
- A string is not allowed to hold letters of the alphabet, only digits
Spot the strings
Pick the TWO values that are best stored as a **string**.
- A postcode, like "SW1A 1AA"
- A National Insurance number, like "QQ123456C"
- The number of pupils in a class
- A thermometer reading in °C
- Whether an item is currently on sale
Choose the right type
- Phone number
- Price in pounds
- Lives left in a game
- Is the door locked?
- String
- Real
- Integer
- Boolean
Find the wrong type
One value in this library system is stored with the WRONG type. Tap it.
- The system stores
- the book title as a string
- ,
- the ISBN as an integer
- ,
- the number of copies as an integer
- , and
- whether it is on loan as a Boolean
Justify it
A school app stores each pupil's **admission number** such as `004512`, their **average grade score**, and whether they have **paid for a trip**. State the data type for each and JUSTIFY every choice.
- Name a type for all three values, not just the tricky one.
- Give the reason as well as the label. The justification is where the marks are.
- Ask two questions of every value: could it lose a leading zero, and would you ever do arithmetic on it?
- Real for anything with a decimal, integer for counts, Boolean for a yes or no.
- Watch the trap: phone numbers, postcodes and ID numbers are strings, not integers.