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 program which finds the larger of two numbers:
larger(X,Y,Z):- X>Y, !, Z=X.larger(X,Y,Y):- X \= Y.
Which of the following queries return true?
Attempting to unify in Prolog an expression of the form
X = f(X)
results in the “occurs check”.
Consider the following Prolog program:
parent_of(john,mary).parent_of(john,peter).parent_of(susan,mary).What is the result of the following query?
?- findall(X, parent_of(john,X), L).Consider the following Prolog program:
choose(a) :- !.choose(b). What answers does Prolog produce for the query?
?- choose(X). Consider the following Prolog program:
parent_of(john,mary).parent_of(john,peter).parent_of(susan,mary).ancestor_of(X,Y) :- parent_of(X,Y).ancestor_of(X,Y) :- parent_of(X,Z), ancestor_of(Z,Y). The query below produces exactly two answers.
?- ancestor_of(john,Y).Which of the following Prolog goals succeed (i.e., unify successfully)?
Select all that apply.
What is the result of the following query?
?- f(Y,Y,Y) = f(a,b,c).Select the valid Prolog rules from the list below:
Please select which facts below will not cause a Prolog syntax error:
Consider the following Prolog rule:
ancestor_of(X,Y) :- parent_of(X,Y). and the query:
?- ancestor_of(john,Z). Which query is derived after unification of the above query with the rule head?