# LISP Questions & Answers – Recursion

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

1. Which is bounded to a list of all unaccounted argument values?
a) REST
b) &REST
c) RAISE
d) &RAISE

Explanation: A rest parameter will be marked by &REST and it is bounded to a list of all unaccounted argument values.

2. Which allow procedures to use themselves again?
a) Recursion
b) Reuse
c) Reintiate
d) None of the mentioned

Explanation: Recursion allows procedures to use themselves again and again.

3. Which eliminate the need for many auxiliaries?
a) Parameters
b) Block parameters
c) Optional parameters
d) All of the mentioned

Explanation: None.

4. Which can appear without an initial form?
a) Parameter
b) Block parameter
c) Optional parameter
d) Aux parameter

Explanation: An aux parameter can appear without an initial form, in which case there are no surrounding parentheses.

5. What value will assigned, if there is no argument marked by a matching keyword?
a) T
b) NIL
c) False
d) Both NIL & False

Explanation: If there is no argument marked by a matching keyword, the corresponding keyword parameter is bound to NIL.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What is the output of the following statement?

`span class="sy0"> * (defun higher-level-expt (m n)(if (zerop n)1 (* m(lower-level-expt m (- n 1)))))`

a) Higher
b) Higher-level-expt
c) Lower
d) Lower-level-expt

Explanation: This statement will print higher-level-expt because it is defined atfirst.
Output:
HIGHER-LEVEL-EXPT

7. What is the output of the following statement?

```span class="sy0"> * (defun root (x &optional n) (if n (expt x (/ 1 n))(sprt x)))
* (root 27 3)```

a) 3
b) 27
c) 3.0
d) None of the mentioned

Explanation: This statement is used to find out the square root of the given value.
Output:
3.0

8. What is the output of the following statement?

```span class="sy0"> * (defun punc (l) (append l '(period)))
* (punc '(this))```

a) This
b) Period
c) This period
d) All of the mentioned

Explanation: This statement will append the period to the end of the given statement.
Output:
(THIS PERIOD)

9. What is the output of the following statement?

```span class="sy0"> * (defun raise-aux (result number-list)(if (endp number-list) result (raise-aux (expt result (first number-list)) (rest number-list))))
* (defun raise (x &rest numbers) (raise-aux x numbers))
* (raise 5 3)```

a) 5
b) 3
c) 125
d) 25

Explanation: This statement will print first argument raised to power second argument.
Output:
125

10. What is the output of the following statement?

```span class="sy0"> *  (setf pairs '((maple shade) (apple fruit)))

a) Maple
c) Nil
d) T

Explanation: This statement is used to test the given statement for its equality.
Output:
NIL

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]

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!