MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

THEORY OF COMPUTATION

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The language of all words with at least 2 a’s can be described by the regular expression
A
(ab)*a and a (ba)*
B
(a + b)* ab* a (a + b)*
C
b* ab* a (a + b)*
D
all of these
Explanation: 

Detailed explanation-1: -Solution: A string in this language must have at least two a’s. Since any string of b’s can be placed in front of the first a, behind the second a and between the two a’s, and since an arbitrasry string of b’s can be represented by the regular expression b*, b*a b*a b* is a regular expression for this language. Ex.

Detailed explanation-2: -Regular Expressions are an algebraic way to describe languages. Regular Expressions describe exactly the regular languages. If E is a regular expression, then L(E) is the regular language it defines. For each regular expression E, we can create a DFA A such that L(E) = L(A).

Detailed explanation-3: -Language of all those strings having multiple a’s and b’s, Set of strings of a’s and b’s of any length including the null string. So L = , a, b, aa, ab, bb, ba, aaa……..

Detailed explanation-4: -Every string in language is ending with aa. Therefore, it is ending with aa. Hence option 2 is correct.

There is 1 question to complete.