Computer Science EngineeringHard

For the grammar S -> AB, A -> a | epsilon, B -> b, what is FIRST(S)?

  1. A. {a}
  2. B. {b}
  3. C. {epsilon}
  4. D. {a, b}

Correct answer: D. {a, b}

A can derive a or epsilon, and when A derives epsilon the first symbol comes from B, which is b.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic