Search Header Logo

Understanding Prolog: Facts, Rules, Queries

Authored by Matthew Wemyss

Computers

12th Grade

Understanding Prolog: Facts, Rules, Queries
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a fact in Prolog?

A statement that defines a condition that must be true.

A statement that is always true and represents basic assertions about the world.

A statement that defines a relationship between two or more facts.

A statement that asks a question about the facts and rules.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of a Prolog fact?

`likes(john, pizza).`

`likes(X, Y) :- loves(X, Y).`

`?- likes(john, pizza).`

`if likes(john, pizza) then true.`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a rule in Prolog?

A statement that is always true and represents basic assertions about the world.

A statement that defines a relationship between facts and can be used to infer new information.

A statement that asks a question about the facts and rules.

A statement that defines a condition that must be true.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of a Prolog rule?

`likes(john, pizza).`

`likes(X, Y) :- loves(X, Y).`

`?- likes(john, pizza).`

`if likes(john, pizza) then true.`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a query in Prolog?

A statement that is always true and represents basic assertions about the world.

A statement that defines a relationship between facts and can be used to infer new information.

A statement that asks a question about the facts and rules.

A statement that defines a condition that must be true.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of a Prolog query?

`likes(john, pizza).`

`likes(X, Y) :- loves(X, Y).`

`?- likes(john, pizza).`

`if likes(john, pizza) then true.`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Prolog, how would you express that "John likes anyone who loves pizza"?

`likes(john, X) :- loves(X, pizza).`

`loves(john, X) :- likes(X, pizza).`

`likes(X, john) :- loves(pizza, X).`

`loves(X, pizza) :- likes(john, X).`

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?