Question 4(c)(ii) 2016 · May-June · Paper 43 · 1 mark
Reveal official mark-scheme answer
Official answer for Question 4
Part (c)
(ii)
(ii)
Question 1
Show text version of question
Question 4
Part (c)
(ii)
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.
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
(ii)
The lists [c03,d02,n05|C] and [c03,d02,n05,p05,m04] are identical.
State the value of C.
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_43.pdf
