250+ TOP MCQs on Syntax and Answers

LISP Multiple Choice Questions on “Syntax”.

1. Which of the following is part of basic syntax in LISP programming?
a) Primitive
b) +
c) NULL
d) #include

Answer: a
Clarification: Primitives are part of basic syntax of LISP. + is not consered as a part of basic syntax of LISP. It is rather an example of the primitives.

2. Arguments are ____ a part of LISP Syntax.
a) sometimes
b) always
c) vever
d) not consered as

Answer: b
Clarification: Argument is a part of basic syntax of LISP. Even if there is no argument given then NIL is consered to be one of the arguments.

3. How many arguments do a single LISP program has?
a) One
b) Two
c) Any number of arguments
d) Three

Answer: c
Clarification: Any number of arguments can come in LISP single program. As an example, the addition (+) primitive takes any number of arguments.

4. What is the basic syntax of LISP? (Note: arg means argument here)
a) ( …)
b) ( )
c) ( )
d) ( … )

Answer: a
Clarification: Correct syntax of the LISP is ( …).

5. Can LISP programs be nested?
a) Yes
b) No

Answer: a
Clarification: Yes, the LISP programs can be nested.

6. What is the output of the following LISP statement?

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

Answer: c
Clarification: Prefix notation is used in this statement. The “+” primitive is used for addition of numbers given to it in the form of arguments.
Output: 7

7. What is the output of the following LISP statement?

a) 24
b) 234
c) 32
d) 4

Answer: a
Clarification: More than two arguments are given to * primitive. It will multiply all the arguments supplied to it and prints the final result.
Output: 24

  250+ TOP MCQs on File Manipulation and Answers

8. What is the output of the following LISP statement?

a) 39
b) 3
c) 17 (* 22 1)
d) Error

Answer: a
Clarification: LISP programs are nested here. This statement will be completely evaluated. It will not give us the output in the form of (+ 17 (* 22 1)).
Output: 39

9. What is the output of the following LISP statement?

a) 3
b) 1/3
c) Division
d) Error

Answer: a
Clarification: (/ 6 2) is evaluated as 6/2 and not 2/6 because (/ 6 2) is written in the prefix form.
Output: 3

10. Think of a way to write addition of four numbers using maximum possible braces?
a) (+ 1 2 3 4)
b) (+ (+ 1 2) (+ 3 4))
c) (+ 1 (+ 2 (+ 3 (4))))
d) (+ 1 2 (+ 3 4))

Answer: b
Clarification: In this 3 times braces () are used. Other possible way is (+ 1 (+ 2 (+ 3 4))) in which again 3 braces () are used.

Leave a Comment

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

Scroll to Top