Cambridge A2 Level Computer Science 9618 · 20.1 Programming Paradigms

Q11 · 9618/31/O/N/23 Q11

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

Q119618/31/O/N/23original Q11Structured · 8 marks
Question 11 from 9618/31/O/N/23

Worked solution

(a)

Anthony must be a student, and his two choices are facts with choice1 and choice2.

22 student(anthony).
23 choice1(anthony, history).
24 choice2(anthony, geography).

Clause 22 student(anthony) correct [1]

Clause 23 choice1(anthony, history) correct [1]

Clause 24 choice2(anthony, geography) correct [1]

(b)

Look for every choice1 fact with mathematics: clauses 15, 17 and 18.

Write: X = tomaz, pietre, nico [1]

(c)

The rule needs N to be a student, S to be a subject and N not to have S as first choice.

may_choose_subject(N, S) IF student(N) AND subject(S) AND NOT choice1(N, S)

student(N) [1]

subject(S) [1]

NOT choice1(N, S) [1]

All operators (AND or commas) correct, with no extra code [1]

Commas may be used instead of AND, and the terms can be in a different order.

KEY IDEAA declarative rule joins facts with AND and uses NOT to rule out cases.
TOTAL 8 marks

Official mark scheme

Mark scheme for 9618/31/O/N/23 question 11
VIDEO
▶ Topic lesson

A lesson on this topic · by Craig'n'Dave. 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.