GATE Computer ScienceVery hardGATE CS (PYQ pattern)
An NFA over {a, b} has states 0 to 4, start state 0, and these moves (a missing move means no transition): δ(0,a)={1,2}; δ(0,b)={0,1,2}; δ(1,a)={1,2,3}; δ(1,b)={4}; δ(3,a)={2}; δ(3,b)={2}; δ(4,a)={0}; δ(4,b)={1}. ε-moves: none. Using subset construction from the ε-closure of {0}, how many distinct DFA states (subsets, counting ∅ if it arises) are reachable?
- A. 9
- B. 8
- C. 10
- D. 11
Correct answer: A. 9
Running the subset construction and ε-closing every target gives 9 reachable subsets.
More Compiler Design questions
- Build the SLR(1) table for S → ( L ) | x; L → S | L , S (augmented with S′ → S). The ACTION part has a column for each of (, ), x, , and…
- int x = 1; void p() { x = x + 10; } void r() { print(x); } void q() { int x = 5; p(); r(); } main() { q(); r(); print(x); } What is…
- Each assignment is a definition named by its statement number. In 1: s = 0; 2: i = 0; 3: L1: if i >= n goto L4; 4: if a > 0 goto L2; 5: s…
- A basic block is converted to a DAG using value numbering, treating + and as commutative, reusing an existing node when the same operator…
- A web of a variable is a maximal union of def-use chains that share a definition or a use; a register allocator gives each web its own…
- In 1: x = 1; 2: y = 0; 3: L1: if y > n goto L3; 4: if x > 5 goto L2; 5: x = x 2; 6: L2: y = y + x; 7: x = y - 1; 8: if y < m goto L1; 9: x…