Compilers Multiple Choice Questions & Answers (MCQs) on “Handle of Right sentinel Grammar”.
1. DAG representation of a basic block allows __________
a) Automatic detection of local common sub expressions
b) Detection of induction variables
c) Automatic detection of loop variant
d) None of the mentioned
Answer: a
Clarification: It detects local sub expression.
2. Inherited attribute is a natural choice in __________
a) Tracking declaration of a variable
b) Correct use of L and R values
c) All of the mentioned
d) None of the mentioned
Answer: a
Clarification: These attribute keep a check on variable declaration.
3. An intermediate code form is __________
a) Postfix notation
b) Syntax Trees
c) Three Address code
d) All of the mentioned
Answer: d
Clarification: Intermediate code generator receives input from its predecessor phase, semantic analyzer, in the form of an annotated syntax tree.
4. Which of the following actions an operator precedence parser may take to recover from an error?
a) Insert symbols onto the stack
b) Delete symbols from the stack
c) Inserting or deleting symbols from the input
d) All of the mentioned
Answer: d
Clarification: All these symbols are used to recover operator precedence parser from an error.
5. What is the output of lexical analyzer?
a) A set of regular expression
b) Syntax tress
c) Set of Token
d) String of Characters
Answer: c
Clarification: Lexical analysis is the process of converting a sequence of characters into a sequence of tokens.
6. 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
Clarification: Lexical analysis is the process of converting a sequence of characters into a sequence of tokens.
7. Shift reduce parsers are __________
a) Top down parser
b) Bottom up parser
c) Maybe both
d) None of the mentioned
Answer: b
Clarification: This corresponds to starting at the leaves of the parse tree. It can be thought of a process of reducing the string in question to the start symbol of the grammar. Bottom-up parsing is also known as shift-reduce parsing.
8. A bottom up parser generates __________
a) Right most derivation
b) Right most derivation in reverse
c) Left most derivation
d) Left most derivation in reverse
Answer: b
Clarification: This corresponds to starting at the leaves of the parse tree. It can be thought of. A process of reducing the string in question to the start symbol of the grammar. Bottom-up parsing is also known as shift-reduce parsing.
9. What is garbage?
a) Unallocated storage
b) Allocated storage whose access paths are destroyed?
c) Allocated storage
d) Uninitialized storage
Answer: b
Clarification: These are more like memory loacations with values whose pointers have been revoked.
10. An optimizing compiler __________
a) Is optimized to occupy less space
b) Is optimized to take less time for execution
c) Optimized the code
d) None of the mentioned
Answer: c
Clarification: As the name suggests that it optimizes the code.