A declarative programming language is used to represent some facts about people and their hobbies. 01 hobby(music). 02 hobby(caving). 03 hobby(climbing). 04 hobby(camping). 05 hobby(baking). 06 hobby(travelling). 07 person(toby). 08 person(natasha). 09 person(fatima). 10 person(joseph). 11 person(elijah). 12 person(nina). 13 enjoys(natasha, travelling). 14 enjoys(toby, climbing). 15 enjoys(nina, climbing). 16 enjoys(elijah, camping). 17 enjoys(fatima, baking). 18 enjoys(joseph, camping). 19 dislikes(toby, caving). These clauses have the meanings: Clause Meaning 01 Music is a hobby 07 Toby is a person 13 Natasha enjoys travelling 19 Toby dislikes caving
- (a)Carlos is a person who enjoys the hobby of cycling but does not like music. Write additional clauses to represent this information. 20 21 22 23[4]
- (b)Using the variable P, the goal: enjoys(P, camping) returns P = elijah, joseph Write the result returned by the goal: enjoys(P, climbing) P =[1]
- (c)N is a person who might enjoy H if H is a hobby and N does not dislike H. Write this as a rule. might_enjoy(N, H) IF[4]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- [1] 20 person(carlos).
- [1] 21 hobby(cycling).
- [1] 22 enjoys(carlos, cycling).
- [1] 23 dislikes(carlos, music).
- [1] P = toby, nina
- [1] person (N)
- [1] hobby (H)
- [1] dislikes (N, H)
- [1] all logical operators correct with no additional code (see example answers)
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →