Explore topic-wise MCQs in Lisp.

This section includes 18 Mcqs, each offering curated multiple-choice questions to sharpen your Lisp knowledge and support exam preparation. Choose a topic below to get started.

1.

A given grammar is called ambiguous if

A. two or more productions have the same non-terminal on the left-hand side
B. a derivation tree has more than one associated sentence
C. there is a sentence with more than one derivation tree corresponding to it
D. brackets are not present in the grammar
Answer» D. brackets are not present in the grammar
2.

Consider the grammarS → AbBaCc | εA → aAb | baB → bBC | cbC → cCa |acFind the First ( ) of S

A. {a, b, c, ε}
B. {a, b, ε}
C. { ε }
D. {a, ε}
Answer» C. { ε }
3.

______ is a data structure that holds information about identifiers.

A. Intermediate code
B. Lexical analyser
C. Symbol table
D. Context free grammar
Answer» D. Context free grammar
4.

Given the grammars → T * S | TT → U + T | UU → a | bWhich of the following statements is wrong?

A. Grammar is not ambiguous
B. Priority of + over * is ensured
C. Right to left evaluation of * and + happens
D. None of these
Answer» E.
5.

In a two-pass assembler, resolution of subroutine calls and inclusion of labels in the symbol table is done during

A. second pass
B. first pass and second pass respectively
C. second pass and first pass respectively
D. first pass
Answer» D. first pass
6.

Consider the following statements.I. Symbol table is accessed only during lexical analysis and syntax analysis.II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.Which of the above statements is/are TRUE?

A. I only
B. I and III only
C. II only
D. None of I, II, and III
Answer» E.
7.

Consider the following grammar:P → xQRSQ → yz |zR → w | εS → yWhat is FOLLOW(Q)?

A. {R}
B. {w}
C. {w, y}
D. {w $}
Answer» D. {w $}
8.

Consider the grammar defined by the following production rules, with two operators ∗ and +S → T * PT → U|T * UP → Q + P|QQ → IdU → IdWhich one of the following is TRUE?

A. + is left associative, while ∗ is right associative
B. + is right associative, while ∗ is left associative
C. Both + and ∗ are right associative
D. Both + and ∗ are left associative
Answer» C. Both + and ∗ are right associative
9.

Consider the following ANSI C program:int main() {Integer x;return 0;}Which one of the following phases in a seven-phase C compiler will throw an error?

A. Syntax analyzer
B. Semantic analyzer
C. Machine dependent optimizer
D. Lexical analyzer
Answer» C. Machine dependent optimizer
10.

Incremental-Compiler is a compiler

A. which is written in a language that is different from the source language
B. compiles the whole source code to generate object code afresh
C. complies only those portions of source code that have been modified
D. that runs on one machine but produces object code for another machine
Answer» D. that runs on one machine but produces object code for another machine
11.

Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts in List - II:List - IList - IIA. A part of a compiler that is responsible for recognizing1. Optimizer syntaxB. A part of a compiler that takes as input a stream of characters and produces as output a stream of words along with their associated syntactic categories.2. Semantic AnalysisC. A part of a compiler that understands the meanings of variable names and other symbols and checks that they are used in ways consistent with their definitions.3. ParserD. An IR-to-IR transformer that tries to improve the IR program in some way (Intermediate Representation).4. Scanner

A. A - 3, B - 4, C - 2, D - 1
B. A - 4, B - 3, C - 2, D - 1
C. A - 2, B - 4, C - 1, D - 3
D. A - 2, B - 4, C - 3, D - 1
Answer» B. A - 4, B - 3, C - 2, D - 1
12.

A parse tree showing the values of attributes at each node is called a(n) ______

A. AVL tree
B. Trie tree
C. Annotated parse tree
D. Rooted tree
Answer» D. Rooted tree
13.

24?$

A. 234
B. 32
C. 4
Answer» B. 32
14.

Can LISP programs be nested?

A. Yes
B. No
Answer» B. No
15.

What is the basic syntax of LISP? (Note: arg means argument here)

A. (<LISP Primitive> <arg1> <arg2> …)
B. (<LISP Primitive> <arg>)
C. (<arg> <LISP Primitive>)
D. (<arg1> <arg2> … <LISP Primitive>)
Answer» B. (<LISP Primitive> <arg>)
16.

How many arguments do a single LISP program has?

A. One
B. Two
C. Any number of arguments
D. Three
Answer» D. Three
17.

Arguments are ____ a part of LISP Syntax.

A. sometimes
B. always
C. vever
D. not considered as
Answer» C. vever
18.

Which of the following is part of basic syntax in LISP programming?

A. Primitive
B. +
C. NULL
D. include
Answer» B. +