GATE Computer ScienceVery hardGATE CSE
A DFA over {0, 1} has states 0–8 with start state 0 and accepting states {5, 6, 7, 8}. Transitions (on 0, on 1): 0:(1,2), 1:(3,4), 2:(3,4), 3:(5,6), 4:(5,6), 5:(7,8), 6:(7,8), 7:(7,0), 8:(8,0). How many states does the minimal equivalent DFA have?
- A. 6
- B. 5
- C. 7
- D. 4
Correct answer: B. 5
All 9 states are reachable; partition refinement (accepting versus non-accepting, then by successor classes) merges equivalent states, ending with 5 classes.
More Compiler Design questions
- In a language with Algol-style call by name, int i = 1 and A = [10, 20, 30] (1-indexed) are global, and procedure P(p, q) { i = i + 1; p =…
- Indirect left recursion is removed from S → A a | b; A → A c | S d | ε by ordering the non-terminals S, A, substituting S into A's rules…
- In S → A B C | C a; A → a A | ε; B → b B | A c | ε; C → d | B e, how many symbols (including ) does FOLLOW(B) contain?
- How many of these four grammars are LL(1)? (1) S → a S b | ε; (2) S → A B; A → a | ε; B → a | b; (3) S → a A | b; A → S c | ε; (4) S → S a…
- Statements: 1: a = 1; 2: b = 2; 3: c = a + b; 4: d = c 2; 5: if d > 10 goto 8; 6: e = a + d; 7: goto 9; 8: e = b + 1; 9: print e. Which…
- A C lexer applies the maximal-munch rule (always take the longest possible token). How many tokens does it produce for the input…