MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

THEORY OF COMPUTATION

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The CFG s
A
(a + b)
B
(a + b) (a + b)*
C
C.(a + b) (a + b)
D
None of these
Explanation: 

Detailed explanation-1: -Two regular expressions are equivalent if languages generated by them are same. For example, (a+b*)* and (a+b)* generate same language. Every string which is generated by (a+b*)* is also generated by (a+b)* and vice versa.

Detailed explanation-2: -Regular expressions are equal if and only if they correspond to the same language. Thus for example ( a + b )* = ( a*b* )*, because they both represent the language of all strings over the alphabet a, b.

Detailed explanation-3: -Solution: As we know, any number of a’s means a* any number of b’s means b*, any number of c’s means c*. Since as given in problem statement, b’s appear after a’s and c’s appear after b’s. So the regular expression could be: R = a* b* c*

Detailed explanation-4: -So, a+b means [ab] or a|b, thus (a+b)* means any string of length 0 or more, containing any number of a s and b s in any order. Likewise, (a*b*)* also means any string of length 0 or more, containing any number of a s and b s in any order.

There is 1 question to complete.