Skip to content
VirtusAcademy

Records

FoundationHigherAQA

Practise Records for GCSE Computer Science with this free worksheet and full mark scheme — Foundation and Higher exam-style questions with worked answers for AQA GCSE Computer Science (8525). A record stores related pieces of data of different types together as a single structure.

Free downloads

These worksheets and mark schemes are original, written for Virtus Academy and checked against the current AQA specification. Every worksheet comes with a full mark scheme.

Topic overview

A record is a data structure that groups together related data items of different types under one name.

An array requires every element to be the same type, which is limiting when modelling something real. A student record can hold a name as a string, an age as an integer and an average mark as a real, all in one structure.

The individual items are called fields, and each is accessed by name rather than by index — student.name rather than student[0]. This makes the code far more readable. An array of records is the standard way to store many similar items, such as every student in a class.

Revision notes

Records versus arrays

An array holds many values of the SAME data type.

A record holds related values of DIFFERENT data types. A student record might contain a string name, an integer age and a real average mark, which no single array could hold.

Fields

The individual items in a record are called fields.

Each is accessed by name: student.name, student.age. This is more readable than an index, because the name says what the value represents.

Arrays of records

An array of records stores many similar items.

A class of 30 students becomes an array of 30 student records, accessed as students[0].name and so on. This combines the loop-friendliness of arrays with the descriptive structure of records.

Key points

  • A record groups related data of different types.
  • An array requires all elements to be the same type.
  • Items in a record are called fields.
  • Fields are accessed by name.
  • Field names make code readable.
  • An array of records stores many similar items.

Worked examples

Example 1

State one difference between a record and an array. [2 marks]

Working

An array holds values that must all be of the same data typedescribe an array
whereas a record can hold related values of different data typesdescribe a record

Example 2

A student record has fields name, age and average. State how to access the age field. [2 marks]

Working

student.ageaccess the field by name
Fields are accessed by name rather than by index, which makes the code more readableexplain the access method

Example 3

Explain why an array of records is useful for storing details of 30 students. [2 marks]

Working

Each record holds all the different data types needed for one studentstate what a record provides
and the array allows all 30 to be processed with a loopstate what the array provides

Common mistakes

  • Trying to store mixed types in an array.

    All array elements must be the same type — use a record.

  • Accessing fields by index.

    Fields are accessed by name.

  • Confusing a record with a database record only.

    It is a general data structure, though databases use the same idea.

  • Saying records cannot be stored in arrays.

    An array of records is the standard approach.

Exam tips

  • Contrast records and arrays by data type.
  • Access fields by name, using a dot.
  • Combine arrays and records for many similar items.
  • Use the term field for the items in a record.

Key terms

Record
A structure grouping related data of different types.
Field
One item within a record.
Data structure
An organised way of storing related data.
Array of records
An array whose elements are records.

Written and reviewed against the current AQA specification. Spotted an error? Let us know.