This set of LISP Interview Questions and Answers for Experienced people focuses on “String Manipulation – 2”.
1. Symbol manipulation in LISP is called as _____
a) atoms
b) lists
c) list processing
d) none of the mentioned
View Answer
Explanation: Symbol manipulation in LISP is called as list processing. The full form of LISP is also List Processing.
2. Lists can be formed from ____
a) atoms
b) atoms and lists
c) lists
d) none of the mentioned
View Answer
Explanation: Both atoms and lists can be used to form lists. Lists can be made from atoms. But atoms cannot be made from lists because atoms are the fundamental unit of LISP.
3. Which of the following are general-purpose dialects of LISP?
a) Clojure
b) Common LISP
c) Common LISP and Scheme
d) Clojure, Command LISP and Scheme
View Answer
Explanation: The best-known general-purpose Lisp dialects are Clojure, Common Lisp, and Scheme.
4. What can be used to print “yes, no”?
a) (print “yes,no”)
b) (write “yes , no!”)
c) (print “yes,”)(print “,no”)
d) (print “yes”)(print “,”)(print “no”)
View Answer
Explanation: (print “yes,no”) will print yes,no. Write has exclamation mark (!) in its argument so not correct. Multiple prints used will print their arguments in new line. So, the two times and three times used print will not print “yes,no” continuously, hence these options are wrong.
5. Can write-line keyword be used for printing strings?
a) True
b) False
View Answer
Explanation: Write-line is also used to print the arguments. Other primitives used to print are print and write.
6. What will be the output of the following LISP statement?
(symbol-name 'ABC)
a) “ABC”
b) ABC
c) ‘ABC
d) None of the mentioned
View Answer
Explanation: “symbol-name” is used in symbol-manipulation. This primitive returns the argument provided to it in double quotes. So, here ABC was provided as argument and symbol-name return it as “ABC”.
Output: “ABC”
7. What will be the output of the following LISP statement?
(print '|ABC|)
a) |ABC|
b) ABC
c) “ABC”
d) None of the mentioned
View Answer
Explanation: In LISP programming the || are considered as escape characters. The use of these escape characters will print ABC on the output terminal. But these escape characters return string without showing || in output only when all the characters are capital letters.
Output: ABC
8. What will be the output of the following LISP statement?
(write (write "better"))
a) “better””better”
b) “better”
c) “better “better””
d) error will occur
View Answer
Explanation: In this statement the two write primitive are nested. The inner write will provide “better” as argument to outer write. Hence, both writes will print their arguments in output.
Output: “better””better”
9. What will be the output of the following LISP statement?
(write (print "better"))
a) “better””better”
b) “better”
c) error will occur
d) none of the mentioned
View Answer
Explanation: In this statement the print primitive is nested in write. The print primitive will provide “better” as argument to write and give output “better””better”.
Output: “better””better”
10. What will be the output of the following LISP statement?
(write ("welcome"))
a) welcome
b) “welcome”
c) no output due to error
d) both welcome and “welcome” are possible
View Answer
Explanation: The statement will show an error because “welcome” is kept in braces (). The use of braces will make the compiler to check if “welcome” is a symbol. But it is not a symbol so error will occur.
Sanfoundry Global Education & Learning Series – LISP Programming Language.
To practice all areas of LISP for Interviews, here is complete set of 250+ Multiple Choice Questions and Answers on LISP Programming Language.
- Practice Computer Science MCQs
- Check Computer Science Books
- Apply for LISP Internship
- Check LISP Books
- Apply for Computer Science Internship