ISRO | ISRO CS 2017 | Question 23
Identify the language generated by the following grammar
S -> AB A -> aAb|ϵ B -> bB| b
(A)
{ambn | n>=m, m>0}
(B)
{ambn | n>=m, m>=0}
(C)
{ambn | n>m, m>0}
(D)
{ambn | n>m, m>=0}
Answer: (D)
Explanation:
S -> AB A -> aAb|ϵ B -> bB| b
strings generated by the language: b, bb, abb, abbb, aabbb and so on. Alternative way – The production rule B -> bB| b will generate bp, p ≥ 1 The production rule A -> aAb|ϵ will generate ambm, n ≥ 0 The production rule S -> AB will generate amb(m+p), i.e.,
{ambn | n>m, m>=0}
So option (D) is correct.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...