CIT 594 First Quiz
Spring 2002, Dave Matuszek
Name __________________________________________
  1. (5 points each) Tell what Lisp returns for each of the following (don't quote your answers.)
    (CAR '(NIL))  
    (CAR '((X) Y Z))  
    (CDR '(()()))  
    (CDR (QUOTE ((NIL))))  
    (CONS '(P) 'Q)  
    (CONS 'A '((NIL)))  
    (CONS (QUOTE ((X))) (QUOTE Y))  
    (EQ NIL ())  
    (ATOM NIL)  
    (NULL (QUOTE A))  
    (EQUAL '(()) '(NIL))  
    (LIST '(P) '((X Y)) 'A)  
    (APPEND '((X Y)) '((X) Y))  
    (APPEND '(P Q R) '(()))  
    (COND ((NULL 'A) 'A) (T 'B) )  
    (DEFUN DOUBLE (N) (+ N N) )  

  2. (8 points) State, briefly, the four rules for doing recursion.

  3. (5 points) Briefly, define the term refactoring.

    Rewriting and redesigning your program

  4. (2 points) One of these was mentioned in The Pragmatic Programmer--circle it.

               Making stone soup          Making an omlet          Raising the flag          Eating crow

  5. ( 5 points) Draw the structure, using cons cells, for the list ((A B) C).