GATE Computer ScienceVery hardGATE CSE
A DFA reads binary strings most-significant bit first and accepts those whose numeric value is divisible by 12 (the empty string counts as value 0 and is accepted). How many states does the minimal DFA have?
- A. 12
- B. 6
- C. 5
- D. 4
Correct answer: C. 5
Tracking the value mod 12 uses 12 residues, but residues that cannot be told apart by any suffix merge; the Myhill–Nerode count is 5 (stable for longer strings: 5).
More Compiler Design questions
- Let L = { w ∈ {a,b} : w contains the substring "aba" and |w| is even }. How many states does the minimal DFA for L have?
- A straight-line CFG B1→B2→B3→B4→B5 has: B1 defines x; B2 defines y; B3 uses y and defines z; B4 defines y; B5 uses x and z. Live-variable…
- A flow graph has blocks (definitions d1…d7): B1: d1: i=0; d2: j=0. B2: d3: i=i+1. B3: d4: j=j+i. B4: d5: i=j; d6: k=i. B5: d7: j=k. Edges…
- In register allocation by graph colouring, variables v0…v6 have interference edges: the 5-cycle v0–v1–v2–v3–v4–v0, v5 interfering with…
- With Sethi–Ullman numbering (left leaf = 1, right leaf = 0, internal node = max(l,r) if l ≠ r else l+1), what is the label of the root of…
- Syntax-directed definition: E → E1 T { E.val = E1.val 2 + T.val }; E → T { E.val = T.val }; T → num { T.val = num.lexval }. For the input…