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

100%
0%
0%
100%
View this question

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

 

100%
0%
0%
0%
View this question

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?

0%
100%
100%
0%
View this question

Which of the following is not

a

valid constant in Prolog?

0%
0%
100%
0%
View this question

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

0%
0%
0%
100%
View this question

Choose all the queries that will not

succeed.

100%
0%
0%
100%
View this question

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

0%
100%
0%
0%
View this question

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?

0%
0%
0%
100%
View this question

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.

0%
100%
100%
View this question

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

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