MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The RE (a|b) (a|b) denotes
A
{ab, ab, ba, bb}
B
{aa, ab, ba, bb}
C
{aa, bb, b, a}
D
None of the above
Explanation: 

Detailed explanation-1: -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. In general, it is not easy to see by inspection whether or not two regular expressions are equal.

Detailed explanation-2: -A regular expression is a specific pattern that provides concise and flexible means to match (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. It can also be used to search for hex strings that represent non-ASCII characters.

Detailed explanation-3: -Solution: Since any string of even length can be expressed as the concatenation of strings of length 2 and since the strings of length 2 are aa, ab, ba, bb, a regular expression corresponding to the language is ( aa + ab + ba + bb )*.

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.