Revise Computingrevisecomputing.co.uk
Free student revisionSee questionsFor schoolsSchool enquiry
Free revisionSee questionsFor schoolsSchool enquiry
Knowledge/A Level/H446/01 Computer systems/Data Structures/Arrays (up to 3 dimensions), records…

Arrays (up to 3 dimensions), records, lists and tuples

Arrays (of up to 3 dimensions), records, lists, tuples

1.4.2 Data Structures

Practise exam questions

Data Structures — Note 1 of 3

Candidates should be able to describe what is meant by arrays (up to 3 dimensions), records, lists and tuples. They are expected to be able recognise when they can be used and incorporate them in their programs to store data

What you need to know

Data structures organise related data so it can be processed efficiently. Arrays hold a fixed number of items of the same type; records group related fields of different types; lists are dynamic; tuples are fixed and cannot be changed.

What to know

Key terms

Exam tipCommon mistake

Array

A static (fixed size) data structure holding items of the same data type, accessed by index. OCR arrays are zero-indexed.

  • A 2D array can be visualised as a table (board[row, col]); a 3D array adds a third index, e.g. sales[shop, month, product].
  • Static structures (arrays) have a fixed memory size, which can waste space but makes access fast and predictable. Dynamic structures (lists) can grow and shrink but need extra memory to manage.
Record

A data structure that groups related fields, which can have different data types, e.g. a student record with name (string), age (integer) and enrolled (Boolean).

List

A dynamic data structure whose size can change as items are added or removed; items can be of different types in languages like Python.

Tuple

An ordered collection of items that is IMMUTABLE: once created, its items cannot be changed, added or removed.

  • Exam tip: Choose a structure that suits the data, e.g. a tuple for values that must not change, such as the coordinates of a fixed point.

Code examples

Arrays, records, lists and tuples in Python
python
grid = [[0] * 3 for _ in range(3)]      # 2D array (3 x 3)
grid[1][2] = 5

student = {"name": "Sam", "age": 17, "enrolled": True}   # record

scores = [12, 7, 9]                     # list (dynamic)
scores.append(15)

origin = (0, 0)                         # tuple (immutable)
# origin[0] = 5  would cause an error

Data Structures

Note 1 of 3

  1. 1Arrays (up to 3 dimensions), records, lists and tuples
  2. 2Linked list, graph, stack, queue, tree, binary search tree and hash table
  3. 3How to create, traverse, add data to and remove data from these data structures
Topic overview

Ready to test yourself?

Practise 1.4.2 questions
← Previous topicHow character sets (ASCII and UNICODE) are used to represent text1.4.1 Data TypesNext note →Linked list, graph, stack, queue, tree, binary search tree and hash table1.4.2 Data Structures

Back to Data Structures