250+ TOP MCQs on Reading and Answers

LISP Multiple Choice Questions on “Reading”.

1. Which primitive is used to connect the files with the streams?
a) Read
b) Format
c) With-open-file
d) None of the mentioned

Answer: c
Clarification: Streams are created, variables are bound to them and they are connected to files using with-open-file.

2. How many types of streams are available in lisp?
a) 1
b) 2
c) 3
d) 4

Answer: b
Clarification: There are two types of streams available in streams. They are input and output streams.

3. Which stream is involved with print and format forms?
a) Input
b) Output
c) Both Input & Output
d) None of the mentioned

Answer: b
Clarification: Output streams are involved with print and format forms.

4. What will happen if nil is supplied as second argument in read form?
a) T
b) Value
c) Nil
d) None of the mentioned

Answer: c
Clarification: In this case read will return NIL, instead of giving error.

5. How many types of read forms are available in file manipulation?
a) 1
b) 2
c) 3
d) 4

Answer: b
Clarification: The two types of read forms available in read form are read-line and read-char.

6. What is the output of the given statement?

span class="sy0"> * (read)(+ 2 2)
* (eval (read))(+ 2 2)

a) 2
b) 3
c) 4
d) Error

Answer: c
Clarification: This statement will add up the given values and print out the result.
Output:
4

7. What is the output of the given statement?

* (length '(a b c))
* (reverse '(a b c))

a) 3
b) C B A
c) A B C
d) Both 3 & C B A

Answer: d
Clarification: First statement will print the length and second statement will reverse the string.
Output:
3
(C B A)

  250+ TOP MCQs on Mapping and Answers

8. What is the output of the given statement?

span class="sy0"> * (elt "stevejobs" 6)

a) o
b) e
c) #/o
d) None of the mentioned

Answer: c
Clarification: This statement will print the index sixth letter of the given string.
Output:
#/o

9. What is the output of the given statement?

span class="sy0"> * (read-line)This is a test.

a) This is a test.
b) Nil
c) Error
d) Both This is a test. & Nil

Answer: d
Clarification: This statement will read the given line and print it.
Output:
“This is a test.”
NIL

10. What is the output of the given statement?

span class="sy0"> * (search "boris" "katz, boris" :test #'char-equal)

a) Katz
b) Boris
c) 6
d) Error

Answer: c
Clarification: This statement will search for the given string and print index of first letter that match.
Output:
6

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top