GATE Computer ScienceModerateGATE CSE · NIELIT
For the grammar S → A B c; A → a A | ε; B → b B | ε, how many terminals are in FIRST(S)?
- A. 2
- B. 4
- C. 5
- D. 3
Correct answer: D. 3
FIRST(S) = FIRST(A) ∪ FIRST(B) ∪ {c} = {a, b, c} since A and B are nullable, so 3.
More Compiler Design questions
- 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…
- Consider this three-address code: 1: i = 0; 2: s = 0; 3: if i >= n goto 9; 4: t = a[i]; 5: if t < 0 goto 7; 6: s = s + t; 7: i = i + 1; 8…