Compilers Questions and Answers – The NFA with epsilon-moves to the DFA
This set of Compilers Interview Questions and Answers for Experienced people focuses on “The NFA with epsilon-moves to the DFA”.
- The classes of languages P and NP are closed under certain operations, and not closed under others. Decide whether P and NP are closed under each of the following operations.
Union
Intersection
Intersection with a regular language
Kleene closure (star)
Homomorphism
Inverse homomorphism
a) P is not closed under union
b) NP is not closed under intersection.
c) None of the mentioned
d) Both of the mentioned
Answer
Answer: d
Explanation: Both P and NP are closed under each of these operations.
2. Ndfa and dfa accept same languages
a) True
b) False
Answer
Answer: a
Explanation: They both are equivalent.
3. __________ a part of a compiler that is responsible for recognizing syntax.
a) Parser
b) Bzr
c) Linker
d) Optimizer
Answer
Answer: a
Explanation: Parser recognises all the syntax of the language.
4. __________ a part of a compiler that takes as input a stream of characters and produces as output a stream of words along with their associated syntactic categories.
a) Parser
b) Optimizer
c) Scanner
d) None of the mentioned
Answer
Answer: c
Explanation: A compiler’s scanner reads an input stream that consists of characters and produces an output stream that contains words, each labelled with its Syntactic category.
5. _________an IR-to-IR transformer that tries to improve the IR program in some way.
a) Optimizer
b) Parser
c) All of the mentioned
d) None of the mentioned
Answer
Answer: a
Explanation: The optimizer is an IR-to-IR transformer that tries to improve the IR program in some way.
6. _________a phase of a compiler that maps the IR program into the instruction set and the finite resources of the target machine.
a) Optimizer
b) Parser
c) Optimizer & Parser
d) None of the mentioned
Answer
Answer: d
Explanation: In a two-phase compiler, ensures that there is a source program and an object program.
7. If the NFA N has n states, then the corresponding DFA D has 2n states
a) True
b) False
Answer
Answer: a
Explanation: nfa has n then dfa has at max 2^n.
8. An NFA is nothing more than a e-NFA with no e transitions
a) True
b) False
Answer
Answer: a
Explanation: An NFA is nothing more than a e-NFA with no e transitions. Thus • d (q, e) for all states q = Ø.
9. For every DFA, there is a e-NFA that accepts the same language
a) True
b) False
Answer
Answer: a
Explanation: For every DFA, there is a e-NFA that accepts the same language and Vice Versa.
10. DFAs, NFAs, and e-NFA s are equivalent
a) True
b) False
Answer
Answer: a
Explanation: for every NFA there is a e-NFA that accepts the similar language, and vice versa.