Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Chapter: 8
Q261:
The state A in the DFA example is derived from which NFA states?
A. {1,2,3}
B. {0,1,2,4,7}
C. {1,2,4}
D. {0,2,3,4}
Correct Answer:
B
Chapter: 8
Q262:
move(A,a) in the DFA example gives transition to
A. {1,3,6}
B. {3,4}
C. {3,8}
D. {5,7}
Correct Answer:
C
Chapter: 8
Q263:
After applying ε-closure to move(A,a), we get state
A. A
B. B
C. C
D. D
Correct Answer:
B
Chapter: 8
Q264:
The DFA resulting from subset construction is always
A. Smaller than NFA
B. Equivalent to NFA
C. Different from NFA
D. Cannot be minimized
Correct Answer:
B
Chapter: 8
Q265:
A transition table for DFA maps
A. A single state to a set
B. A symbol to a string
C. A state-symbol pair to a state
D. A symbol to a symbol
Correct Answer:
C
Chapter: 8
Q266:
How many sets were finally marked in the example DFA construction?
A. 3
B. 4
C. 5
D. 6
Correct Answer:
C
Chapter: 8
Q267:
Which of the following is NOT part of the subset construction algorithm?
A. ε-closure calculation
B. DFA state minimization
C. move function
D. Marking states
Correct Answer:
B
Chapter: 8
Q268:
Subset construction is applied on which type of automata?
A. DFA
B. PDA
C. NFA
D. Turing Machine
Correct Answer:
C
Chapter: 8
Q269:
After computing move and ε-closure, if a new set U is not in S’, what happens?
A. Skip the input
B. Add U to final states
C. Add U to S’
D. Discard U
Correct Answer:
C
Chapter: 8
Q270:
In subset construction, if state S contains a final NFA state, S becomes
A. Start state
B. Reject state
C. Accepting DFA state
D. Dead state
Correct Answer:
C
Chapter: 8
Q271:
DFA is ___________ automaton.
A. Non-deterministic
B. Multi-tape
C. Deterministic
D. Ambiguous
Correct Answer:
C
Chapter: 8
Q272:
Which is used to track unprocessed states in subset construction?
A. Stack
B. Queue
C. Unmarked set list
D. Priority queue
Correct Answer:
C
Chapter: 8
Q273:
Which part of the NFA contributes to ε-closure?
A. Direct transitions
B. Epsilon transitions
C. Final state transitions
D. All transitions
Correct Answer:
B
Chapter: 8
Q274:
The DFA transition function in subset construction is represented as
A. S’ x Σ → Σ
B. S x Σ → S
C. S’ x Σ → S’
D. Σ x Σ → S’
Correct Answer:
C
Chapter: 9
Q275:
What is the purpose of DFA minimization?
A. To add more states
B. To remove transitions
C. To reduce number of states
D. To remove alphabets
Correct Answer:
C
Chapter: 9
Q276:
Which algorithm is commonly used to minimize DFA states?
A. Knuth-Morris algorithm
B. Huffman’s algorithm
C. Hopcroft’s algorithm
D. Dijkstra’s algorithm
Correct Answer:
C
Chapter: 9
Q277:
In DFA minimization, states A and C can be merged if they are
A. Accepting states
B. Equivalent states
C. Final states
D. Initial states
Correct Answer:
B
Chapter: 9
Q278:
In a minimized DFA, what does each state represent?
A. An input symbol
B. A unique transition
C. A group of equivalent states
D. A start symbol
Correct Answer:
C
Chapter: 9
Q279:
What is the output of a lexical analyzer?
A. Tokens or error
B. Bytecode
C. Parse tree
D. Abstract syntax tree
Correct Answer:
A
Chapter: 9
Q280:
What does a lexical analyzer use to identify tokens?
A. Grammar rules
B. Regular expressions
C. Syntax tree
D. Parsing table
Correct Answer:
B