Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q841: Fill in the blank: The notation [A → α•a β, b] means the dot is before ________.
- A: Terminal 'a'
- B: Non-terminal 'A'
- C: End of input
- D: Start symbol
View Answer
A
Q842: What is the condition for Action[i,a] ← "reduce A → α"?
- A: If [A → α•, a] ∈ Ii and A ≠ S'
- B: If [A → α•a β, b] ∈ Ii
- C: If [S' → S•, $] ∈ Ii
- D: If [A → α•a β, b] ∈ Ii and A = S'
View Answer
A
Q843: Which of these actions is set for Action[3, ×]?
- A: Shift 6
- B: Reduce 5
- C: Accept
- D: Error
View Answer
A
Q844: Fill in the blank: The goto table maps pairs of (state, ________) to states.
- A: Non-terminals
- B: Terminals
- C: Actions
- D: Productions
View Answer
A
Q845: Which production is reduced by Action[7, $]?
- A: E → T – E
- B: T → F
- C: F → id
- D: E → T
View Answer
A
Q846: Fill in the blank: The end marker in the input string is represented by the symbol ________.
- A: $
- B: #
- C: %
- D: &
View Answer
A
Q847: What does Ij represent in the LR parser?
- A: The state reached by goto function
- B: The input token
- C: The grammar rule
- D: The lookahead symbol
View Answer
A
Q848: In the example, what is the parsing action for Action[6, id]?
- A: Shift 4
- B: Reduce 6
- C: Accept
- D: Shift 6
View Answer
A
Q849: Fill in the blank: The expression to be parsed in the example is ________.
- A: x – y × z
- B: x + y × z
- C: x – y + z
- D: x × y – z
View Answer
A
Q850: In the LR(1) parser, what is the initial item pushed onto the stack before parsing starts?
- A: dummy
- B: token
- C: 0
- D: scanner
View Answer
A