LISP Questions & Answers – Procedure Abstraction

This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “Procedure Abstraction”.

1. Which process helps to build large and complicated programs?
a) Macros
b) Procedure abstraction
c) Defun
d) None of the mentioned
View Answer

Answer: b
Explanation: Procedure abstraction process helps to build large and complicated programs and it is easy to understand.

2. Which abstractions have a prescribed behavior?
a) Auxiliary procedures
b) Procedure abstraction
c) Primary procedures
d) None of the mentioned
View Answer

Answer: a
Explanation: Auxiliary procedures will help to produce a proper result and it will have a prescribed behavior.

3. What is the process of arranging procedures into layers?
a) Procedure
b) Abstraction
c) Abstraction layers
d) Procedure abstraction
View Answer

Answer: c
Explanation: Abstraction layers helps to arrange procedures into layers.
advertisement
advertisement

4. Which is used to seperate the abstraction layers?
a) Abstraction boundaries
b) Data
c) Procedure
d) All of the mentioned
View Answer

Answer: a
Explanation: Abstraction boundaries help to keep abstraction layers separate from each other.

5. Which hides details behind abstraction boundaries?
a) Procedures
b) Procedure abstraction
c) Recursion
d) Both Procedures & Procedure abstraction
View Answer

Answer: b
Explanation: Procedure abstraction hides details behind abstraction boundaries and it is increase the security between layers.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. What is the output of the following statement?

*(setf thing 'sphere r 1)
* (cond ((eq thing 'circle) (* pi r r)) ((* 4 pi r r)))

a) 10.566
b) 11.5683
c) 12.56637
d) 13
View Answer

Answer: c
Explanation: This statement will help to find the area of sphere.
Output:
12.566370614359172d0
advertisement

7. What is the output of the following statement?

advertisement
span class="sy0"> * (setf p .6)
* (cond ((> p .75) 'very-likely)((> p .5) 'likely)((> p .25) 'unlikely)(t 'very-unlikely))

a) Very-likely
b) Likely
c) Unlikely
d) Very-unlikely
View Answer

Answer: b
Explanation: As the value p is .6, it is printing likely.
Output:
LIKELY

8. What is the output of the following statement?

span class="sy0"> * (setf thing 'point r 1)
* (case thing (circle (*pi r r))(sphere (* 4 pi r r)))

a) 1
b) 12.56637
c) NIL
d) T
View Answer

Answer: c
Explanation: As the value is not matched, it is printing as NIL.
Output:
NIL

9. What is the output of the following statement?

span class="sy0"> * (setf breakfast '(eggs bacon toast tea))
* (cond ((> (length breakfast) 10) 'glutton) ((not (endp breakfast)) 'normal)(t 'anorexic))

a) Anorexic
b) Breakfast
c) Eggs
d) Normal
View Answer

Answer: d
Explanation: As breakfast is not empty, It is printing normal.
Output:
NORMAL

10. What is the output of the following statement?

span class="sy0"> * (setf thing 'point r 1)
* (case thing (circle (*pi r r))(sphere (* 4 pi r r)) (otherwise 0))

a) 1
b) 0
c) 12.566
d) None of the mentioned
View Answer

Answer: b
Explanation: Otherwise is like else statement, So it is printing 0.
Output:
0

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.