Consider the CFG with {S, A, B} as the non-terminal alphabet, {a, b} as the terminal alphabet, S as the start symbol and the following set of production rules
S→bA
S→aB
A→a
B→b
A→aS
B→bS
A→bAA
B→aBB
Which of the following string is generated by the grammar?
A
aabbab
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
abbbba
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
aaaabb
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
aabbbb
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is A aabbab S⇒aB⇒aaBB⇒aabB⇒aabbS ⇒aabbaB⇒aabbab.