Skip to content

# GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 26

• Last Updated : 22 Jan, 2020

Identity the language generated by following grammar where S is the start variable.

```S → AB
A → aAb | ε
B → bBc | ε```

(A) L = { aibjck | i, j, k ≥ 0, and i+k > j }
(B) L = { aibjck | i, j, k ≥ 0, and i+j = k }
(C) L = { aibjck | i, j, k ≥ 0, and i+k = j }
(D) L = { aibjck | i, j, k ≥ 0, and i+j > k }

Answer: (C)

Explanation: In this case, the first thing we observe is that we can still accept the empty string by setting A and B as ε.

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.

Next, we construct the string using our variables A and B.
The variable A here ensures that we have an equal number of a’s and b’s for every occurence of A.
The variable B allows us to have an equal number of b and c, for every occurence of B.

Hence, the number of b’s is the sum of number of a’s and c’s

L = { aibjck | i, j, k ≥ 0, and i+k = j }

Option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up