GATE Computer ScienceModerateGATE CSE
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)?
- A. 15
- B. 14
- C. 16
- D. 13
Correct answer: A. 15
Tokens: int, x, =, a, ++, +, --, b, >=, 3, ?, 1, :, 0, ; which is 15.
More Compiler Design questions
- For the grammar S → A B c; A → a A | ε; B → b B | ε, how many terminals are in FIRST(S)?
- For the standard expression grammar E → T E′; E′ → + T E′ | ε; T → F T′; T′ → F T′ | ε; F → ( E ) | id, how many symbols (including ) are…
- How many states does the canonical LR(0) collection of the augmented grammar S′ → S; S → A A; A → a A | b contain?
- What is the number of states in the minimal DFA for the regular expression (a|b)abb?
- Three-address code (at most one operator per instruction, the last instruction assigning to x) is generated for x = ab + c(d − e) − f/g…
- With ^ right-associative and higher than which is higher than + and − (both left-associative), what is the postfix form of a − b c ^ d ^ e…