Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q211: A transition table in Finite Automata is used to ________.
- A: track memory usage
- B: encode transitions between states
- C: draw syntax trees
- D: manage symbols
View Answer
B
Q212: Which programming construct is used to simulate a Finite Automaton in C++?
- A: Function pointer
- B: Transition table
- C: Stack
- D: Array
View Answer
B
Q213: What is the role of the variable `state` in the C++ FA simulator?
- A: It stores error codes
- B: It keeps input characters
- C: It tracks current state of FA
- D: It stores string length
View Answer
C
Q214: What does the `accept_states[state]` return in the FA simulation?
- A: A list of accepted languages
- B: The transition path
- C: The current input state
- D: If the string is accepted or not
View Answer
D
Q215: In a DFA, how many transitions can exist per input symbol per state?
- A: Zero
- B: One
- C: Multiple
- D: Unlimited
View Answer
B
Q216: A Nondeterministic Finite Automaton (NFA) may have _______ for a given input.
- A: only one path
- B: two errors
- C: multiple transitions
- D: zero memory
View Answer
C
Q217: Which of the following is true for DFA?
- A: It can make ε-moves
- B: It allows multiple transitions for a symbol
- C: Only one transition per symbol
- D: None of the above
View Answer
C
Q218: In NFA, what does an ε-move represent?
- A: A failure state
- B: An error
- C: A transition without consuming input
- D: A final state
View Answer
C
Q219: Which of the following has a more compact representation for a regular expression?
- A: DFA
- B: NFA
- C: Transition Table
- D: Stack
View Answer
B
Q220: What does RE stand for in compiler construction?
- A: Regular Entry
- B: Recursive Evaluation
- C: Regular Expression
- D: Relational Element
View Answer
C