GATE Computer ScienceVery hardGATE CS
A C comment is /* followed by any text that does not contain */ followed by */ . Over the alphabet { /, *, x } the language is /\*([^*]|\*+[^*/])*\*+/ . How many states does the minimal complete DFA (dead state included) for this language have?
- A. 5
- B. 6
- C. 7
- D. 8
Correct answer: B. 6
States: start; after '/'; inside the comment; inside after a '*' (possible end); the accepting state after the closing '/'; and the dead state (after any character following the accepting state, or after '/' not followed by '*'). Once inside, x and '/' return to 'inside' and '*' moves to 'after *', so there are no further states: 6.
More Compiler Design questions
- 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…
- The live ranges (inclusive of both end points, in instruction numbers) of ten variables are [1,8], [2,5], [3,9], [4,6], [7,12], [10,14]…
- Linear-scan register allocation processes the same ten live ranges [1,8], [2,5], [3,9], [4,6], [7,12], [10,14], [11,13], [6,10], [9,15]…