LISP Questions & Answers – List Storage

This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “List Storage”.

1. Which is a string of boxes linked by arrow like pointers?
a) Lisp
b) List
c) Variables
d) Pointers
View Answer

Answer: b
Explanation: A list in box and pointer notation is a string of boxes linked by arrow like pointers.

2. What is the other name of boxes?
a) Cons cells
b) Conses
c) Both Cons cells & Conses
d) None of the mentioned
View Answer

Answer: c
Explanation: The box is called as atoms and two-pointer entities, in which the boxes can tie together.

3. Which is used to construct new lists by linking the right pointers?
a) Links
b) List
c) Variables
d) Right pointers
View Answer

Answer: d
Explanation: Lisp maintains a list of spare boxes, linked by their right pointers for constructing new lists.
advertisement
advertisement

4. Which can be represented in bytes?
a) Boxes and pointers
b) Lists
c) Lisp
d) None of the mentioned
View Answer

Answer: a
Explanation: Boxes and pointers both can be represented in bytes. But lists and LISP can be represented in bytes.

5. Which can build new lists by depositing pointers in free boxes?
a) Do
b) Dobuild
c) Cons
d) None of the mentioned
View Answer

Answer: c
Explanation: Cons builds new lists by depositing pointers in free boxes.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What is the output of the given statement?

span class="sy0"> * (setf abc '(a b c) xyz '(x y z))
* (setf bc (rest abc))
* bc

a) A
b) B
c) C
d) BC
View Answer

Answer: d
Explanation: This statement will print BC because of definied variable bc.
Output:
(B C)
advertisement

7. What is the output of the given statement?

advertisement
span class="sy0"> * (setf abc '(a b c) xyz '(x y z))
* abc

a) A
b) B
c) ABC
d) None of the mentioned
View Answer

Answer: c
Explanation: This statement is printing abc because of definition.
Output:
(A B C)

8. What is the output of the given statement?

span class="sy0"> * (setf toss '(heads tails tails tails heads tails))
* (delete 'heads toss)
* toss

a) Heads tails
b) Heads tails tails tails tails
c) Heads
d) None of the mentioned
View Answer

Answer: b
Explanation: This statement will print the result by mainpulation of delete.
Output:
(HEADS TAILS TAILS TAILS TAILS)

9. What is the output of the given statement?

span class="sy0"> * (setf fact1 '(big computers are nice))
* (setf (first fact1) 'fast)

a) Big computers
b) Fast
c) Big computers are fast
d) None of the mentioned
View Answer

Answer: b
Explanation: This statement will print the given result because of the definition of first.
Output:
FAST

10. What is the output of the given statement?

span class="sy0"> * (setf l1 (list 'a 'b 'c))
* (setf l2 (list 'a 'b))
* (setf l1 l2)

a) A B
b) A B C
c) B C
d) None of the mentioned
View Answer

Answer: a
Explanation: This statement will print the a and b because of computing the intersection of the two values.
Output:
(A B)

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.