Skip to content
Related Articles

Related Articles

Improve Article

GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 28

  • Last Updated : 26 Dec, 2019

Consider the following grammar:

A → BA'
A'→ +BA' /ϵ 
B → TB'
B'→ -TB'/ ϵ
T → id / (A) 

What will be the follow of T and A’
(A) +, ϵ, $ and $
(B) -, +, $, ) and $, )
(C) id, +, ) and id , (
(D) -, +, id, ) and $, )


Answer: (B)

Explanation: First(X) contains all terminal present in first place of every string derived by X.
Follow of X contains set of all terminal present in the place immediately right X.

Therefore,

Follow of A Fo(A) = $, ) 
Follow of A' Fo(A') = Fo(A) = $ , )
Follow of B Fo(B) = +, $, )
Follow of B' Fo(B') = Fo(B) = +, $, )

And, Follow of T Fo(T) 
= -, Fo(B') 
= -, +, $, ) 

So, option (B) is correct.


Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :