GATE Computer ScienceVery hardGATE CS
In the Thompson NFA for (a*|b*)*, each symbol machine has 2 states and 1 non-ε edge; union and star add a new start and final state with 4 new ε-edges each (start to both/inner start and inner final to both/the new final, plus the loop-back edge for star). How many ε-transitions does the whole NFA have?
- A. 18
- B. 14
- C. 12
- D. 16
Correct answer: D. 16
a* has 4 ε-edges (star adds 4), and so does b*. The union adds 4 more: 4 + 4 + 4 = 12. The outer star adds 4 more: 16. Symbol machines contribute no ε-edges.
More Compiler Design questions
- A floating-point literal is defined over the symbols d (digit), '.', e and s (sign) as d⁺ ( . d⁺ )? ( e s? d⁺ )?. How many states does the…
- A C comment is / followed by any text that does not contain / followed by / . Over the alphabet { /, , x } the language is /([^]|+[^/])+/…
- A flow graph has nodes 1 to 10, entry node 1, and edges 1→2, 2→3, 3→4, 4→5, 5→3, 4→6, 6→7, 7→2, 7→8, 8→9, 9→8, 9→10, 6→10, 3→9. A back…
- For the flow graph with entry 1 and edges 1→2, 2→3, 3→4, 4→5, 5→3, 4→6, 6→7, 7→2, 7→8, 8→9, 9→8, 9→10, 6→10, 3→9, which is the dominance…
- An expression is very busy at a point if, along every path from that point, it is evaluated before any of its operands is redefined…
- A heap holds objects A to J. Roots point to A and E. Pointers: A→B, B→C, B→D, C→B, D→F, E→F, E→I, G→H, H→G, H→J. The root pointer to A is…