LISP Questions & Answers – Printing

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

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

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

Answer: a
Explanation: Format primitive helps to create messages consisting of both uppercase and lowercase letters.
advertisement
advertisement

4. Which evaluates the expression twice during execution?
a) Read
b) Eval
c) Format
d) Print
View Answer

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

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

Answer: d
Explanation: This statement will print the print forms and Print’s action.
Output:
100
100
advertisement

7. What is the output of the given statement?

advertisement
span class="sy0"> * (read)kirsh

a) Kirsh
b) T
c) Nil
d) Error
View Answer

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

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

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

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

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.