Test CH 06
Test CH 06
21. Which of the following can Prolog conclude from the following program?
parent(jill, sue).
parent(jill, sally).
parent(john, sue).
parent(john, sally).
sibling(X, Y) :- parent(Z, X), parent(Z, Y).
5. Why is the straightforward “goto” statement no longer popular in high-level programming languages?
ANSWER: Its use led to poorly structured programs that were hard to understand.
9. Based on the grammar below, draw a parse tree showing that the string “drip drip drip” is a Leak.
ANSWER:
13. In the object-oriented paradigm, what are methods and instance variables.
ANSWER: A variable that resides within an object is called an instance variable. A function that resides within
an object is called a method.