wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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

SbA SaB
Aa Bb
AaS BbS
AbAA BaBB

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
SaBaaBBaabBaabbS
aabbaBaabbab.

So aaabbab is generated by the grammar.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Binary Operations
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon