This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “Printing”.
1. Which can read expressions from data-files one at a time?
a) Print
b) With-open-file
c) Directive
d) None of the mentioned
View Answer
Explanation: With-open-file can read expressions from data files one at a time, as they are needed for processing.
2. Which evaluates the single argument and prints it on a new line?
a) Format
b) With-open-file
c) Print
d) All of the mentioned
View Answer
Explanation: The print primitive evaluates its single argument and prints it on a new line and prints a trailing space character.
3. Which primitive makes the messages consists of uppercase and lowercase letters?
a) Format
b) Directive
c) Print
d) Read
View Answer
Explanation: Format primitive helps to create messages consisting of both uppercase and lowercase letters.
4. Which evaluates the expression twice during execution?
a) Read
b) Eval
c) Format
d) Print
View Answer
Explanation: Eval evaluates the expression twice during execution.
5. Which makes it possible to print in tabulated columns?
a) Print
b) Read
c) Directive
d) Format
View Answer
Explanation: Format also has the option to print the values in tabulated columns.
6. What is the output of the given statement?
span class="sy0"> * (setf temperature 100) * (print temperature)
a) 100
b) 200
c) 0
d) 100
100
View Answer
Explanation: This statement will print the print forms and Print’s action.
Output:
100
100
7. What is the output of the given statement?
span class="sy0"> * (read)kirsh
a) Kirsh
b) T
c) Nil
d) Error
View Answer
Explanation: This statement will print the given value.
Output:
KIRSH
8. What is the output of the given statement?
span class="sy0"> * (let ((p nil)); (print '(please type a patient name)) (setf p (read)); (print (append '(ok the name is) (list p)))p);
a) Nil
b) T
c) Error
d) The value you entered
View Answer
Explanation: Thish statement will get the value from the terminal and print it.
Output:
dfa
(PLEASE TYPE A PATIENT NAME)
(OK THE NAME IS DFA)
DFA
9. What is the output of the given statement?
span class="sy0"> * (format t "Hello!")
a) Hello
b) T
c) Hello! NIL
d) None of the mentioned
View Answer
Explanation: This statement will compare the value and print the result.
Output:
Hello! NIL
10. What is the output of the given statement?
span class="sy0"> * (setf name 'kirsh symptoms '(fever rash)) * (print (list 'patient name 'presented (length symptoms) 'symptoms symptoms))
a) Patient
b) Krish
c) 2
d) (PATIENT KIRSH PRESENTED 2 SYMPTOMS (FEVER RASH))
View Answer
Explanation: This statement will count the number of symptoms in the given name and print the result.
Output:
(PATIENT KIRSH PRESENTED 2 SYMPTOMS (FEVER RASH))
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.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Practice Computer Science MCQs
- Check Computer Science Books
- Apply for Computer Science Internship
- Check LISP Books