Skip to main content
EnglandComputer ScienceSyllabus dot point

How are arrays, records and fields used to store structured data?

Understand arrays (one, two and three dimensional), records and fields, and the difference between static and dynamic data structures.

A focused answer to AQA A-Level Computer Science 4.2.1, covering one, two and three dimensional arrays, records and fields, indexing, and the difference between static and dynamic data structures.

Generated by Claude Opus 4.88 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Arrays and dimensions
  3. Records and fields
  4. Static and dynamic data structures

What this dot point is asking

AQA wants you to describe arrays of one, two and three dimensions, explain records and fields, use indexing to access elements, and distinguish static from dynamic data structures.

Arrays and dimensions

  • One-dimensional (1D): a simple list, for example scores[5] holds five numbers.
  • Two-dimensional (2D): a table accessed by row and column, for example grid[row][col], useful for matrices and game boards.
  • Three-dimensional (3D): adds a third index, for example cube[x][y][z], useful for layered data such as a stack of grids or voxels in a 3D space.

A 2D array is often processed with a nested loop, one loop per dimension, and a 3D array with three nested loops. Because the elements are stored contiguously in memory and are all the same size, the computer can calculate the exact address of any element directly from its index, which is why array access is constant time O(1)O(1). This direct-addressing property is the chief reason arrays are so efficient for random access.

Records and fields

An array of records is an extremely common combination: one array holds many records, each record holds the fields for one entity. This is effectively how a table of data is represented in memory before it is written to a file or database.

Static and dynamic data structures

Static structures are simple and fast and never run out unexpectedly, but they waste memory if oversized and overflow if too small, and the size cannot adapt to the data. Dynamic structures use memory efficiently and have no fixed limit, but they carry the overhead of managing pointers, allocating memory at run time, and the risk of memory leaks if memory is not released. The choice is a trade-off between predictability and flexibility.

Exam-style practice questions

Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

AQA 20184 marksA program stores the marks of 30 students in each of 4 subjects. Explain why a two-dimensional array is a suitable structure, state how you would access the mark of student 12 in subject 3, and describe how the data would be processed to total all marks. Assume zero-based indexing.
Show worked answer →

A 2D array is suitable because the data is naturally a table: one dimension indexes the student (0 to 29) and the other the subject (0 to 3), and every element is the same type (a mark), which is exactly what an array requires.

The mark of student 12 in subject 3 is accessed as marks[12][3] using zero-based indexing.

To total all marks, use a nested loop: an outer loop over the students and an inner loop over the subjects, adding each marks[student][subject] to a running total. The nested loop visits every element once.

Markers reward justifying the table structure, the correct index expression, and describing a nested loop that visits every element.

AQA 20214 marksCompare static and dynamic data structures. In your answer, state what determines the size of each, and give one advantage and one disadvantage of a static data structure.
Show worked answer →

A static data structure has a fixed size decided when the program is compiled, so memory is reserved in advance (a standard array is an example). A dynamic data structure can grow and shrink while the program runs, requesting and releasing memory from the heap (a linked list is an example), so its size is determined at run time by the data.

An advantage of a static structure is that it is simple and fast, and the memory is guaranteed to be available because it is reserved up front. A disadvantage is that it wastes memory if made larger than needed and overflows if the data exceeds the fixed size.

Markers reward the compile-time versus run-time size distinction and a valid advantage and disadvantage of the static structure.

Related dot points

Sources & how we know this