250+ TOP MCQs on Mapping and Answers

LISP Multiple Choice Questions on “Mapping”.

1. Which makes the data to easily transform lists?
a) Car
b) Mapcar
c) Map
d) Maplist

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

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

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

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

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

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

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

  250+ TOP MCQs on Predicates and Answers

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

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

Answer: d
Clarification: This statement will append the values from both the lists.
Output:
(A B X Y)
*
(A B X Y)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top