logo

Crowdly

Browser

Add to Chrome

Course 28502

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?

100%
100%
0%
0%
View this question

Attempting to unify in Prolog an expression

of the form 

X = f(X)

results in the “occurs check”.

0%
100%
View this question

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).

0%
0%
100%
0%
View this question

Consider the following Prolog program:

 

 

choose(a) :- !.

choose(b).

 

What answers does Prolog produce for the query?

 

 

?- choose(X).

 

0%
100%
0%
0%
View this question

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).

100%
0%
View this question

Which of the following Prolog goals succeed (i.e., unify successfully)?

Select all that apply.

100%
100%
0%
0%
100%
View this question

What is the result of the following query?

 

?- f(Y,Y,Y) = f(a,b,c).

100%
0%
0%
0%
0%
View this question

Select the valid Prolog rules from the list below:

0%
0%
100%
0%
100%
View this question

Please select which facts below will not cause a Prolog syntax error:

100%
0%
0%
100%
0%
View this question

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?

0%
100%
0%
0%
View this question

Want instant access to all verified answers on moodle.royalholloway.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome