Compiler Design Questions and Answers - Non–Deterministic Finite Automata

1. A regular language corresponds to __________
a) An alphabet
b) Set of strings over an alphabet
c) A DFA only
d) A DFA or an NFA

Answer: b
Explanation: A regular grammar takes in all strings over an alphabet.

2. An NFA may be converted to a DFA using __________
a) Induction
b) A construction
c) Contradiction
d) Compilation

Answer: b
Explanation: subset construction is used to convert a NFA into DFA.

3. The subset construction shows that every NFA accepts a __________
a) String
b) Function
c) Regular language
d) Context-free language

Answer: c
Explanation: Like DFAs, NFAs only recognize regular languages.

4. Which is the application of NFA?
a) A regular language is produced by union of two regular languages
b) The concatenation of two regular languages is regular
c) The Kleene closure of a regular language is regular
d) All of the mentioned

Answer: d
Explanation: As per its definition.

5. For every NFA a deterministic finite automaton (DFA) can be found that accepts the same language.
a) True
b) False

Answer: a
Explanation: Therefore it is possible to convert an existing NFA into a DFA for the purpose of implementing a simpler machine. Which is executed by using the powerset construction.

6. Like DFAs, NFAs only recognize regular languages.
a) True
b) False

Answer: a
Explanation: It is a known fact.

7. Can a DFA simulate NDFA?
a) No
b) Yes
c) Sometimes
d) Depends on NDFA

Answer: b
Explanation: Yes it can be done through power set construction.

8. Find the wrong statement?
a) The language accepted by finite automata are the languages denoted by regular expression
b) Every DFA has a regular expression denoting its language
c) For a regular expression r, there does not exists NDFA with L® ant transit that accept
d) None of the mentioned

Answer: c
Explanation: The vice versa is true.

9. Regular expression a/b denotes which of the following set?
a) {a}
b) {€,a,b}
c) {a,b}
d) {ab}

Answer: c
Explanation: Either a is the output or b hence it’s {a, b}.

10. Which behaviour of a NFA can be stimulated by DFA?
a) Always
b) Sometimes
c) Never
d) Depends on NFA

Answer: a
Explanation: It can be done through power set construction.