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

The following Context-Free Grammar (CFG):
S aB | bA
A a | aS | bAA
B b | bS | aBB
may generates(s)

A
Different numbers of a's and b's.
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
At least one odd numbers of a's and odd numbers of b's
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
Equal numbers of a's and b's
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
Even numbers of a's and even number of b's
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D Even numbers of a's and even number of b's
Option (a,b,c)
The following Context-Free Grammar (CFG):
S aB | bA
A a | aS | bAA
B b | bS | aBB
will generate
  • Odd numbers of a's and odd numbers of b's i.e. al
  • Even numbers of a's and even numbers of b's i.e. e
  • Equal numbrs of a's' and b's i.e. ab, ba, bbaa or aal
  • It will not generate different numbers of a's and b'

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