Past-paper question · 2016 May-June · Paper 42 · Q4(c)(i)

Question 4(c)(i) 2016 · May-June · Paper 42 · 2 marks

Original past-paper question for 4(C)(I)
Original past-paper question for 4(C)(I)
Original past-paper question for 4(C)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 4(C)(I)

Official answer for Question 4

Part (c)

(i)

Part (c)

(i)

✓
a07

Question 2

✓
[p03]
✓
must be []
✓
must be lower case, but don’t penalise twice, so follow through from part(b)

Mark scheme 9608_s16_ms_42.pdf →

Show text version of question

Question 4

Part (c)

(i)

Question 4

When a car reaches a certain age, a safety assessment has to be carried out. A car’s brakes and

tyres must be tested. The tyre test result and the brakes test result for each car are recorded. If the car passes the assessment, a safety certificate is issued.

Cars have a unique three-character registration.

The following knowledge base is used:

01 car(a05). 02 car(h04). 03 car(a03). 04 car(h07). 05 car(a23). 06 car(p05). 07 car(b04). 08 carRegYear(a05, 2015). 09 carRegYear(h04, 2013). 10 carRegYear(a03, 2008). 11 carRegYear(h07, 2011). 12 carRegYear(a23, 2008). 13 carRegYear(p05, 2014). 14 carRegYear(b04, 2014). 15 testBrakes(h07, pass). 16 testTyres(h07, fail). 17 testBrakes(a03, fail). 18 testTyres(a03, fail). 19 testBrakes(a23, pass). 20 testTyres(a23, pass). 21 carAssessmentDue if carRegYear(Car, RegYear) and RegYear <= DeadlineYear. 22 issueCertificate(Car) if testTyres(Car, Result) and testBrakes(Car, Result) and Result = pass. Logic programming uses a data structure called a list.

A
new fact is added to the knowledge base.

23 carList = [a03,p05,b04,h04,h07,a23].

The following notation and operators are to be used with a list:

[X|Y] denotes a list with:

  • X the first list element
  • Y the list consisting of the remaining list elements

[] denotes an empty list

(i)

The list [a07,p03] is denoted by [A|B]

State the value of A and B.

A
= ......................................................................................
B
= ......................................................................................
[2]
Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Constructs

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_s16_qp_42.pdf

Keep practising this topic