LISP Questions & Answers – Data Abstraction

«
»

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

1. Which process helps to build a large and complicated programs?
a) Abstraction
b) Mapping
c) Data abstraction
d) None of the mentioned
View Answer

Answer: c
Explanation: Data abstraction process helps to build a large and complicated programs.
advertisement

2. What is partly embedded in the knowledge of your programming for manipulating applications?
a) Programming cliches
b) Procedures
c) Abstraction
d) Data
View Answer

Answer: a
Explanation: The knowledge of programming is embedded partly in applicable templates called programming cliches.

3. How many items are available in mapping primitives are there?
a) 3
b) 4
c) 5
d) 6
View Answer

Answer: c
Explanation: There are five items in mapping primitives. They are mapcar, remove-if, remove-if-not, count-if and find-if.

4. Which makes it easy to identify the first entry encountered that satisfies a given predicate?
a) Reusing
b) Revoking
c) Template
d) Filtering
View Answer

Answer: d
Explanation: Filtering makes it easy to identify the first entry encountered that satisfies a given predicate.

5. How many access procedures are available in lisp?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: c
Explanation: The access procedures available in lisp are constructors, readers and writers.

6. What is the output of the following statement?

advertisement
span class="sy0"> * (defun book-author (book) (second book))
* (setf book-example-1 '((Artificial Intelligence) (Patrick) (Technical AI)))
* (book-author book-example-1)

a) Artificial Intelligence
b) Patrick
c) Technical AI
d) None of the mentioned
View Answer

Answer: b
Explanation: This statement will define the book author and it will reveal the author from the any statement.
Output:
(PATRICK)

7. What is the output of the following statement?

span class="sy0"> * (defun make (title author) (list (list 'title title) (list 'author author)))
* (setf book (make '(Common Lisp) '(Guy steele)))

a) Common Lisp
b) Guy steele
c) Make
d) ((TITLE (COMMON LISP)) (AUTHOR (GUY STEELE)))
View Answer

Answer: d
Explanation: This statement will print the values according to the classification.
Output:
((TITLE (COMMON LISP)) (AUTHOR (GUY STEELE)))

8. What is the output of the following statement?

advertisement
span class="sy0"> * (defun make (title author) (list (list 'title title) (list 'author author)))
* (setf book (make '(Common Lisp) '(Guy steele)))
*  (defun book-author-writer (book author) (cons (list 'author author) book))

a) Book
b) Book-author
c) Book-author-writer
d) None of the mentioned
View Answer

Answer: c
Explanation: This statement will print the defined value.
Output:
BOOK-AUTHOR-WRITER

9. What is the output of the following statement?

span class="sy0"> * (setf book (book=author-writer book '(guy steele)))

a) Guy
b) Steele
c) Error
d) None of the mentioned
View Answer

Answer: c
Explanation: This statement will print the error because is not defined.

10. What is the output of the following statement?

span class="sy0"> * (defun  (input-list) (if (endp input-list) nil (cons ( (first input-list)) ( (rest input-list)))))

a) Procedure
b) Transforming
c) Input
d) Error
View Answer

Answer: d
Explanation: Because the procedure is not a type of list, So it is printing a error.

Sanfoundry Global Education & Learning Series – LISP Programming Language.

advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn