Skip to content
Related Articles

Related Articles

GATE | GATE-CS-2006 | Question 84
  • Last Updated : 04 Sep, 2014
GeeksforGeeks - Summer Carnival Banner
Which one of the following grammars generates the language L = {aibj | i ≠ j}

cs200684

(A) A
(B) B
(C) C
(D) D


Answer: (D)

Explanation:

Language L contains the strings : {abb, aab, abbb, aabbb, aaabb, aa, bb, …….}, i.e, all a’s appear before b’s in a string, and “number of a’s” is not equal to “number of b’s”, So i ≠ j.
Here Grammar A, B & C also generate the string “ab”, where i = j, and many more strings with i = j, hence these grammars do not generate the language L, because for a string that belongs to language L, exponent i should not be equal to exponent  j.
Grammar D : This Grammar never generates a string with equal no of a’s and b’s, i.e. i=j. Hence this grammar generates the language L. Hence Option D.


Quiz of this Question

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :