Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q51: CFG stands for _______.
- A: Context-Free Generator
- B: Context-Free Grammar
- C: Context-Fixed Grammar
- D: Code Format Grammar
View Answer
B
Q52: In context-free grammar, S represents ______.
- A: Scanner
- B: Start symbol
- C: Statement
- D: Source
View Answer
C
Q53: Which is NOT a terminal symbol in the given CFG?
- A: +
- B: id
- C: goal
- D: number
View Answer
C
Q54: Which of the following is a non-terminal symbol?
- A: goal
- B: +
- C: id
- D: number
View Answer
A
Q55: The CFG for arithmetic expressions includes how many productions?
- A: 5
- B: 6
- C: 7
- D: 8
View Answer
C
Q56: Which of the following is a valid token type?
- A: statement
- B: number
- C: procedure
- D: method
View Answer
B
Q57: In token representation <id, x>, 'id' is the ______.
- A: word
- B: token
- C: type
- D: part of speech
View Answer
C
Q58: The sentence “x + 2 - y” is derived using ______.
- A: Backtracking
- B: Rightmost derivation
- C: Leftmost derivation
- D: Context-sensitive parsing
View Answer
C
Q59: A production rule in CFG can be defined as ______.
- A: Operator
- B: Rewrite rule
- C: Assembler directive
- D: Instruction set
View Answer
B
Q60: x = x + y is converted by the scanner into how many tokens?
- A: 3
- B: 4
- C: 5
- D: 6
View Answer
C