Skip to topic
    ← Back to course topics

    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

    1. Define a record with named fields and appropriate data types for a simple problem.
    2. Explain how records are stored and how individual fields are accessed or updated.
    3. 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
    1. 1Day 1-2: Master 1D arrays by practicing traversal, searching, and linear accumulation using standard pseudocode.
    2. 2Day 3-4: Learn 2D array coordinates, nested loops, and matrix processing algorithms such as finding maximum values.
    3. 3Day 5: Practice defining and accessing record structures with mixed data types and dot notation (e.g., student.firstName).
    4. 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)
    State

    Provide a brief, direct recall of a fact without explanation or working, such as naming the index of a specific array element.

    Write

    Produce complete, syntactically viable code or pseudocode implementing the required operations and handling data structures correctly.

    Explain

    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)
    Pitfall: Confusing zero-based indexing with one-based indexing when accessing array elements or writing loop bounds.
    ❌ Weak Answer (Loses Marks):The third element of scores is scores[3] and you loop from 1 to the length.
    Example improved answer:In standard zero-indexed arrays, the third item is accessed using scores[2]. An iteration over an array of size n begins at index 0 and terminates at index n - 1.
    Examiner Tip: Always check whether the exam question specifies 0-indexed or 1-indexed pseudocode; standard AQA pseudocode assumes 0-indexing unless explicitly stated otherwise.
    Pitfall: Muddling row and column coordinates when referencing or updating items in a two-dimensional array.
    ❌ Weak Answer (Loses Marks):grid[x][y] gets the coordinate with x along the bottom and y up the side like a maths graph.
    Example improved answer:In a 2D array, elements are indexed as array[row][column] or array[row, column]. The first index selects the outer horizontal row, and the second index selects the column within that row.
    Examiner Tip: Visualise 2D arrays as a table of rows first, then columns. Remember 'RC cars' (Row before Column) to keep the index order straight.
    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. 1.Step 1: Initialise an accumulator variable 'total' to 0.0 to track the running sum.
    2. 2.Step 2: Use a FOR loop from index 0 to 4 (or length of readings - 1) to traverse the array.
    3. 3.Step 3: Inside the loop, add the value of readings[i] to 'total'.
    4. 4.Step 4: After the loop, divide 'total' by the number of elements (5 or LEN(readings)) and store in 'average'.
    5. 5.Step 5: Output the calculated 'average'.
    Final Answer: total = 0.0 FOR i = 0 TO LEN(readings) - 1 total = total + readings[i] ENDFOR average = total / LEN(readings) OUTPUT 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. 1.Step 1: Initialise a counter variable 'passCount' to 0.
    2. 2.Step 2: Create an outer loop iterating variable 'r' from 0 to 2 for the 3 rows.
    3. 3.Step 3: Create an inner loop iterating variable 'c' from 0 to 3 for the 4 columns.
    4. 4.Step 4: Use a selection statement IF marksGrid[r][c] >= 50 THEN increment 'passCount' by 1.
    5. 5.Step 5: Close both loops and OUTPUT 'passCount'.
    Final Answer: passCount = 0 FOR r = 0 TO 2 FOR c = 0 TO 3 IF marksGrid[r][c] >= 50 THEN passCount = passCount + 1 ENDIF ENDFOR ENDFOR OUTPUT passCount
    Active Recall Memory Test
    What is the primary technical difference between an array and a record?
    Key Fact: An array stores multiple items of the same data type, whereas a record stores multiple fields of different data types relating to a single entity.
    In an array of length 8 using zero-based indexing, what is the index of the final element?
    Key Fact: 7
    Which component of the coordinate pair grid[3][5] represents the row index?
    Key Fact: 3 (the first index represents the row, and 5 represents the column).
    Frequently Asked Questions
    Why does AQA test arrays when Python only uses lists?
    Python lists are dynamic abstractions, but the AQA specification focuses on foundational computer science theory. Arrays are static, fixed-size structures in memory that teach core concepts of contiguous memory management, pointer arithmetic, and index safety. In written exams, you can use Python list syntax, but you must respect the constraints of traditional arrays.
    What is dot notation in records?
    Dot notation is the syntax used to access or modify a specific field within a record variable. For example, if you have a record variable named 'player1', accessing its score field is written as 'player1.score'. It links the record instance to its specific attribute directly.
    What happens if an algorithm accesses an array index that does not exist?
    Attempting to access an index outside the declared bounds (for example, index 5 in an array of length 5 indexed 0 to 4) causes an 'Index Out of Range' runtime error. In low-level languages, it can lead to memory access violations or buffer overflow vulnerabilities.
    Can a 2D array contain rows of different lengths in GCSE Computer Science?
    No, in GCSE Computer Science, 2D arrays are treated as regular rectangular or square matrices where every row has an identical number of columns. Irregular or jagged arrays are not part of the AQA GCSE specification.