# GATE | GATE CS Mock 2018 | Question 23

• Last Updated : 18 Jan, 2018

Consider the following grammars
(S1) :

```A --> aBCD
B --> bc|c
C --> d|∈
D -> b
```

(S2) :

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.

```A --> aBCD
B --> bc|∈
C --> d|c
D -> b
```

(S3) :

```A --> aBCD
B --> bc|∈
C --> d|∈
D -> b
```

(S4) :

```A --> aBCD
B --> bc|c
C --> d|c
D -> b
```

Which of the following grammar has same follow set for variable B?
(A) Only (S1), (S2) and (S3), (S4)
(B) Only (S1), (S3) and (S2), (S4)
(C) Only (S2), (S3) and (S1), (S4)
(D) None of the above

Explanation: Grammar (S1) and (S3) has follow sets :

```A = {\$},
B = {b, d},
C = {b},
D = {\$}
```

Grammar (S2) and (S4) has follow sets :

```A = {\$},
B = {c, d},
C = {b},
D = {\$}
```

So, option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up