GATE Computer ScienceEasyGATE CS (PYQ pattern)

Compute FIRST of every non-terminal of S → A B | B C; A → a A | ε; B → b B | ε; C → c C | c, treating ε as a member of FIRST when the non-terminal is nullable. What is the sum of the sizes of the FIRST sets?

  1. A. 9
  2. B. 11
  3. C. 10
  4. D. 6

Correct answer: A. 9

FIRST(S)={a,b,c,ε}, FIRST(A)={a,ε}, FIRST(B)={b,ε}, FIRST(C)={c}; total 9.

More Compiler Design questions

Exams that ask this topic