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

Q14 · 9618/31/O/N/24 Q6

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

Q149618/31/O/N/24original Q6Structured · 7 marks
Question 6 from 9618/31/O/N/24

Worked solution

(a)

Any three of these:

A set is a composite user-defined data type. [1]

It holds a list of unordered elements. [1]

Set operations such as union and intersection can be applied to its elements. [1]

Its definition includes the data type it uses. (also credited, but no extra mark: any n only)

All the elements are of the same data type. (also credited, but no extra mark: any n only)

(b)

TYPE SymbolSet = SET OF CHAR
DEFINE Operators ('+', '-', '*', '/', '^') : SymbolSet

Any four of these:

TYPE SymbolSet = [1]

SET OF CHAR [1]

DEFINE Operators [1]

The five operators in brackets [1]

: SymbolSet after the list (also credited, but no extra mark: any n only)

The type and the variable may swap names (TYPE Operators = SET OF CHAR, then DEFINE SymbolSet) and still score.

KEY IDEADeclare a set type with TYPE ... = SET OF, then DEFINE the variable with its values and type.
TOTAL 7 marks

Official mark scheme

Mark scheme for 9618/31/O/N/24 question 6
VIDEO
▶ Topic lesson

A lesson on this topic · by ZAINEMATICS. 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.