This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “Properties”.
1. Which procedure is used to create data?
a) List
b) Variable
c) Constructor
d) None of the mentioned
View Answer
Explanation: A procedure that creates data is a constructor.
2. How many values that a symbol may have?
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: Symbols may have property values as well as ordinary values.
3. Which enables storage in symbolically indexed places?
a) Properties
b) Procedures
c) Variable
d) List
View Answer
Explanation: Properties enables storage in symbolically indexed places.
4. What is the collection of property names and values associated with a symbol?
a) List
b) Property
c) Procedures
d) Property list
View Answer
Explanation: The collection of property names and values associated with a symbol is said to be property list.
5. Which is used as writer for properties?
a) Setf
b) Get
c) Both Setf & Get
d) None of the mentioned
View Answer
Explanation: The setf used together with get, is the writer for properties.
6. What is the output of the given statement?
span class="sy0"> * (setf (get 'patrick 'parents) '(robert dorothy))
a) Robert
b) Dorothy
c) Error
d) Robert Dorothy
View Answer
Explanation: This statement is used to reterieve the contents from a property.
Output:
(ROBERT DOROTHY)
7. What is the output of the given statement?
span class="sy0"> * (setf (get 'bag 'contents) '(bread butter)) * (get 'bag 'contents)
a) Bread butter
b) Bread
c) Butter
d) None of the mentioned
View Answer
Explanation: This statement contains get which is used to reterieve the data.
Output:
(BREAD BUTTER)
8. What is the output of the given statement?
span class="sy0"> * (setf (get 'bag 'contents) '(bread butter)) * (get 'bag 'contents) * (remprop 'bag 'contents)
a) Bread
b) Butter
c) (CONTENTS (BREAD BUTTER))
d) None of the mentioned
View Answer
Explanation: This statement is used to remove the contents from the bag property.
Output:
(CONTENTS (BREAD BUTTER))
9. What is the output of the given statement?
span class="sy0"> * (setf (get 'bag 'contents) '(bread butter)) * (remprop 'bag 'contents) * (get 'bag 'contents)
a) T
b) Nil
c) Bread Butter
d) None of the mentioned
View Answer
Explanation: This statement will get the content after removing the data, So it is printing as Nil.
Output:
NIL
10. Pick out the correct syntax in given order.
a) (setf (get <symbol> <property name>) <property value>)
b) (setf (get <property name>)
c) (setf <property value> (get <symbol> <property name>)
d) None of the mentioned
View Answer
Explanation: The setf and get are used as writer for properties.
Sanfoundry Global Education & Learning Series – LISP Programming Language.
To practice all areas of LISP, here is complete set of 250+ Multiple Choice Questions and Answers on LISP Programming Language.
- Practice Computer Science MCQs
- Check Computer Science Books
- Apply for Computer Science Internship
- Apply for LISP Internship
- Check LISP Books