This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “Mapping”.
1. Which makes the data to easily transform lists?
a) Car
b) Mapcar
c) Map
d) Maplist
View Answer
Explanation: Mapcar primitive makes the data to transform lists.
2. To which procedure does mapcar is not restricted?
a) List
b) Datachar
c) Procedure of one parameter
d) None of the mentioned
View Answer
Explanation: The procedure mapcar uses is not restricted to be procedure of one parameter.
3. Which forms offer an alternative to the recursive transformation cliche?
a) Mapcar
b) Maplist
c) Mapdata
d) All of the mentioned
View Answer
Explanation: Mapcar forms offer an alternative to the recursive transformation cliche.
4. How many procedures are available in lists to filter them?
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: The two procedures available to filter lists are remove-if and remove-if-not.
5. Which enables to define procedures that have procedure arguments?
a) Funargs
b) Mapcar
c) Fun
d) Funcall
View Answer
Explanation: None.
6. What is the output of the following statement?
span class="sy0"> * (mapcar #'oddp '(1 2 3))
a) T NIL
b) NIL
c) T
d) T NIL T
View Answer
Explanation: This statement will print odd numbers as true and all the even numbers as false.
Output:
(T NIL T)
7. What is the output of the following statement?
span class="sy0"> * (funcall #'first '(e1 e2 e3)) (first '(e1 e2 e3))
a) E1
b) E1 * E1
c) *
d) None of the mentioned
View Answer
Explanation: This statement will print first procedure argument from both the lists.
Output:
E1
*
E1
8. What is the output of the following statement?
span class="sy0"> * (mapcar #'= '(1 2 3) '(3 2 1))
a) NIL T NIL
b) T NIL
c) T NIL T
d) None of the mentioned
View Answer
Explanation: This statement will compare the values from both the lists and print the result.
Output:
(NIL T NIL)
9. What is the output of the following statement?
span class="sy0"> * (apply #'+ 1 2 3 '(4 5 6))
a) 43
b) 444
c) 32
d) 21
View Answer
Explanation: This statement will add all the values given in the list.
Output:
21
10. What is the output of the following statement?
span class="sy0"> * (funcall #'append '(a b) '(x y)) (append '(a b) '(x y))
a) (A B X Y) * (A)
b) (A B X Y) * (A B)
c) (A B X Y) * (A B C Y)
d) (A B X Y) * (A B X Y)
View Answer
Explanation: This statement will append the values from both the lists.
Output:
(A B X Y)
*
(A B X Y)
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.
- Buy Computer Science Books
- Apply for Computer Science Internship
- Apply for LISP Internship
- Buy LISP Books
- Practice Computer Science MCQs