Question: Question 6 Consider the following relation: loves(john, mary). loves(ted, mary). loves(marc, mary). What is the answer to the following question: ?-loves(X, liza). X = john
Question 6
Consider the following relation:
loves(john, mary).
loves(ted, mary).
loves(marc, mary).
What is the answer to the following question:
?-loves(X, liza).
X = john
X = ted
X = marc
false
Question 7
Which of the following are valid meanings of Prolog programs?
Syntactical
Procedural
Imperative
Declarative
Question 8
Rules are clauses with a body but without a head.
True
False
Question 9
In rules, goals could be separated by commas.
True
False
Question 10
Consider the following relation:
loves(john, ann).
loves(ted, mary).
loves(marc, liza).
loves(ann, ted).
loves(liza, marc).
Select all possible answers to the following question (finding some of them might require typing a semicolon and backtracking):
?-loves(X, Y), loves (Y,X).
X = ted
Y = mary
X = marc
Y = liza
X = liza
Y = marc
X = ann
Y = ted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
