Spring 2001, CSE 428: Quiz 11.3 - 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 1 (afternoon section).
  1. [Pts 2]   Consider the following definition of concatenation using difference lists:
       conc(X-Y,Y-Z,X-Z).
    
    Consider now the query ?- conc([1,2,3|L]-L,[4,5|K]-K,M). What is the result returned in M by this query? (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),L) :- 
         p(T1,L1), p(T2,L2), append(L1,L2,K), append(K,[X],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+Y, Y is 2+3. What is the result returned by it? (only one answer, please)

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

  5. [Pts 2]   To unify two terms t and u means (only one answer, please)