250+ TOP MCQs on The NFA with epsilon-moves to the DFA and Answers

Compilers Interview Questions and Answers for Experienced people 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

Answer: d
Clarification: Both P and NP are closed under each of these operations.

2. Ndfa and dfa accept same languages.
a) True
b) False

Answer: a
Clarification: 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: a
Clarification: 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: c
Clarification: 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: a
Clarification: 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: d
Clarification: 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: a
Clarification: 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

Answer: a
Clarification: 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

Answer: a
Clarification: 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

Answer: a
Clarification: For every NFA there is an ε-NFA that accepts a similar language and vice versa.

Global Education & Learning Series – Compilers.

To practice all areas of Compilers for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.

Participate in the Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Leave a Reply

Your email address will not be published. Required fields are marked *