Data structures — AQA GCSE Computer Science
Data structures in AQA GCSE Computer Science organise and store collections of related data elements efficiently under a single identifier. Mastery of one-dimensional arrays, two-dimensional arrays, and records is essential for manipulating complex datasets in algorithms and Paper 1 programming tasks.
Data structures explained
A record groups related fields of different data types under one name, so a single record can describe one entity such as a student with a name (string), age (integer) and average score (real).
Read the full explanation
To use records in design, first identify the entities in the problem, then list the fields each needs with a suitable data type, then show how records are stored (for example an array of records) and how individual fields are accessed. For instance, a library system might define a Book record with title, author and year, held in an array of Book records. Present your design clearly, naming each record, its fields and types, and explaining how the program would read or update a field. This demonstrates that you can structure data logically for a simple problem.
Your focus
- Define a record with named fields and appropriate data types for a simple problem.
- Explain how records are stored and how individual fields are accessed or updated.
- Justify the choice of a record to group related data of different types.
Which command word is this?
Provide a brief, direct recall of a fact without explanation or working, such as naming the index of a specific array element.
Data structures exam tips
Topic Overview
Data structures allow programmers to group, manage, and manipulate related collections of data efficiently under a single identifier rather than declaring dozens of individual variables. In AQA GCSE Computer Science, students are required to understand static 1D arrays, 2D arrays, and heterogeneous records.
Understanding these structures underpins algorithm design, file handling, and database concepts. Whether sorting student exam results or rendering a board for a tic-tac-toe game, selecting the correct data structure dictates memory efficiency and processing logic.
Key Concepts
- →Static 1D Array: A fixed-size, indexed collection of items of the same data type stored in contiguous memory locations.
- →2D Array: An array of arrays, visualised as a grid with rows and columns, accessed using two index pointers: array[row][col].
- →Record: A composite data structure that can store related fields of differing data types under named attributes for a single entity.
- →Zero-based Indexing: The standard addressing system where the first element is at index 0 and the final element is at index length - 1.
Marking Points
- Identifies the entities in the problem and defines a record for each, naming the record clearly.
- Lists the fields of each record with an appropriate data type for each field.
- Explains how records are stored, for example in an array of records, to hold multiple instances.
- Shows how an individual field is accessed or updated within a record.
- Justifies why a record is suitable for grouping related data of different types.
Examiner Tips
- 💡Start by listing the entities in the problem, then define one record per entity with named, typed fields.
- 💡State the data type of every field explicitly to show a complete design.
- 💡Explain how multiple records are stored, such as an array of records, and how one field is read or changed.
- 💡Always state whether your index begins at 0 or 1 if writing freehand pseudocode, though adhering to standard 0-indexing is strongly expected by AQA mark schemes.
- 💡When traversing a 2D array, clearly distinguish between the inner and outer loop counters (e.g., use 'row' and 'col' instead of vague letters like 'i' and 'j' to avoid indexing errors).
Common Mistakes
- Defining a record with fields but no data types: each field should have a stated type such as string, integer or real.
- Using a single array of one type to hold unrelated data: a record groups related fields of different types under one name.
- Forgetting how to access a field: state that a field is reached through the record name and field name, not by a single index alone.
- Believing arrays can hold mixed data types; in classical computer science and the AQA specification, arrays are strictly homogeneous (storing elements of one data type only), unlike records or Python lists.
- Confusing records with files; a record represents a single structured entry (like a row in a table), while a file is a secondary storage container that holds multiple records.
- Assuming an array's size can dynamically expand during runtime; classical arrays are static data structures with fixed size defined at declaration.
Revision Plan
- 1Day 1-2: Master 1D arrays by practicing traversal, searching, and linear accumulation using standard pseudocode.
- 2Day 3-4: Learn 2D array coordinates, nested loops, and matrix processing algorithms such as finding maximum values.
- 3Day 5: Practice defining and accessing record structures with mixed data types and dot notation (e.g., student.firstName).
- 4Day 6-7: Complete past AQA Paper 1 algorithm questions specifically requiring 2D arrays and records under timed conditions.
Exam Question Types
- 📋Pseudocode Tracing: Stepping through trace tables tracking values inside 1D or 2D arrays across nested loops.
- 📋Algorithm Writing: Constructing pseudocode or high-level code to search, filter, or calculate statistics from an array.
- 📋Record Structure Definition: Defining a record format by specifying field names and appropriate data types for a given scenario.
Command Word Expectations (AQA)
Provide a brief, direct recall of a fact without explanation or working, such as naming the index of a specific array element.
Produce complete, syntactically viable code or pseudocode implementing the required operations and handling data structures correctly.
Set out the causes, reasons, or mechanics behind a concept, such as why a record is preferred over an array for storing pupil profiles.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: An algorithm processes a 1D array named 'readings' containing 5 floating-point numbers: [12.4, 15.1, 11.8, 14.2, 13.5]. Write an algorithm in pseudocode to calculate and output the average of all numbers in the array.
- 1.Step 1: Initialise an accumulator variable 'total' to 0.0 to track the running sum.
- 2.Step 2: Use a FOR loop from index 0 to 4 (or length of readings - 1) to traverse the array.
- 3.Step 3: Inside the loop, add the value of readings[i] to 'total'.
- 4.Step 4: After the loop, divide 'total' by the number of elements (5 or LEN(readings)) and store in 'average'.
- 5.Step 5: Output the calculated 'average'.
Question: A teacher records student grades in a 2D array named 'marksGrid' with 3 rows (representing students) and 4 columns (representing tests). Write an algorithm using nested loops to count how many marks across the entire grid are equal to or greater than 50.
- 1.Step 1: Initialise a counter variable 'passCount' to 0.
- 2.Step 2: Create an outer loop iterating variable 'r' from 0 to 2 for the 3 rows.
- 3.Step 3: Create an inner loop iterating variable 'c' from 0 to 3 for the 4 columns.
- 4.Step 4: Use a selection statement IF marksGrid[r][c] >= 50 THEN increment 'passCount' by 1.
- 5.Step 5: Close both loops and OUTPUT 'passCount'.