Looking for Course 28502 test answers and solutions? Browse our comprehensive collection of verified answers for Course 28502 at moodle.royalholloway.ac.uk.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Consider the following knowledge base represented as a set of Prolog facts:
age(harry,13).age(draco,14).age(ron,13).age(hermione,13).age(dumbledore,60).age(hagrid,30).
Which of the following queries return in a single answer all the age numbers recorded in the knowledge base? (A solution which returns duplicates is equally acceptable with one that does not).
Consider the following program:
likes(marie, pizza).likes(marco, pizza).likes(Person, pizza) :- italian(Person).italian(marco).
What would the output of the following query be?
?- setof(Person, likes(Person, pizza), Persons).
Consider the following Prolog program:
all_0s([ ]).
all_0s([0|Tail]) :- all_0s(Tail).
We query the above program with the following goal:
?- all_0s([0, 0, 1, 0]).
Which
of the following are possible derived queries for this goal?
Which of the following is not a valid constant in Prolog?
Which of the following pairs of terms can unify?
A) cd(29, beatles, sgt_pepper).
cd(A,B, help).
B) f(foo, _).
f(A1, bar).
Choose all the queries that will not succeed.
Consider the following program:
likes(marie, pizza).likes(marco, pizza).likes(Person, pizza) :- italian(Person).italian(marco).
What would the output of the following query be?
?- findall(Person, likes(Person, pizza), Persons).If the query below is executed in Prolog:
?- [X|L] = [1,2,3,4,5].
which of the following instantiations correspond to the right answer?
Which of the following programs represent the specification:
p holds if q and r hold; otherwise, if q
does not hold p holds if s holds.
Consider the following Prolog program:
teaches(chris, history).teaches(chris, english).teaches(chris, drama).teaches(maria, physics). studies(alice, english).studies(jake, english).studies(emily, drama).studies(alex, physics).
What is an expected output of the query below, which uses a cut (!)?
?- teaches(chris, Course), !, studies(Student, Course).