Skip to content
Related Articles

Related Articles

GATE | GATE-CS-2006 | Question 84

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jun, 2021
View Discussion
Improve Article
Save Article
Which one of the following grammars generates the language L = {aibj | i ≠ j}


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

Answer: (D)


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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!