LISP Questions & Answers – Mapping

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

Answer: b
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

Answer: c
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

Answer: a
Explanation: Mapcar forms offer an alternative to the recursive transformation cliche.
advertisement
advertisement

4. How many procedures are available in lists to filter them?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
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

Answer: b
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

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

Answer: d
Explanation: This statement will print odd numbers as true and all the even numbers as false.
Output:
(T NIL T)
advertisement

7. What is the output of the following statement?

advertisement
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

Answer: b
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

Answer: a
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

Answer: d
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

Answer: d
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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.