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

S aSa | bSb | a | b
The language generated by the above grammar over the alphabet {a,b} is the set of

A
all Palindromes
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
all even length palindromes
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
strings that begin and end with the same symbol
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
all odd length palindromes
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D all odd length palindromes
S aSa | bSb | a | b
is the grammar corresponding to all odd length palindromes.
Notice that choice (c) is not correct since "abaa" is a string that begins and ends with the same symbol but cannot be generated by above grammar.
Since all strings generates by this grammar have odd length, choices (a) and (d) are also incorrect.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Context-Free Grammars
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon