You are on page 1of 2

Tutorial

Question 1
If sky is blue, everyone likes it. - Write this statement as a prolog clause.
A. sky (blue) :- everyone(likes).
B. blue (sky), likes(X).
C. Likes(X, sky) :- blue(sky).
D. likes (sky, everyone) :- blue(sky).

Question 2
?- owner(jack, cat(X)) :- fur(X),spots(X). - What would be the English meaning for this prolog
clause.
A) jack is a owner of cat and fur and spots.
B) jack is the owner of X or jack is the owner of fur and spots .
C) jack is the owner of some cat if that cat has fur and spots.
D) B & C both.

Question 3
?- 11 + 4 is 15. - How will prolog respond to this query?
A) true
B) false

Question 4
?- N is -(+(5,6),4). and ?- N is (5+6)-4. - Do these different queries produce the same result
in prolog?
A) yes
B) no

Question 5

Write a simple prolog program that computes cube for the number.
Question 6
Assume given a set of facts of the form father (name1,name2) (name1 is the father of name2).
I. Define a predicate brother(X,Y) which holds iff X and Y are brothers.
II. Define a predicate cousin(X,Y) which holds iff X and Y are cousins.
III. Define a predicate grandson(X,Y) which holds iff X is a grandson of Y.
IV. Define a predicate descendent(X,Y) which holds iff X is a descendent of Y.

You might also like