Current Affairs Monthly Magazine -Subscribe Now!
900 GEOGRAPHY MCQS | EBook
1000 BIOLOGY MCQS AND ANSWERS | EBook
1000 POLITICAL SCIENCE MCQS | EBook
1000 ECONOMICS MCQS FOR EXAMS | EBook
Mughal Empire MCQs | EBook
ECONOMIC GEOGRAPHY MCQs | EBook
350 MCQs ON INDIAN CONSTITUTION | EBook
GENERAL AWARENESS COMBO (6 EBOOKS)

Question

The following CFG

     S → aB | bA

     A → b | aS | bAA

     B → b | bS | aBB

generates strings of terminals that have

A equal number of a’s and b’s
B odd number of a’s and odd number b’s
C even number of a’s and even number of b’s
D odd number a’s and even number of a’s
Answer & Explanation
Option: [A]

We have S → aB → aaBB → aabB → aabb

So (b) is wrong. We have

S → aB → ab

So (c) is wrong.

A careful observation of the productions will reveal a similarity. Change A to B, B to A, a to b and b to a. The new set of productions will be the same as the original set. So (d) is false and (a) is the correct answer.

General Knowledge

Month-wise Current Affairs 2022

Category-wise Current Affairs

Jobs by Qualification

Free Mock Test