This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “Binding”.
1. Which arranges for parameters to be bound on entering a procedure?
a) Form
b) Let
c) Initial
d) Parameter
View Answer
Explanation: LET arranges for parameters to be bound, just as parameter are bound on entering a procedure.
2. How does LET generally begins with?
a) Parameter list
b) Data
c) Fence
d) None of the mentioned
View Answer
Explanation: Parameter list consists of two-elements lists, each of which has a parameter variable and an intial value form.
3. What will happen if a variable had not assigned a value by SETF form?
a) Warning
b) Nothing will happen
c) Error message
d) Crash
View Answer
Explanation: Because of this condition, it will report an unbound variable error.
4. What is the alternative of LET for parameter binding?
a) Let
b) Let*
c) Let^
d) Let%
View Answer
Explanation: Let* is like shorthand notation for nested LETs.
5. Which helps you to write procedures on complicated things?
a) Development
b) Revoke
c) Progressive envelopment
d) All of the mentioned
View Answer
Explanation: Progressive envelopment helps you to write procedures on building complicated things incrementally.
6. What is the output of the given statement?
span class="sy0"> * (setf x 'outside) * (let* ((x 'inside) (y x))(list x y))
a) Inside Outside
b) Outside Inside
c) Outside Outside
d) Inside Inside
View Answer
Explanation: X’s and Y’s parameter are on inside only, So it is printing as Inside Inside.
Output:
(INSIDE INSIDE)
7. What is the output of the given statement?
span class="sy0"> * (defun both_ends (whole-list) (let ((element (first whole-list)) (trailer (last whole-list))) (cons element trailer)))
a) Both
b) Both_ends
c) Error
d) None of the mentioned
View Answer
Explanation: Atfirst element and trailer are assigned to initial value and then element and trailer are combined.
Output:
BOTH_ENDS
8. What is the output of the given statement?
span class="sy0"> * (defun both (l m) (cons (first l) (last m))) * (both '(breakfast lunch) '(tea dinner))
a) Breakfast Lunch
b) Tea Dinner
c) Breakfast
d) Breakfast Dinner
View Answer
Explanation: The purpose of both is to combine the first element of one list with the last element of another.
Output:
(BREAKFAST DINNER)
9. What is the output of the given statement?
span class="sy0"> * (setf route '(boston cambridge lincoln concord)) * (cons (last route))
a) Boston
b) Cambridge
c) Lincoln
d) Concord
View Answer
Explanation: This statement will print last element of the list.
Output:
(CONCORD)
10. What is the output of the given statement?
span class="sy0"> * (setf abc-list '(a b c)) * (last abc-list) * (first (last abc-list))
a) A
b) B
c) C
d) None of the mentioned
View Answer
Explanation: This statement will nest function of last with the first.
Output:
C
Sanfoundry Global Education & Learning Series – LISP Programming Language.
To practice all areas of LISP, here is complete set of 250+ Multiple Choice Questions and Answers on LISP Programming Language.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Check LISP Books
- Apply for Computer Science Internship
- Check Computer Science Books
- Practice Computer Science MCQs