This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “The NFA with epsilon-moves to the DFA-2”.
1. 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.
1. Union 2. Intersection 3. Intersection with a regular language 4. Kleene closure (star) 5. Homomorphism 6. Inverse homomorphism
a) P is not closed under union
b) NP is not closed under intersection
c) None of the mentioned
d) P is not closed under union & NP is not closed under intersection
View Answer
Explanation: Both P and NP are closed under each of these operations.
2. Ndfa and dfa accept same languages.
a) True
b) False
View Answer
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
View Answer
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
View Answer
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
View Answer
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
View Answer
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
View Answer
Explanation: nfa has n then dfa has at max 2^n.
8. An NFA is nothing more than an ε-NFA with no ε transitions.
a) True
b) False
View Answer
Explanation: An NFA is nothing more than an ε-NFA with no ε transitions. Thus • δ (q, ε) for all states q = ∅.
9. For every DFA, there is an ε-NFA that accepts the same language.
a) True
b) False
View Answer
Explanation: For every DFA, there is an ε-NFA that accepts the same language and Vice Versa.
10. DFAs, NFAs, and ε-NFA s are equivalent.
a) True
b) False
View Answer
Explanation: For every NFA there is an ε-NFA that accepts a similar language and vice versa.
Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Compiler Design Books
- Practice Computer Science MCQs
- Practice MCA MCQs
- Apply for Computer Science Internship
- Check Computer Science Books