Compilers Questions and Answers – The NFA with epsilon-moves to the DFA-2

«
»

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

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
View Answer

Answer: a
Explanation: They both are equivalent.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
advertisement
advertisement

3. __________ a part of a compiler that is responsible for recognizing syntax.
a) Parser
b) Bzr
c) Linker
d) Optimizer
View 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
View 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
View 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
View Answer

Answer: d
Explanation: In a two-phase compiler, ensures that there is a source program and an object program.
advertisement

7. If the NFA N has n states, then the corresponding DFA D has 2n states.
a) True
b) False
View Answer

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

Answer: a
Explanation: An NFA is nothing more than an ε-NFA with no ε transitions. Thus • δ (q, ε) for all states q = ∅.
advertisement

9. For every DFA, there is an ε-NFA that accepts the same language.
a) True
b) False
View Answer

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

Answer: a
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 for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.