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

Q18 · 9618/33/M/J/25 Q1

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

Q189618/33/M/J/25original Q1Structured · 6 marks
Question 1 from 9618/33/M/J/25

Worked solution

(a)

Use STRING for the code and format, INTEGER for the year and running time, and DATE for the date.

TYPE VideoLibrary
    DECLARE VideoID : STRING
    DECLARE Title : STRING
    DECLARE ReleaseYear : INTEGER
    DECLARE PurchaseDate : DATE
    DECLARE VideoFormat : STRING
    DECLARE RunningTime : INTEGER
ENDTYPE

TYPE VideoLibrary and ENDTYPE correct [1]

DECLARE used correctly for every field [1]

The three STRING fields correct [1]

The remaining three fields correct [1]

(b)

Field: VideoFormat [1]

Reason: it can only have a fixed set of possible values (such as DVD, Blu-ray, 4K, MP4) [1]

KEY IDEAA field with a small fixed list of allowed values is a good choice for an enumerated type.
TOTAL 6 marks

Official mark scheme

Mark scheme for 9618/33/M/J/25 question 1
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.