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. What is the process of creating new data types in lisp?
a) List
b) Structures
c) Procedures
d) None of the mentioned

View Answer

Answer: b [Reason:] Lisp has elaborate apparatus for automatically creating new data types and this is called as structure types.

2. Which is the primitive that creates new structure types?
a) Defnum
b) Deftype
c) Defstruct
d) None of the mentioned

View Answer

Answer: c [Reason:] Defstruct is the primitive that creates new structure types.

3. What should be used with structure names with a combination?
a) Make-
b) Make
c) Create
d) Deploy

View Answer

Answer: a [Reason:] The defstruct form is evaluated is a combination of make- with structure type’s name.

4. Which enables storage in procedurally indexed places?
a) Defstruct
b) Object
c) Structure
d) None of the mentioned

View Answer

Answer: c [Reason:] Structure types enables storage in procedurally indexed places.

5. Which creates reader procedures for getting things out of an instance fields?
a) Structure
b) Defstruct
c) Class
d) Object

View Answer

Answer: b [Reason:] None.

6. What is the output of the given statement?

span class="sy0"> * (defstruct person (gender nil) (personality 'nice))
* (setf person-instance-1 (make-person))
* (setf person-instance-2 (make-person :gender 'female))

a) Person :gender female :personality nice
b) Person :gender
c) gender:Female
d) None of the mentioned

View Answer

Answer: a [Reason:] This statement will create two entries in the structure named person. Output: #S(PERSON :gender FEMALE :PERSONALITY NICE)

7. What is the output of the given statement?

span class="sy0"> * (defstruct person (gender nil) (personality 'nice))
* (setf person-instance-1 (make-person))
* (setf person-instance-2 (make-person :gender 'female))
* (person-personality person-instance-2)

a) Female
b) Nice
c) Person
d) Both Female & Nice

View Answer

Answer: b [Reason:] This statement will reveal the value of personality from person. Output: NICE

8. What is the output of the given statement?

span class="sy0"> * (defstruct person (gender nil) (personality 'nice))
* (setf person-instance-1 (make-person))
* (setf person-instance-2 (make-person :gender 'female))
* (person-p '(this is a list -- not a person instance))

a) Female
b) Nice
c) T
d) Nil

View Answer

Answer: d [Reason:] This statement is based on structure and not on list, So it is printing as nil. Output: NIL

9. What is the output of the given statement?

span class="sy0"> * (defstruct person (gender nil) (personality 'nice))
* (setf person-instance-1 (make-person))
* (setf person-instance-2 (make-person :gender 'female))
* (setf (person-surname person-instance-1) 'winston)

a) Winston
b) Nil
c) T
d) Error

View Answer

Answer: d [Reason:] The error because of the last statement that the syntax is wrong.

10. What is the output of the given statement?

span class="sy0"> * (defstruct employee (length-of-service 0) (payment 'salary))
* (setf employee-example (make-employee))
* (employee-length-of-service employee-example)

a) T
b) NIL
c) 0
d) Error

View Answer

Answer: c [Reason:] This statement will create example field at the employee structure. Output: 0