Cambridge A2 Level Computer Science 9618 · 20.1 Programming Paradigms

Q4 · 9618/31/M/J/22 Q7

Worked solution from the Further Programming Paper 3 Advanced Theory booklet, Part 1 of 2.

Q49618/31/M/J/22original Q7Structured · 11 marks
Question 7 from 9618/31/M/J/22

Worked solution

(a)

Acrylic and Wool each need one extra property and a YarnInfo() method. All three classes inherit from Yarn.

ClassPropertiesMethods
AcrylicSoft: BOOLEANConstructor(), YarnInfo()
WoolWoolType: STRINGConstructor(), YarnInfo()
MixPercentage: INTEGERConstructor(), YarnInfo()

Acrylic has the property Soft : BOOLEAN [1]

Wool has the property WoolType with a suitable data type, for example STRING [1]

Acrylic and Wool both have the method YarnInfo() [1]

At least one inheritance arrow from Acrylic, Wool or Mix up to Yarn [1]

All three arrows (Acrylic, Wool and Mix to Yarn) drawn [1]

(b)

Write one short description for each term:

Properties: the data items (attributes) of an object, defined in a class [1]

Properties also have data types (characteristics) [1]

Methods: the procedures or functions (programmed instructions) in a class [1]

Methods implement the behaviour and act on the properties [1]

Inheritance: the methods and properties of one class (the super / base class) are contained in that class [1]

They are made available to, and reused by, another class (the derived class) [1]

KEY IDEAA class holds properties and methods, and derived classes inherit them from a base class while adding their own.
TOTAL 11 marks

Official mark scheme

Mark scheme for 9618/31/M/J/22 question 7
VIDEO
▶ Whole paper

Video solution of the whole paper · by qiphyedu. 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.