Шукаєте відповіді та рішення тестів для Course 28502? Перегляньте нашу велику колекцію перевірених відповідей для Course 28502 в moodle.royalholloway.ac.uk.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
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?