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

Variables, Constants
& Data Types

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

WHAT YOU'LL LEARN
Variable & constant declaration · AQA data types · Type casting
EXAM PAPER
Paper 1: On-Screen Exam · 2 hours 30 minutes
Learning Objectives

By the end of this lesson…

Understand the difference between a variable and a constant
Know all AQA 7517 primitive data types and their uses
Apply type casting to convert between data types
Write correct variable declarations using AQA pseudocode
Answer AQA exam questions on data types with confidence
Variables

What is a Variable?

DEFINITION
A named memory location whose value can change during program execution.
AQA PSEUDOCODE
score ← 0

name ← "Alice"

score ← score + 10
PYTHON EQUIVALENT
score = 0

name = "Alice"

score = score + 10
Variables must have meaningful names — no spaces, case-sensitive in most languages. Use camelCase or snake_case.
Constants

What is a Constant?

DEFINITION
A named memory location whose value is set once and cannot change during program execution.
AQA PSEUDOCODE
CONSTANT PI ← 3.14159

CONSTANT MAX_SIZE ← 100

CONSTANT VAT_RATE ← 0.20
WHY USE CONSTANTS?
Prevents accidental modification
Makes code more readable
Change in one place updates everywhere
Data Types

AQA 7517 Primitive Data Types

Data TypeDescriptionExampleAQA Keyword
IntegerWhole number (positive or negative)42, -7, 0INTEGER
RealNumber with decimal point3.14, -0.5REAL
BooleanTrue or False onlyTrue, FalseBOOLEAN
CharacterSingle character'A', '5', '!'CHARACTER
StringSequence of characters"Hello World"STRING
⚠️ AQA uses REAL not "float" — use AQA terminology in exams. Characters are written in single quotes, strings in double quotes.
Type Casting

Converting Between Data Types

Type casting converts a value from one data type to another.

FunctionConverts toAQA PseudocodePython
INT(x)IntegerINT("42") → 42int("42")
REAL(x)RealREAL(5) → 5.0float(5)
STR(x)StringSTR(42) → "42"str(42)
BOOL(x)BooleanBOOL(1) → Truebool(1)
Common use: reading user input returns a STRING — you must cast to INTEGER before doing arithmetic: age ← INT(USERINPUT)
AQA Pseudocode

Declaring Variables & Constants

VARIABLE EXAMPLES
studentName ← "Bob"

age ← 16

average ← 73.5

passed ← True

grade ← 'A'
CONSTANT EXAMPLES
CONSTANT PASS_MARK ← 40

CONSTANT PI ← 3.14159

CONSTANT SCHOOL_NAME ← "CSZone Academy"
AQA uses for assignment. Python uses =. Both are valid in answers — just be consistent.
Watch Out!

Common Exam Mistakes

❌ MISTAKE 1: Wrong terminology
AQA says REAL, not float. AQA says CHARACTER, not char. Use AQA terms to get the mark.
❌ MISTAKE 2: Confusing variable and constant
A constant cannot be changed after initial assignment. PI = 3.14 should always be a CONSTANT, not a variable.
❌ MISTAKE 3: Forgetting type casting on input
USERINPUT always returns a STRING. Write age ← INT(USERINPUT) before arithmetic, not just age ← USERINPUT.
AQA Exam Style

Practice Question

AQA 7517 — Paper 1 Style Question
A program stores a student's name, their exam score (which can include decimal values), and whether they have passed. Identify the most appropriate data type for each of these three values and justify your choices.
[6 marks]
1 mark
Name → String — because it is a sequence of characters
2 marks
Exam score → Real — because it may include a decimal part (e.g. 73.5)
2 marks
Passed → Boolean — because it can only be True or False
1 mark
Each justification linked clearly to the definition of the data type
Summary

Key Terms to Remember

VARIABLE
Named memory location — value can change. Declared with name ← value
CONSTANT
Named memory location — value cannot change. Declared with CONSTANT name ← value
DATA TYPES
INTEGER · REAL · BOOLEAN · CHARACTER · STRING
TYPE CASTING: INT() · REAL() · STR() · BOOL()
Always cast USERINPUT to the correct type before use in calculations
🎉 Lesson complete — move to the quiz to test yourself!