Cambridge A2 Level Computer Science 9618 · 20.1 Programming Paradigms

Q3 · 9618/31/M/J/22 Q2

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

Q39618/31/M/J/22original Q2Structured · 6 marks
Question 2 from 9618/31/M/J/22

Worked solution

(a)

A caracal is a wild cat, so write a type fact. It has short hair, so write a hair fact. Each ends with a full stop.

type(caracal, wild).
hair(caracal, short).

Clause 18 is type(caracal, wild). [1]

Clause 19 is hair(caracal, short). [1]

(b)

Only clause 11 has long hair (persian).

Write: Cat = persian [1]

(c)(i)

Use the variable in the first place of the type clause.

type(Pet, domestic).

Write: type(Pet, domestic). [1]

(c)(ii)

Both conditions must be true for the same cat, so join two clauses with a comma (AND).

spots(WildSpotty, yes), type(WildSpotty, wild).

Both clauses use WildSpotty in the correct place [1]

The two clauses are joined with a comma and the goal ends with a full stop [1]

The two clauses may be written in either order.

KEY IDEAFacts have the form predicate(item, value). A goal with a variable finds matches, and a comma joins goals that must all be true.
TOTAL 6 marks

Official mark scheme

Mark scheme for 9618/31/M/J/22 question 2
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.