Consider the following DFA over Σ = {a, b, c}. Start state q0; final states q2, q3, q4, q5. Transitions (any missing transition goes to a dead state):
| State | a | b | c |
|---|---|---|---|
| → q0 | q1 | – | – |
| q1 | q2 | q3 | q4 |
| * q2 | q2 | q3 | q4 |
| * q3 | q5 | – | q3 |
| * q4 | q0 | – | – |
| * q5 | q1 | – | – |
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. NFA-D: states q0–q3, start q0, final {q2, q3}. q0 –a→ q0, q0 –a→ q1; q1 –b→ q2, q1 –a,c→ q3; q2 –c→ q2, q2 –a→ q0, q2 –a→ q3; q3 –a→ q0
Explanation
In the DFA, after an 'a' from q0 we are in q1; from q1 any single a, b or c is accepted. The NFA in option D captures this: q0 loops on 'a' (guessing where the last useful 'a' starts), q1 –b→ q2 covers the 'b…c*' branch (DFA q3 with its c-loop), and q1 –a,c→ q3 covers the accepting DFA states q2/q4. Checking every string up to length 8 shows option D accepts exactly the same strings as the DFA. Option C fails on 'ab' (q2 must be final), and options A/B fail on strings like 'abac' because the extra a-edge to q4 adds strings the DFA rejects.More Theory of Computation and Compilers questions
- Consider the following DFA over Σ = {a, b, c}. Start state q0, which is also the only final state. Transitions:State a b c →* q0 q1 q0 q0 q…
- Match List I with List IIList I List II A. Type 3 Grammar I. V → (V ∪ Σ)* B. Type 2 Grammar II. αVβ → α(V ∪ Σ)⁺β, where α, β ∈ (V ∪ Σ)* C.…
- Arrange the following parsers in increasing order of their power of handling grammars, i.e. from the least powerful parser to the most powe…
- What are the various LEADERS (leading statements) for the TAC given in the passage?
- Which of the following is the optimized version of the TAC given in the passage?
- Which of the following is the correct high level code for the TAC given in the passage?