250+ TOP MCQs on Macro and Answers

LISP Multiple Choice Questions on “Macro”.

1. Which uses their arguments to build intermediate forms and evaluating them to produce a value?
a) Backquote
b) Macros
c) List
d) Procedures

Answer: b
Clarification: Macro use their arguments to build intermediate forms and it evaluate the intermediate form to produce a value.

2. Which keyword is used to define macro procedures?
a) Defun
b) Demacro
c) Defmacro
d) None of the mentioned

Answer: c
Clarification: Defmacro can be used to define procedure called macro procedure.

3. Which do not evaluate their arguments?
a) List
b) Procedure
c) Setf
d) Macros

Answer: d
Clarification: Macros do not evaluate their arguments.

4. What is the difference between the appearance of macro and ordinary definition?
a) Argument list
b) Reture value
c) Just the defining keyword
d) None of the mentioned

Answer: c
Clarification: The only difference between the appearance of macro and ordinary definition is that one uses defmacro and other uses defun.

5. Which forms can be constructed with the same primitives that manipulate lisp expressions?
a) Lisp
b) Macro
c) Procedure
d) Defun

Answer: a
Clarification: Lisp forms can be constructed with the same primitives that generally manipulate lisp expressions.

6. Which exploit the fact that lisp forms are just expressions meant to be evaluated?
a) List
b) Procedure
c) Macro
d) None of the mentioned

Answer: c
Clarification: Macros exploit the fact that lisp forms are just expressions meant to be evaluated.

7. Pick out the correct statement about macro.
a) Macro is dependant
b) Macro is interoperable
c) Macro is complex
d) Macro deserve their own file

  250+ TOP MCQs on Syntax and Answers

Answer: d
Clarification: Macro deserve their own file for compiling them.

8. What is the output of the given statement?

span class="sy0"> * (setf pressure -3)
* (when-plusp pressure (print 'alarm));

a) T
b) Nil
c) Alarm
d) None of the mentioned

Answer: b
Clarification: This statement will print nil because of the negative number.
Output:
NIL

9. What is the output of the given statement?

span class="sy0"> * (setf pressure 3)
* (when-plusp pressure (print 'alarm));

a) Alarm
b) Alarm
Alarm
c) 1
d) Nil

Answer: b
Clarification: This statement will print alarm twice because of the positive number.
Output:
ALARM
ALARM

10. What is the output of the given statement?

span class="sy0"> * (defun when-plusp-with-bug (number result);
  (when (plusp number) result));
span class="sy0"> * (setf pressure -2)
* (when-plusp-with-bug pressure (print 'alarm))

a) Alarm
b) Nil
c) Both Alarm & Nil
d) None of the mentioned

Answer: c
Clarification: This statement will print alarm and nil because of the definition.
Output:
ALARM
NIL

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top