This set of LISP Multiple Choice Questions & Answers (MCQs) focuses on “S-Expression – 1”.
1. What S-expression consists of?
a) Atoms and Lists
b) Numeric only
c) Literals only
d) Atoms only
Explanation: S-expression consists of both Atoms and Lists. It also consists of numeric and literals.
2. All program statements and data in LISP are represented by S-expressions?
Explanation: Yes, all the program statements and data are represented by S-expressions in LISP. S-expressions or symbolic expressions are the syntactic elements of the LISP programming language.
3. What are the basic building blocks of S-expressions?
Explanation: Atoms are building blocks of S-expressions. Even atoms are considered as a fundamental unit of LISP.
4. If X and Y are S-expression then (X.Y) is a/an ____
Explanation: In LISP programming if X and Y are S-expressions then the dotted pair (X.Y) is also considered as S-expression.
5. Atoms are considered as S-expressions.
Explanation: Atoms are also considered as S-expressions. Rather S-expressions are formed from atoms.
6. What will be the output of the following LISP statement?
Explanation: Print will output the argument given to it as it is on the output terminal of the compiler.
7. What will be the output of the following LISP statement?
d) ATOM infinitely
Explanation: Print is used to write the argument provided to it on the output part of the program.
8. What will be the output of the following LISP statement?
Explanation: Print primitive does not give an error if the argument has -(hyphen). It prints on output the argument provided to it.
9. What is the output of the following LISP statement?
(print 'list atom)
a) LIST ATOM
Explanation: We cannot give space in print’s argument in this type of declaration. It will consider that two arguments are given to print primitive one being list and other is an atom. But we can give only one argument to print so it will give error.
10. What is the output of the following LISP statement?
(print '(list atom))
a) LIST ATOM
Explanation: If we keep the space separated items in the braces then the print will not give error. The list and atom are two different words but they are bound in one single argument by use of braces.
Output: LIST ATOM.
Sanfoundry Global Education & Learning Series – LISP Programming Language.
To practice all areas of LISP, here is complete set of 250+ Multiple Choice Questions and Answers on LISP Programming Language.