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 Prolog knowledge base:
bird(tweety).bird(polly).penguin(pingu).can_fly(X) :- bird(X), \+ penguin(X). For each of the following queries, select all queries that fail (i.e., Prolog answers false.).Consider the following Prolog program:
p(a).p(b).q(a).q(b).r(X,Y) :- p(X), !, q(Y).What answers are produced by the following query?
?- r(X,Y).Consider the following Prolog program:
test(X,Y) :- ( X > 0 -> Y = positive ; Y = nonpositive ).
What value(s), if any, will be returned for Y by the following query?
?- test(3,Y).
The Prolog goal \+ Goal succeeds when Prolog cannot prove Goal.
Consider the following query:
?- setof(X, member(X,[b,a,c,a]), L).What is the value of ?L
Prolog is a typed language because it supports argument mode annotations. For example, in a predicate specification such as ancestor(+Person, ?Ancestor), +Person means that Person must be instantiated at the time of the call, and +Ancestor means that Ancestor may be either input or output.
Prolog is a functional programming language because programs consist of rules that define how outputs are computed from inputs.