Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. Which makes it possible to define sophisticated generator procedures that produce new values?
a) List
b) Variables
c) Encapsulation
d) None of the mentioned

Answer: c [Reason:] Encapsulation makes it possible to define sophisticated generator procedures that produce new values each time they are called.

2. Which primitive enables you to define one procedure inside another?
a) Do
b) List
c) Primitive
d) Labels

Answer: d [Reason:] The labels primitive enables you to define one procedure inside another.

3. Which helps to produce nested fences?
a) Lets
b) List
c) Label
d) None of the mentioned

Answer: a [Reason:] Lets helps to produce nested fences.

4. Which do not produce nested fences?
a) Variables
b) Procedure calls
c) Fences
d) All of the mentioned

Answer: b [Reason:] None.

5. Which makes nameless procedures into lexical closures?
a) \$
b) #
c) #’
d) *

Answer: c [Reason:] #’ makes it possible to produce nameless procedures into lexical closures.

6. What is the output of the given statement?

```span class="sy0"> * (defun first-of-first-with-labels (l) (labels ((aux (m) (first m))) (first (aux 1))))
* (first-of-first-with-labels '((a b) (c d)))```

a) A
b) B
c) C
d) D

Answer: a [Reason:] This statement will produce the result as first given variable. Output: A

7. What is the output of the given statement?

```span class="sy0"> * (defun power-of-two () (setf previous-power-of-two (* previous-power-of-two 2)))
* (power-of-two)
* (power-of-two)```

a) 1
b) 2
c) 4
d) None of the mentioned

Answer: c [Reason:] This statement will compute the power of two by executing certain number of times. Output: 4

8. What is the output of the given statement?

```span class="sy0"> * (defun square (list-of-numbers) (mapcar #'(lambda (n) (*n n)) list-of-numbers))
* (square '(1 2 3))```

a) 9
b) 1
c) 3
d) 143

Answer: d [Reason:] This statement will compute the square of all given numbers. Output: (1 4 9)

9. What is the output of the given statement?

```span class="sy0"> * (setf square-procedures #'(lambda (n) (* n n)))
* (funcall square-procedure 2)```

a) 1
b) 2
c) 3
d) 4

Answer: d [Reason:] This statement will compute the procedure of square using the given statement. Output: 4

10. What is the output of the given statement?

```span class="sy0"> * (setf g1 (let ((previous-power-of-two 1)) #'(lambda () (setf previous-power-of-two (*previous-power-of-two 2)))))
* (g1)```

a) G1
b) 0
c) Let
d) Error