This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “LISP Primitives – 1”.
1. Which is used to represent the prompt in lisp?
a) #
b) $
c) &
d) *
View Answer
Explanation: Lisp displays a prompt to to tell that it waiting for something to enter.
2. Which notation facilitates uniformity in lisp?
a) Prefix
b) Postfix
c) Infix
d) None of the mentioned
View Answer
Explanation: Because the procedure name is always in the same place, no matter how many arguments are involved.
3. Which is a procedures supplied by user in terms of primitives?
a) Custom
b) User-defined
c) Definite
d) All of the mentioned
View Answer
Explanation: A procedures supplied by user in terms of lisp primitives is called user-defined procedure.
4. What is the process of reserving a place in computer memory to store a value for a symbol?
a) Storing
b) Ranging
c) Binding
d) None of the mentioned
View Answer
Explanation: Binding means that allotting a memory location to a variable and storing a value in it.
5. What is the general pattern that shows how the various parts of an expression fit together?
a) Template
b) Pattern
c) Match
d) Both Template & Pattern
View Answer
Explanation: Template describes what should appear in the position occupied.
6. What is the output of the following statement?
span class="sy0"> * (+ 3.14 2.71)
a) 3.14
b) 2.71
c) 5.84
d) 5.85
View Answer
Explanation: This statement is used to add the two given values.
Output:
5.85
7. What is the output of the following statement?
span class="sy0"> * (first '( p h w))
a) P
b) H
c) W
d) phw
View Answer
Explanation: This statement will print the first alphabet of the given value.
Output:
P
8. What is the output of the following statement?
span class="sy0"> * ( first (rest (first '((a b) (c d)))))
a) a
b) b
c) c
d) d
View Answer
Explanation: This statement is used to print b because of nesting.
Output:
b
9. What is the output of the following statement?
span class="sy0"> * '(first (first (rest (rest ((a b) (c d) (e f))))))
a) a
b) b
c) ab
d) (FIRST (FIRST (REST (REST ((A B) (C D) (E F))))))
View Answer
Explanation: Because ‘ character is recognized as a macro character, so it will convert ‘
Output:
(FIRST (FIRST (REST (REST ((A B) (C D) (E F))))))
10. What is the output of the following statement?
span class="sy0"> * (cdr '(a b c))
a) a
b) B
c) (B C)
d) None of the mentioned
View Answer
Explanation: cdr function is used to form composite primitives.
Output:
(B 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.
- Check Computer Science Books
- Practice Computer Science MCQs
- Apply for Computer Science Internship
- Check LISP Books