This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Lexical Analysis – 1”.
1. What is the output of lexical analyzer?
a) A set of RE
b) Syntax Tree
c) Set of Tokens
d) String Character
View Answer
Explanation: A lexical analyzer coverts character sequences to set of tokens.
2. Which symbol table implementation is based on the property of locality of reference?
a) Linear list
b) Search tree
c) Hash Table
d) Self Organisation
View Answer
Explanation: Hash table is used as a reference for symbol table because it is efficient.
3. Which of the following is true for operator precedence parsing?
a) For all pair of non-terminal
b) For all pair of non-terminals
c) To delimit the handle
d) None of the mentioned
View Answer
Explanation: There are two important properties for these operator precedence parsers is that it does not appear on the right side of any production and no production has two adjacent non-terminals. Implying that no production right side is empty or has two adjacent non-terminals. So accordingly to property option (A) is correct.
4. What is an Object program?
a) Program written in machine language
b) Program to be translated into machine language
c) Translation of high-level language into machine language
d) None of the mentioned
View Answer
Explanation: Since the input is the source language and the output that we get after the analysis is the machine language.
5. Which concept of FSA is used in the compiler?
a) Lexical analysis
b) Parser
c) Code generation
d) Code optimization
View Answer
Explanation: Because the lexer performs its analysis by going from one stage to another.
6. Which concept of grammar is used in the compiler?
a) Lexical analysis
b) Parser
c) Code generation
d) Code optimization
View Answer
Explanation: As the lexical analysis of a grammar takes place in phases hence it is synonymous to parser.
7. Which of the following are Lexemes?
a) Identifiers
b) Constants
c) Keywords
d) All of the mentioned
View Answer
Explanation: Different Lexical Classes or Tokens or Lexemes Identifiers, Constants, Keywords, Operators.
Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Practice MCA MCQs
- Apply for Computer Science Internship
- Check Compiler Design Books
- Check Computer Science Books
- Practice Computer Science MCQs