Compiler Design MCQ Questions And Answers - Syntax Analyser
This section focuses on "Syntax Analyser" in Compiler Design. These Multiple Choice Questions (MCQs) should be practiced to improve the Compiler Design skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. How many components context-free grammar has?
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : C
Explanation: A context-free grammar has four components:non-terminals, terminal symbols, productions and start symbol.
2. A set of tokens, known as?
A. non-terminals
B. terminal symbols
C. productions
D. start symbol
View Answer
Ans : B
Explanation: A set of tokens, known as terminal symbols
3. Which of the following called left side of the production?
A. production consists of a non-terminal
B. sequence of tokens and/or on- terminals
C. Both A and B
D. None of the above
View Answer
Ans : A
Explanation: Each production consists of a non-terminal called the left side of the production, an arrow, and a sequence of tokens and/or on- terminals, called the right side of the production.
4. Which of the following is a graphical depiction of a derivation?
A. Derivation Tree
B. Analyzers Tree
C. Parse Tree
D. Ambiguity Tree
View Answer
Ans : C
Explanation: A parse tree is a graphical depiction of a derivation. It is convenient to see how strings are derived from the start symbol.
5. In parse tree, leaf nodes are called?
A. terminals
B. non-terminals
C. sub-terminals
D. half-terminals
View Answer
Ans : A
Explanation: In a parse tree: All leaf nodes are terminals and All interior nodes are non-terminals.
6. Which of the following are Limitations of Syntax Analyzers?
A. it cannot determine if a token is valid,
B. it cannot determine if a token is declared before it is being used,
C. it cannot determine if an operation performed on a token type is valid or not.
D. All of the above
View Answer
Ans : D
Explanation: All of the above are are Limitations of Syntax Analyzers.
7. How many types of parsing are there?
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : A
Explanation: The way the production rules are implemented (derivation) divides parsing into two types : top-down parsing and bottom-up parsing.
8. When the parser starts constructing the parse tree from the start symbol and then tries to transform the start symbol to the input, it is called?
A. Recursive descent parsing
B. Backtracking
C. Top-down Parsing
D. Bottom-up Parsing
View Answer
Ans : C
Explanation: When the parser starts constructing the parse tree from the start symbol and then tries to transform the start symbol to the input, it is called top-down parsing.
9. Type checking is normally done during ____________
A. Lexical Analysis
B. Syntax Analysis
C. Syntax Directed Translation
D. Code generation
View Answer
Ans : C
Explanation: It is the function of Syntax directed translation.
10. Which of the following is true?
A. In Short Syntax Analysis Generates Parse Tree.
B. Syntax analyser does not check the type of the operand.
C. Symbol table is created by the compiler which contains the list of lexemes or tokens.
D. All of the above
View Answer
Ans : D
Explanation: all of the above statement are true.
Discussion