UPPCL AE 2022
April 11, 2025NTA UGC NET Aug 2024 Paper-2
April 11, 2025NTA UGC NET Aug 2024 Paper-2
| Question 7 |
Consider the Grammar :
T -> Qx
Q -> RS
R -> y|e
S -> z|e Where e is epsilon
Here x, y, z are terminals and T, Q, R, S are non terminals.
What will be the follow set of the non terminal R ?
T -> Qx
Q -> RS
R -> y|e
S -> z|e Where e is epsilon
Here x, y, z are terminals and T, Q, R, S are non terminals.
What will be the follow set of the non terminal R ?
| {x,y}
| |
| {y,z} | |
| {z,x} | |
| {e} |
Question 7 Explanation:
Q → RS: In this production, R is followed by S. This means Follow(R) should include First(S).
The First(S) set includes {z, ε} because S can produce either z or ε.
Since Follow(R) will include First(S) (except ε), we add z to Follow(R) from First(S).
Additionally, since S can be ε, the production Q → RS implies that Follow(R) should also include Follow(Q).
Finally, T → Qx tells us that Follow(Q) includes the terminal x. So, Follow(R) will also include x.
Follow(R) includes {z, x}.
The First(S) set includes {z, ε} because S can produce either z or ε.
Since Follow(R) will include First(S) (except ε), we add z to Follow(R) from First(S).
Additionally, since S can be ε, the production Q → RS implies that Follow(R) should also include Follow(Q).
Finally, T → Qx tells us that Follow(Q) includes the terminal x. So, Follow(R) will also include x.
Follow(R) includes {z, x}.
Correct Answer: C
Question 7 Explanation:
Q → RS: In this production, R is followed by S. This means Follow(R) should include First(S).
The First(S) set includes {z, ε} because S can produce either z or ε.
Since Follow(R) will include First(S) (except ε), we add z to Follow(R) from First(S).
Additionally, since S can be ε, the production Q → RS implies that Follow(R) should also include Follow(Q).
Finally, T → Qx tells us that Follow(Q) includes the terminal x. So, Follow(R) will also include x.
Follow(R) includes {z, x}.
The First(S) set includes {z, ε} because S can produce either z or ε.
Since Follow(R) will include First(S) (except ε), we add z to Follow(R) from First(S).
Additionally, since S can be ε, the production Q → RS implies that Follow(R) should also include Follow(Q).
Finally, T → Qx tells us that Follow(Q) includes the terminal x. So, Follow(R) will also include x.
Follow(R) includes {z, x}.
