GATE Computer ScienceHardGATE CS (PYQ pattern)
How many states does the minimal complete DFA (dead state included) for the regular expression (ab | aba)* over {a, b} have?
- A. 5
- B. 4
- C. 6
- D. 3
Correct answer: A. 5
Myhill–Nerode classes: ε (accepting, start), a (waiting for b), ab (accepting: a block just ended, or aba may follow), aba (accepting; its last a may also begin a new block, so b leads back to the ab class and a to the a class), and the dead state (e.g. after b). ε and ab differ: ab·a is accepted but a alone is not. Total 5
More Compiler Design questions
- For E → T R; R → + T R | − T R | ε; T → F P; P → ^ T | ε; F → ( E ) | id, compute FOLLOW of every non-terminal ( counts as a member). What…
- A basic block is converted to a DAG using value numbering, treating + and as commutative, reusing an existing node when the same operator…
- Minimal SSA form is built for 1: if p > 0 goto L2; 2: L1: x = x + 1; 3: if x > n goto L3; 4: L2: y = y + x; 5: if y < m goto L1; 6: L3…
- L is the set of strings over {a, b} that contain abab as a substring but do not end with abab. How many states does the minimal complete…
- An LR parser for E → T E′; E′ → + T E′ | ε; T → F T′; T′ → F T′ | ε; F → ( E ) | id parses "id + id id". How many reductions does it make…
- For each choice of terminals x, y ∈ {a, b, c} consider G(x, y): S → A x B; A → a A | ε; B → b B | y. Of the nine grammars, how many are…