Spring 2001, CSE 428: Quiz 11.1 - 19 April 2001


Please write your Name and Student ID at the top of the page. By default, this quiz will be returned in Section 2 (morning section).
  1. [Pts 2]   Difference lists in logic programming are (only one answer, please)

  2. [Pts 2]   Consider the standard way of representing trees in logic programming, and the following definition of a predicate p:
       p(empty,[]).
       p(node(T1,X,T2),[X|L]) :-
           p(T1,L1), p(T2,L2), append(L1,L2,L).
             /* append is the predefined list concatenation */
    
    Consider now the query ?- p(t,L). where t is a term representing a certain tree. What is the result returned by it? (only one answer, please)

  3. [Pts 2]   Consider the Prolog query ?- X = 1+2, Y is X+3. What is the result returned by it? (only one answer, please)

  4. [Pts 2]   Consider the Prolog query ?- not(X=2). What is the result returned by it? (only one answer, please)

  5. [Pts 2]   Assume given a Prolog program consisting only of the clause p :- p. and consider the query ?- p, r. What is the result returned by this query? (only one answer, please)