LISP Questions & Answers – Properties

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

Answer: c
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

Answer: b
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

Answer: a
Explanation: Properties enables storage in symbolically indexed places.
advertisement
advertisement

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

Answer: d
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

Answer: c
Explanation: The setf used together with get, is the writer for properties.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

Answer: d
Explanation: This statement is used to reterieve the contents from a property.
Output:
(ROBERT DOROTHY)
advertisement

7. What is the output of the given statement?

advertisement
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

Answer: a
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

Answer: c
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

Answer: b
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

Answer: a
Explanation: The setf and get are used as writer for properties.

Sanfoundry Global Education & Learning Series – LISP Programming Language.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.