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 used to build the lisp procedures?
a) Data
b) Primitives
c) Definition
d) None of the mentioned

View Answer

Answer: b [Reason:] Lisp procedures are formed by using lisp primitives and it is the primary purpose of procedure definition.

2. Which primitive removes all but the last element from the list?
a) Last
b) First
c) Remove
d) Revoke

View Answer

Answer: a [Reason:] None.

3. What is a symbol thought of as a name for a place to store value?
a) Data
b) Variable
c) Parameters
d) None of the mentioned

View Answer

Answer: b [Reason:] A variable is a symbol thought of as a name for a place to store value.

4. How many types of variables are available in lisp?
a) 1
b) 2
c) 3
d) 4

View Answer

Answer: b [Reason:] There are two kinds of variables available in lisp. They are lexical variable and special variable.

5. What are the variables that are bound and that have values assigned to them?
a) Data
b) Variable
c) Parameters
d) None of the mentioned

View Answer

Answer: c [Reason:] The parameter of a procedure are variables that are bound and have values assigned to them.

6. What is the output of the following statement?

span class="sy0"> * (setf meals '(breakfast lunch tea dinner))
* (cons (first meals) (last meals))

a) Breakfast
b) Lunch
c) Dinner
d) Both Breakfast & Dinner

View Answer

Answer: d [Reason:] The statement will print the first and last value of the list because of the condition. Output: (BREAKFAST DINNER)

7. What is the output of the following statement?

span class="sy0"> * (setf whole-list '(monday tuesday wednesday thursday friday))
* (defun both-ends ()(setf whole-list (cons (first whole-list) (last whole-list))))

a) Monday
b) BOTH-ENDS
c) Friday Monday
d) Monday Friday

View Answer

Answer: b [Reason:] The function defun is used to return the procedure name only. Output: BOTH-ENDS

8. What is the output of the following statement?

span class="sy0"> * (defun both-ends-with-special ()(setf whole-list (cons (first whole-list) (last whole-list))))
* (setf whole-list '(monday tuesday wednesday thursday friday))
*  (both-ends-with-special)

a) Monday
b) Friday
c) Wednesday
d) Both Monday & Friday

View Answer

Answer: d [Reason:] The value of whole-list is erected when a form involving both-ends-with-special is evaluated. Output: (MONDAY FRIDAY)

9. What is the output of the following statement?

span class="sy0"> * (setf meals '(breakfast lunch tea dinner))
* (first meals)

a) Breakfast
b) Lunch
c) Tea
d) Dinner

View Answer

Answer: a [Reason:] The keyword first is used to print the first item of the list. Output: (BREAKFAST)

10. What is the output of the following statement?

span class="sy0"> * (setf x 'outside)
* (let ((x 'inside) (y x)) (list x y))

a) Outside
b) Inside
c) Inside Outside
d) Outside Inside

View Answer

Answer: c [Reason:] This statement is used to reverse the list. Output: (INSIDE OUTSIDE)