GATE Computer ScienceVery hardGATE CS
A lexical rule recognises the language (ab | abc | c)*(bc | a) over {a, b, c}. How many states does the minimal complete DFA (dead state included) for this language have?
- A. 7
- B. 4
- C. 5
- D. 6
Correct answer: C. 5
Building the subset-construction DFA and merging equivalent states (checked by an exhaustive Myhill–Nerode computation on all prefixes and suffixes up to length 6) leaves 5 states, one of which is the dead state.
More Compiler Design questions
- For the statement a = b (−c) + b (−c), common subexpressions are shared (so −c and b (−c) are each computed once) and the code is stored…
- Grammar: E → E + T | T; T → T F | F; F → ( E ) | id. An SLR(1) parser parses id + id ( id + id ) id. Counting every shift, every reduce…
- A table-driven predictive parser for E → T E'; E' → + T E' | ε; T → F T'; T' → F T' | ε; F → ( E ) | id parses ( id + id ) id + id. One…
- An array A[2..6][−1..4][0..5] of 4-byte elements has base address 1000. The address of A[4][2][3] is computed in row-major order and…
- A scanner discards comments, which begin with / and end at the FIRST / (comments do not nest). Identifiers are letters, and and / are…
- A C lexer uses maximal munch. How many tokens does it produce for the line int x = a++ + --b >= 3 ? 1 : 0; (whitespace is ignored)?