| CSC 8310 Lisp Quiz Villanova University, Spring 2001 David Matuszek |
Section 2 Name ____________________________________________ |
Evaluate each of the following-- 3 points each
Please put your answer in the blank to the left of the expression
|
_________________________ (QUOTE (X (Y)))
_________________________ (QUOTE P)
_________________________ (CAR P)
_________________________ (CAR Q)
_________________________ (CDR P)
_________________________ (CDR Q)
_________________________ (CONS Q ( ))
_________________________ (CONS ( ) Q)
_________________________ (EQ (( )) NIL)
_________________________ (EQ ( ) '( ))
_________________________ (ATOM (QUOTE (( ))))
_________________________ (LIST P)
_________________________ (LIST P Q)
_________________________ (LIST '((A B)))
_________________________ (LIST (QUOTE A) (QUOTE (A)))
_________________________ (EQUAL P (QUOTE (X)))
_________________________ (APPEND P Q)
_________________________ (APPEND P NIL)
_________________________ (NULL '(( )))
_________________________ (COND ((CDR Q) P) ((CAR Q) Q) (T NIL) )
21. (10 points) Given the following function definition:
(defun befog (A L)
(cond
((null L) ( ))
((null (car L)) (befog A (cdr L)))
(t (cons A (befog A (cdr L)))) ) )
what is the result of the following function calls?
___________________________________ (befog 'a '(a s i a) )
___________________________________ (befog 'b '(a nil b) )
Short answer questions
Fill in the blanks.
Person p binds
____________________ to ____________________,
while the statement p = new Person() binds
____________________ to ____________________.QUOTE, COND, and DEFUN
are not functions, because their formal parameters are not bound to values
at the time of call. The Lisp name for these things that look like functions,
but are not actually functions, is ______________________________
.
Survey -- just for my own information
This does not count toward your grade.
Did you attempt the online Lisp quiz?
Did you successfully complete the online Lisp quiz?
If not, did you have problems with the program?
Do you think that the online quiz is, in general, a good idea?