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.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
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 . 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
- Understand the queue abstract data type, FIFO behaviour, linear, circular and priority queues, and the enqueue and dequeue operations using front and rear pointers.
A focused answer to AQA A-Level Computer Science 4.2.2, covering the queue abstract data type, FIFO behaviour, linear, circular and priority queues, and the enqueue and dequeue operations with front and rear pointers.
- Understand the stack abstract data type, LIFO behaviour, the push, pop and peek operations using a stack pointer, and the use of stacks for subroutine calls and recursion.
A focused answer to AQA A-Level Computer Science 4.2.3, covering the stack abstract data type, LIFO behaviour, the push, pop and peek operations with a stack pointer, overflow and underflow, and the use of the call stack.
- Understand a hash table, the role of a hashing algorithm, how a key maps to an index, the meaning of a collision, and collision-resolution methods such as rehashing and chaining.
A focused answer to AQA A-Level Computer Science 4.2.6, covering hash tables, hashing algorithms, mapping a key to an index, collisions, load factor, and collision-resolution methods including rehashing and chaining.
- Understand the built-in data types: integer, real or float, Boolean, character and string, and understand records, arrays and user-defined data types built from them.
A focused answer to AQA A-Level Computer Science 4.1.1, covering the built-in data types (integer, real, Boolean, character, string), how each is stored, and how records, arrays and user-defined types are built from them.
- Understand a dictionary as an abstract data type of key-value pairs, its operations, how it is typically implemented using a hash table, and when a dictionary is appropriate.
A focused answer to AQA A-Level Computer Science 4.2.7, covering the dictionary abstract data type of key-value pairs, its operations, its typical implementation using a hash table, and when to use a dictionary.
Sources & how we know this
- AQA A-level Computer Science (7517) specification — AQA (2015)