Discussion
The following CFG S → aB | bA, A → a | as | bAA, B → b | bs | aBB generates strings of terminals that have
Answer: C
The grammar generates strings with equal numbers of a's and b's. A generates the strings that have one more a than b's, B generates those with one more b than a's, and S starts with a followed by a string with one more b, or b followed by a string with one more a, so the totals are always equal. A check: S gives aB which gives ab, and bA gives ba, each with one a and one b. So the strings have an equal number of a's and b's, option (C). The options on odd, even and unequal counts are therefore wrong.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development