📁 Paper 1 · 3.2 Programming
3.2.1 Data Types
AQA 8525 · GCSE Computer Science · ~10 min read
Notes
──
Video
──
Worksheet
──
Quiz

What is a Data Type?

A data type defines the kind of value a variable can store and the operations that can be performed on it. Choosing the correct data type makes programs more efficient and reduces errors.

The Core Data Types in AQA

Data TypeDescriptionExampleAQA Keyword
IntegerWhole number (positive, negative, or zero)42, -7, 0int
Real / FloatNumber with a decimal point3.14, -0.5, 100.0float/real
BooleanTrue or False onlyTrue, Falsebool
CharacterA single character'A', '3', '!'char
StringA sequence of characters"Hello", "abc123"str/string

Examples in AQA Pseudo-code

age16 // integer pi3.14159 // real/float passedTrue // boolean grade'A' // character name"Alice" // string

Casting (Type Conversion)

Casting converts a value from one data type to another. This is needed when you want to do arithmetic on input (which arrives as a string) or display numbers as text.

FunctionConverts toExampleResult
int(x)Integerint("42")42
float(x)Realfloat("3.14")3.14
str(x)Stringstr(99)"99"
bool(x)Booleanbool(0)False
userInput ← INPUT() // always a string num ← int(userInput) // cast to integer before arithmetic resultnum * 2 OUTPUT str(result) + " is the answer" // cast back to string for OUTPUT

Why Does the Data Type Matter?

  • Integer vs Real: 7 / 2 = 3 (integer division loses remainder); 7.0 / 2 = 3.5 (real keeps decimal)
  • String arithmetic: "3" + "4" = "34" (concatenation), not 7
  • Boolean: used in conditions — IF passed = True THEN ...
Exam tip: INPUT() always returns a string. You must cast it to int() or float() before using it in arithmetic. This is a very common exam question — "why would this code cause an error?"
⚠️ Common Mistakes
  • Using "float" and "real" — AQA uses both; they mean the same thing
  • Forgetting to cast INPUT — age ← INPUT() then age + 1 will fail
  • Confusing character (single char 'A') with string ("A" — also single but it's a string)
  • Using int() to round a float — int(3.9) = 3, not 4 (it truncates, not rounds)
Video coming soon

Key points

  • The 5 core AQA data types and when to use each
  • Why INPUT() always returns a string
  • How to cast between types with int(), float(), str()
  • Common errors caused by wrong data types
Click slide or press arrow keys to navigate
✍️

Worksheet — 3.2.1 Data Types

8 questions · 20 marks · Mark schemes on submit

Q1State the data type most suitable for storing a person's age.[1]
✅ Mark scheme
Mark scheme
Integer [1] — age is a whole number.
Q2State the data type for: (a) True/False answer (b) someone's name (c) price £9.99 (d) grade letter 'B'.[4]
✅ Mark scheme
Mark scheme
(a) Boolean [1]; (b) String [1]; (c) Real/Float [1]; (d) Character [1].
Q3Explain why INPUT() must be cast to an integer before arithmetic can be performed on it.[2]
✅ Mark scheme
Mark scheme
INPUT() always returns a string [1]; arithmetic cannot be performed on strings — it would concatenate instead of add [1].
Q4What is the result of: (a) "5" + "3" (b) 5 + 3 (c) int("5") + 3?[3]
✅ Mark scheme
Mark scheme
(a) "53" — string concatenation [1]; (b) 8 — integer addition [1]; (c) 8 — int("5")=5, then 5+3=8 [1].
Q5What does int(7.9) return? Explain why.[2]
✅ Mark scheme
Mark scheme
7 [1]; int() truncates (removes the decimal part) rather than rounding — it does NOT round to 8 [1].
Q6Write AQA pseudo-code to: ask the user to enter a number, cast it to a real, double it, and output the result as a string.[4]
✅ Mark scheme
Mark scheme
num ← float(INPUT()) [1]; result ← num * 2 [1]; OUTPUT str(result) [1]; correct overall structure [1].
Q7A student writes: score ← INPUT() followed by IF score > 50 THEN. Explain the error and how to fix it.[2]
✅ Mark scheme
Mark scheme
score is a string (from INPUT) so it cannot be compared with integer 50 [1]; fix: score ← int(INPUT()) to cast first [1].
Q8What is the difference between a character and a string? Give an example of each.[2]
✅ Mark scheme
Mark scheme
A character holds exactly one symbol e.g. 'A' [1]; a string holds a sequence of zero or more characters e.g. "Hello" [1].
Compare your answers to the mark schemes above.
Topic Quiz
Q 1 of 10
You scored
out of 10
Card 1 of 6
Click to flip
🎉
All cards reviewed!
TermDefinition
🎯

Mini Test — 3.2.1 Data Types

Timed exam conditions.

  • 8 questions · 8 marks · 10 minutes
  • 5 MCQ + 3 short answer
← 3.1.4b Merge Sort
9 of 57 · AQA 8525
3.2.2a Programming Concepts →