GATE Computer ScienceVery hardGATE CS (PYQ pattern)
An ε-NFA over {a, b} has states 0–4, start state 0 and accepting state 3, with moves δ(0, a) = {1}, δ(1, b) = {2}, δ(2, a) = {0, 3}, δ(3, b) = {3}, δ(4, a) = {4}, δ(4, b) = {2} and ε-moves 0 → 4 and 3 → 0 (a missing move means no transition). The subset construction starts from the ε-closure of {0}. How many DFA states are reachable (count ∅ if it arises), and how many states does the minimal DFA have?
- A. 8 and 5
- B. 7 and 5
- C. 8 and 8
- D. 8 and 6
Correct answer: A. 8 and 5
Start {0, 4}. Reachable subsets: {0,4}, {1,4}, {2}, {4}, {0,3,4} (a from {2} gives {0,3} and the ε-moves add 4), ∅, {0,2,3,4}, {0,1,3,4}: 8 including ∅. The accepting ones are the 3 subsets containing 3. Partition refinement then merges equivalent states, leaving a minimal DFA of 5 states (∅ survives as the dead state).
More Compiler Design questions
- For the code 1: i = 0; 2: s = 0; 3: L1: if i >= n goto L4; 4: t = a + i; 5: if t > m goto L2; 6: s = s + t; 7: goto L3; 8: L2: a = a - 1…
- An LR parser for S → ( L ) | x; L → S | L , S parses "( ( x , x ) , x , ( x ) )". How many reductions does it perform (accept not…
- Sethi–Ullman labelling: a leaf is 1 as a left child and 0 as a right child (a right operand may be a memory operand); an interior node is…
- Build the LL(1) table for E → T R; R → + T R | − T R | ε; T → F P; P → ^ T | ε; F → ( E ) | id (^ is right-associative exponent). How many…
- An LR parser for E → id | E [ E ] | ( E ) parses "id [ ( id [ id ] ) ]". What is the largest number of grammar symbols on its stack at any…
- S → ( S ) S | ε is both LL(1) and SLR(1). Both parsers process "( ( ) ( ) )". What is the largest number of grammar symbols on the LL(1)…