Select Page
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 is a general strategy for controling how a computation evolves?
a) Recursion
b) Mapping
c) Iteration
d) None of the mentioned

Answer: c [Reason:] Iteration is said to be one kind of control strategy and it is a general strategy for controling how a computation evolves.

2. Which provides a way to write simple counting-oriented iteration procedures?
a) Do
b) Dotimes
c) Recursion
d) Iteration

Answer: b [Reason:] Dotimes provides a way to write simple counting-oriented iteration procedures.

3. What will happen if a dotimes form has no result form?
a) Nil
b) T
c) Both Nil & T
d) Nothing

Answer: a [Reason:] If a dotimes form has no result form, the dotimes will return nil and its purpose is to arrange for side effects.

4. What will be occupied in the first part of DO?
a) Procedures
b) List
c) Iterators
d) List of parameters

Answer: d [Reason:] The first part of a DO is always occupied by a list of parameters that are all bound to initial values.

5. Which are evaluated before before inital binding?
a) All initialization forms
b) Iterations
c) Procedures
d) None of the mentioned

6. What is the output of the given statement?

`span class="sy0"> * (prog1 (setf a 'x) (Setf b 'y) (setf c 'z))`

a) X
b) Y
c) Z
d) XYZ

Answer: a [Reason:] The statement contains prog1 which is used to print the first value of the given list. Output: X

7. What is the output of the given statement?

```span class="sy0"> * (defun dotimes-expt (2 4)
(let ((result 1));
(dotimes (count 4 result);
(setf result (* 2 result)))));```

a) 2
b) 4
c) 8
d) 16

Answer: d [Reason:] This statement will calculate the power in given terms. Output: 16

8. What is the output of the given statement?

`span class="sy0"> * (setf freezing 32 boiling 212)`

a) 32
b) 212
c) Both 32 & 212
d) None of the mentioned

Answer: b [Reason:] This statement will return the higher value based on the condition. Output: 212

9. What is the output of the given statement?

```span class="sy0"> * (setf cheers '(cheer cheer cheer))
* (setf loop-count 0)
* (loop (when (endp cheers) (return loop-count)) (setf cheers (rest cheers)) (setf loop-count (+ loop-count 1)))```

a) 0
b) 2
c) Cheers
d) 3

Answer: d [Reason:] This statement will count the number of times does the cheers appears by loop. Output: 3

10. What is the output of the given statement?

`span class="sy0"> * (progn (setf a 'x) (setf b 'y) (Setf c 'z))`

a) X
b) Y
c) Z
d) XYZ