Cambridge A2 Level Computer Science 9618 · 13.1 User-defined data types

Q15 · 9618/32/O/N/24 Q3

Worked solution from the Data Representation Paper 3 Advanced Theory booklet, Part 1 of 3.

Q159618/32/O/N/24original Q3Structured · 7 marks
Question 3 from 9618/32/O/N/24

Worked solution

(a)

A record lets you group several related items under one name. Write any three of these:

A record is a composite data type [1]

It is made up of other data types, which form one new data type [1]

The items can be primitive types (such as INTEGER or STRING) or other user-defined types [1]

Other points that score: it holds related items, and it has a fixed number of items (fields).

(b)

Start with TYPE and the name, DECLARE each field with its data type, and finish with ENDTYPE.

TYPE Order
    DECLARE AccountNumber : INTEGER
    DECLARE OrderNumber : INTEGER
    DECLARE OrderPrice : REAL
    DECLARE OrderDate : DATE
ENDTYPE

TYPE Order and ENDTYPE correct [1]

DECLARE used correctly for every field [1]

Account number and order number given an integer type [1]

Order price as REAL and order date as DATE [1]

KEY IDEAA record groups related fields of different types in a TYPE ... ENDTYPE block, with DECLARE for each field.
TOTAL 7 marks

Official mark scheme

Mark scheme for 9618/32/O/N/24 question 3
VIDEO
▶ Whole paper

Video solution of the whole paper · by Zafar Ali Khan (ZAK). Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.