LISP Multiple Choice Questions 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
Answer: b
Clarification: 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
Answer: a
Clarification: 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
Answer: c
Clarification: 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
Answer: a
Clarification: Abstraction boundaries help to keep abstraction layers separate from each other.
5. Which hes details behind abstraction boundaries?
a) Procedures
b) Procedure abstraction
c) Recursion
d) Both Procedures & Procedure abstraction
Answer: b
Clarification: Procedure abstraction hes details behind abstraction boundaries and it is increase the security between layers.
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
Answer: c
Clarification: 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
Answer: b
Clarification: 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
Answer: c
Clarification: 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
Answer: d
Clarification: 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
Answer: b
Clarification: Otherwise is like else statement, So it is printing 0.
Output:
0
