Consider a CFG with the following productions. S→AA|B A→0A|A0|1 B→0B00|1
S is the start symbol, A and B are non-terminals and 0 and 1 are the terminals. The language generated by this grammar is
A
The set of all strings over {0, 1} containing at least two 0's
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
{0i10j|i,j≥0} ∪ {0n102n|n≥1}
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
{0n102n|n≥1}
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
{0i10j10k|i,j,k≥0} ∪ {0n102n|n≥0}
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution
The correct option is D {0i10j10k|i,j,k≥0} ∪ {0n102n|n≥0} S→B B→0B00|1
So, S generates {0n102n|n≥1} S→AA A→0A|A0|1 A→ {0m10n|m,n≥0}
So, S generates {0m10n0p10q|m,n,p,q≥0}.
={0m10x10q|m,x,q≥0}
={0i10j10k|i,j,k≥0}
L(S) = {0i10j10k|i,j,k≥0} ∪ {0n102n|n≥1}
Which is same as option (b).