Compiler Construction MCQ
Compiler Construction MCQ
’s
College of Business Studies and Computer Applications
Chinchwad, Pune 19
(Affiliated to Savitribai Phule Pune University, Recognized by Govt. of Maharashtra , Accredited by NAAC)
Academic Year 2019 – 20
MCQ Question Bank
Class:-T.Y.Bsc(CS) Subject :-Compiler Construction
9. The linker
a) is similar to interpreter
b) uses source code as its input
c) is required to create a load module
d) none of the above
Answer : c
10. A grammar that produces more than one parse tree for some sentence is called
a) Ambiguous
b) Unambiguous
c) Regular
d) None of these
Answer : a
20. Which of the following is used for grouping of characters into tokens?
a) Parser
b) Code optimization
c) Code generator
d) Lexical analyzer
Answer : d
21. A compiler that runs on one machine and produces code for a different machine is called
a) Cross compilation
b) One pass compilation
c) Two pass compilation
d) None of the above
Answer : a
a) Postfix notation
b) Syntax trees
c) Three address codes
d) Quadruples
Answer : d
28. grammar that produces more than one parse tree for some sentence is called
a) Ambiguous
b) Unambiguous
c) Regular
d) None of the mentioned
Answer: a
Explanation: ambiguous grammar has more than one parse tree.
36. Which of the following derivations does a top-down parser use while parsing an input
string?
a) Leftmost derivation
b) Leftmost derivation in reverse
c) Rightmost derivation
d) Rightmost derivation in reverse
Answer: a
Explanation: In top down parser takes input from Left to right constructing leftmost
derivation of the sentence.
37. Which of the following describes a handle (as applicable to LR-parsing) appropriately?
a) Position where next reduce or shift operation will occur
b) The next step has use of Non-terminal for reduction
c) used for reduction in a coming-up step along with a position in the sentential form
where the next shift or reduce operation will occur
d) used in the next step for reduction along with a position in the sentential form where
the right hand side of the production may be found
Answer: d
Explanation: the next step in LR parsing shall have Reduction .
38. The grammar A → AA | (A) | e is not suitable for predictive-parsing because the
grammar is
a) Ambiguous
b) Left recursive
c) Right recursive
d) An operator grammar
Answer: b
Explanation:
A ::= A a| b is the left recursive language.
39. In a bottom-up evaluation of a syntax directed definition its inherited attributes can do
which of the following?
a) Always evaluated
b) Can be evaluated if the definition is L attributed
c) Can be evaluated if the definition has synthesized attributes
d) Never be evaluated
Answer: b
Explanation: A Syntax Directed Definition (SDD) is called S Attributed if it has only
synthesized attributes. Also the
L-Attributed Definitions contain both synthesized and inherited attributes but do not need
to build a dependency graph to evaluate them.
40. S → C C
C→cC|d
The grammar is
a) LL(1)
b) SLR(1) but not LL(1)
c) LALR(1) but not SLR(1)
d) LR(1) but not LALR(1)
Answer: a
Explanation: Since there is no conflict, the grammar is LL (1) hence a predictive parse
table with no conflicts can be constructed.
41. Which of the following derivations does a top-down parser use while parsing an input
string?
a) Leftmost derivation
b) Leftmost derivation in reverse
c) Rightmost derivation
d) Rightmost derivation in reverse
Answer: a
Explanation: Left to right constructing leftmost derivation of the sentence.
43. Which one of the following is true at any valid state in shift-reduce parsing?
a) At the bottom we find the prefixes
b) None of the mentioned
c) Stack contains only viable prefixes
d) Stack consists of viable prefixes
Answer: c
Explanation: The prefixes on the stack of a shift-reduce parser are called viable prefixes.
44. A top down parser generates
a) Rightmost Derivation
b) Right most derivation in reverse
c) Left most derivation
d) Left most derivation in reverse
Answer: c
Explanation: Top-down parsing is a parsing strategy where one first looks at the highest
level of the parse tree and works down the parse tree by using the rewriting rules of a
formal grammar.
48. Which of the following is used for grouping of characters into tokens?
a) Parser
b) Code optimization
c) Code generator
d) Lexical analyser
Answer: d
Explanation: lexical analysis is the process of converting a sequence of characters into a
sequence of tokens.
49. A garbage is
a) Unallocated storage
b) Allocated storage whose access paths are destroyed?
c) Allocated storage
d) Uninitialized storage
Answer: b
Explanation: these are more like memory loacations with values whose pointers have
been revoked
51. A synthesized attribute is an attribute whose value at a parse tree node depends on
a) Attributes at the siblings only
b) Attributes at parent node only
c) Attributes at children nodes only
d) None of the mentioned
Answer: c
Explanation: Synthesized attribute’s value depend on children node only
52. _________ or scanning is the process where the stream of characters making up the
source program is read from left to right and grouped into tokens.
a) Lexical Analysis
b) Diversion
c) Modelling
d) None of the mentioned
Answer: a
Explanation: Lexical analysis is the process of converting a sequence of characters into a
sequence of tokens
56. A system program that setup an executable program in main memory ready for execution
is
a) Assembler
b) Linker
c) Loader
d) Load and go
Answer: c
Explanation: a loader is the part of an operating system that is responsible for loading
programs and libraries. It is one of the essential stages in the process of starting a
program, as it places programs into memory and prepares them for execution
61. Which of the following system software resides in the main memory always
a) Text Editor
b) Assembler
c) Linker
d) Loader
Answer: d
Explanation: Loader is used to loading programs.
68. The graph that shows basic blocks and their successor relationship is called
a) DAG
b)Flow graph
c) control graph
d)Hamiltonion graph
Ans : B
70. When a computer is first turned on or resrarted, a special type of absolute loader is
executed called
A." Compile and GO " loader
B. Boot loader
C.Boot strap loader
D.Relating loader
Ans : C
77. one or more parse tree for some sentence, that is ________grammer.
Unambiguous
b) Ambiguous
c) Both A and B
d) None of these
Ans :B