Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Chapter: 7
Q241:
REs are a notation for ________.
A. Context-free grammar
B. Finite automata
C. Regular languages
D. Pushdown automata
Correct Answer: C
Chapter: 7
Q242:
In NFA to DFA conversion, which of the following is true?
A. DFA always has fewer states than NFA
B. NFA and DFA are the same
C. DFA may have more states than NFA
D. DFA and NFA cannot be compared
Correct Answer: C
Chapter: 7
Q243:
C++ FA simulator uses which condition to break the loop?
A. state==initial
B. c=='\n'
C. state==acceptor
D. c==EOF
Correct Answer: D
Chapter: 7
Q244:
RE a* denotes which of the following?
A. a only
B. empty string only
C. a and empty string
D. any number of a's including none
Correct Answer: D
Chapter: 7
Q245:
______ automaton may transition without input.
A. NFA
B. DFA
C. Neither
D. Regex-based
Correct Answer: A
Chapter: 7
Q246:
Thompson's Construction algorithm was introduced in the year ________.
A. 1970
B. 1968
C. 1990
D. 2001
Correct Answer: B
Chapter: 7
Q247:
Which step follows RE to NFA in lexical analyzer construction?
A. NFA to RE
B. NFA to DFA
C. DFA to syntax tree
D. Regex simplification
Correct Answer: B
Chapter: 7
Q248:
______ automata are easier to implement and more efficient in execution.
A. NFA
B. DFA
C. Turing Machines
D. Linear Automata
Correct Answer: B
Chapter: 8
Q249:
What is the main algorithm used to convert NFA to DFA?
A. Epsilon elimination
B. Power set construction
C. Subset construction
D. Transition minimization
Correct Answer: C
Chapter: 8
Q250:
What does each state in a DFA constructed from an NFA represent?
A. A single transition
B. An NFA state
C. A symbol
D. A set of NFA states
Correct Answer: D
Chapter: 8
Q251:
What is the output of the subset construction algorithm?
A. A minimized NFA
B. A DFA equivalent to the NFA
C. A grammar
D. A syntax tree
Correct Answer: B
Chapter: 8
Q252:
In NFA-to-DFA construction, what is ε-closure(T)?
A. All states reachable via 'a'
B. All final states
C. All states reachable from T on ε-transitions
D. All unreachable states
Correct Answer: C
Chapter: 8
Q253:
The function move(T, a) returns
A. All NFA states with transitions on a
B. All states in DFA
C. Only start states
D. Final states of DFA
Correct Answer: A
Chapter: 8
Q254:
In NFA to DFA construction, before reading input, NFA can be in any state of
A. move(s0, a)
B. ε-closure(s0)
C. final states
D. DFA start state
Correct Answer: B
Chapter: 8
Q255:
In the subset construction algorithm, when is a new state added to the DFA?
A. When a loop is found
B. When the NFA ends
C. If the computed state is not in S’
D. If it’s a final state
Correct Answer: C
Chapter: 8
Q256:
The subset construction algorithm uses which data structure for marking states?
A. Stack
B. Heap
C. Queue
D. Set
Correct Answer: D
Chapter: 8
Q257:
What is the first step in subset construction?
A. Mark final state
B. ε-closure of start state
C. Create alphabet
D. Minimize DFA
Correct Answer: B
Chapter: 8
Q258:
The number of possible states in DFA constructed from an NFA with 11 states is up to
A. 11
B. 22
C. 121
D. 2048
Correct Answer: D
Chapter: 8
Q259:
A DFA state is marked as final if it contains
A. The start state of NFA
B. Any NFA final state
C. A loop
D. An unreachable state
Correct Answer: B
Chapter: 8
Q260:
ε-closure({3,8}) = _____________.
A. {2,4,6}
B. {1,2,3,4,6,7,8}
C. {3,8,10}
D. {5,6,7}
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now