What will be the “First” and “Follow” of E and F for the following grammar? E…

PYQ Coal India Management Trainee CBT 2017Modified — slightly modified from the official paper; see the solution

What will be the “First” and “Follow” of E and F for the following grammar?

E -> TE'
E' -> +TE' / ε
T -> FT'
T' -> *FT' / ε
F -> id / (E)

  1. A.

    First(E)={id, (, ε}, Follow(E)={ε, )}, First(F)={id, ), $}, Follow(F)={*, $, (}

  2. B.

    First(E)={id, (}, Follow(E)={$, )}, First(F)={id, (}, Follow(F)={*, $, ), +}

  3. C.

    First(E)={id, ), ε}, Follow(E)={ε, )}, First(F)={id, )}, Follow(F)={*, $, (, +}

  4. D.

    First(E)={id, )}, Follow(E)={$, )}, First(F)={id, (, $}, Follow(F)={*, $, ), +}

Attempted by 344 students.

Sign up free to check your answer

Sign up free

Explore the full course: Coal India Management Trainee

Loading lesson…