GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Consider strings containing both ab and bb as substrings in either order (overlaps allowed). How many states does the minimal complete DFA (including a dead state, if one is needed) have?
- A. 8
- B. 9
- C. 10
- D. 11
Correct answer: B. 9
Distinguishing prefixes by the suffixes that complete them gives 9 Myhill-Nerode classes. (Dead state included only when some prefix can never be completed.)
More Compiler Design questions
- G1: L → L , x | x and G2: L → x , L | x generate the same language. A shift-reduce (LR) parser parses "x , x , x , x , x" (five x's) with…
- Productions of the grammar are numbered: (1) E → E + T; (2) E → T; (3) T → T F; (4) T → F; (5) F → ( E ); (6) F → id. An LR parser parses…
- In 1: i = 0; 2: L1: if i >= n goto L3; 3: if i > k goto L2; 4: t = a b; 5: x = t + 1; 6: L2: y = a + b; 7: i = i + 1; 8: goto L1; 9: L3…
- For the grammar S → X Y Z; X → a X | ε; Y → b Y | X; Z → c | ε, what is FIRST(S)? (ε counts as a member if S is nullable.)
- The statement r = (a + b) (b + a) − (a + b) / c is turned into a DAG (+ and commutative, − and / not), and three-address code is generated…
- For S′ → S; S → a S a | b S b | c, the canonical LR(1) states with identical cores are merged to obtain LALR(1). The LALR state whose only…