Compilers Questions and Answers – Handle of Right sentinel Grammar – 1

This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Handle of Right sentinel Grammar – 1”.

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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: d
Explanation: Intermediate code generator receives input from its predecessor phase, semantic analyzer, in the form of an annotated syntax tree.
advertisement
advertisement

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
View Answer

Answer: d
Explanation: 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
View Answer

Answer: c
Explanation: Lexical analysis is the process of converting a sequence of characters into a sequence of tokens.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which of the following is used for grouping of characters into tokens?
a) Parser
b) Code optimization
c) Code generator
d) Lexical analyser
View Answer

Answer: d
Explanation: 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
View Answer

Answer: b
Explanation: 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.
advertisement

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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: b
Explanation: These are more like memory locations with values whose pointers have been revoked.
advertisement

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
View Answer

Answer: c
Explanation: As the name suggests that it optimizes the code.

Sanfoundry Global Education & Learning Series – Compilers.

To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.