9618/31/O/N/23 question 11: worked solution (October/November 2023, paper 31)
Show as plain textHide plain text
Cambridge A2 Level Computer Science 9618 · 20.1 Programming Paradigms Worked solution from the Further Programming Paper 3 Advanced Theory booklet, Part 1 of 2. Q11 9618/31/O/N/23 original Q11 Structured · 8 marks 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 IDEA A declarative rule joins facts with AND and uses NOT to rule out cases. TOTAL 8 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.