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.
advertisement

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.

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.
advertisement

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

7. What is the output of the following statement?

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
advertisement

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?

advertisement
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.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn