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

Q12 · 9618/32/M/J/24 Q3

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

Q129618/32/M/J/24original Q3Structured · 7 marks
Question 3 from 9618/32/M/J/24

Worked solution

(a)

A non-composite data type is defined without referring to another data type. [1]

It can be a primitive data type or a user-defined data type. [1]

Example: an enumerated type, for example TYPE Season = (Spring, Summer, Autumn, Winter), or a pointer type. [1]

(b)

A set type is declared with TYPE, then a variable of that type is given its values with DEFINE.

TYPE Numbers = SET OF INTEGER
DEFINE EvenNumbers (2, 4, 6, 8, 10, 12) : Numbers

TYPE statement fully correct (TYPE Numbers = SET OF INTEGER) [1]

DEFINE EvenNumbers [1]

Correct list of values in brackets [1]

Type name written after the colon [1]

Any sensible name for the type is accepted, as long as it is used after the colon.

KEY IDEAA set type uses TYPE ... = SET OF, then DEFINE gives the variable its values and its type.
TOTAL 7 marks

Official mark scheme

Mark scheme for 9618/32/M/J/24 question 3
VIDEO
▶ Starts at Q3 (18:09)

Starts at Q3 (18:09) · by Pseudocode Pro. 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.