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

Records, Tuples
& Lists

AQA A-Level Computer Science · Section 4.2 Fundamentals of Data Structures

WHAT YOU'LL LEARN
Records (structured data) · Tuples (immutable) · Lists (mutable, dynamic)
AQA SPEC LINK
4.2.2 — Records, tuples and lists as data structures
Records

Records — Structured Data

A record groups together related data of different types under a single name. Each piece of data is a field.
AQA PSEUDOCODE
RECORD Student
  name: STRING
  age: INTEGER
  score: REAL
  passed: BOOLEAN
ENDRECORD

s1.name ← "Alice"
s1.age ← 17
s1.score ← 87.5
Records vs Arrays

Why Use Records?

ARRAY — SAME TYPE
scores ← [87, 65, 92, 78]
names ← ["Ali","Bob","Cal"]
Separate arrays needed for different types
RECORD — MIXED TYPES
student.name ← "Alice"
student.score ← 87.5
student.passed ← True
One record holds all related data
Records are ideal for real-world entities (students, products, employees). In Python, use a class or dict.
Tuples

Tuples — Immutable Ordered Collections

A tuple is an ordered collection of values that cannot be changed after creation (immutable). Written in parentheses in Python.
PYTHON EXAMPLES
coords = (51.5, -0.1)   ← latitude, longitude
rgb = (255, 128, 0)     ← colour value
point = (3, 4)

coords[0] → 51.5
coords[0] = 52.0      ← ERROR: immutable!
When to Use Tuples

Tuples vs Lists

TUPLE — USE WHEN:
Data should not change (coordinates, RGB, dates)
You want protection against accidental modification
Can be used as dictionary keys (unlike lists)
LIST — USE WHEN:
Data needs to change (add, remove, sort)
Collection size may vary
Mutable — can append, delete, sort
Lists

Lists — Dynamic & Mutable

A list is an ordered, mutable collection that can grow or shrink at runtime. In Python, it is the default sequence type.
PYTHON LIST OPERATIONS
items = [3, 1, 4, 1, 5]
items.append(9)       ← add to end
items.insert(0, 7)    ← insert at position
items.remove(1)       ← remove first occurrence
items.sort()          ← sort in place
len(items)            ← length
AQA Pseudocode Lists

Lists in AQA Pseudocode

shopping ← []           ← empty list
shopping.append("milk")
shopping.append("bread")
shopping.append("eggs")

FOR item IN shopping
  OUTPUT item
ENDFOR

shopping.remove("bread")
Comparison

Records, Tuples, Lists — Summary Table

FeatureRecordTupleList
OrderedFields namedYesYes
Mutable?YesNoYes
Mixed types?YesYesYes
Fixed size?Yes (fields)YesNo
Python typeclass/dicttuple ()list []
AQA Exam Style

Practice Question

AQA 7517 — Paper 1 Style
A school stores data about each pupil, including: name (string), date of birth (string), year group (integer), and whether they have paid fees (Boolean).

(a) State the most appropriate data structure to store a single pupil's data. Justify your answer. [2]
(b) Explain why a tuple would be appropriate for storing the date of birth. [2]
[4 marks]
2 marks
(a) Record — because it can hold multiple fields of different data types (name=string, dob=string, yeargroup=integer, feesPaid=boolean)
2 marks
(b) Date of birth is immutable — it cannot change, so a tuple prevents accidental modification
Summary

Key Points to Remember

Record — named fields of different types; models real-world entities
Tuple — immutable ordered collection; use when data shouldn't change
List — mutable, dynamic; can append/remove/sort; most flexible
Array: fixed-size, same type; List: dynamic, any type (Python)
🎉 Lesson complete — move to the quiz!