MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Regular expression for all strings starts with ab and ends with bba is.
A
aba*b*bba
B
ab(ab)*bba
C
ab(a+b)*bba
D
All of the mentioned
Explanation: 

Detailed explanation-1: -11. Regular expression for all strings starts with ab and ends with bba is. Explanation: Starts with ab then any number of a or b and ends with bba. 12.

Detailed explanation-2: -*b$’ will match all strings ending with a ‘b’.

Detailed explanation-3: -The set of all strings over that contain exactly 2 b’s is denoted by the regular expression a∗ba∗ba∗. The set of all strings over that contain exactly 3 b’s is denoted by the regular expression a∗ba∗ba∗ba∗. L is denoted by the regular expression a∗ba∗ba∗ + a∗ba∗ba∗ba∗.

Detailed explanation-4: -Example strings = aaba, aaaba, aabba, aaabba, aababa, ………and all other strings that can start with aa and end with ba.

Detailed explanation-5: -Detailed Solution string ‘b’ is accepted by regular expression (a, ba)* b which is not ending with aa. Therefore, it is not ending with aa. L = aa, aaa, baa, aaaa, abaa, baaa, bbaa … Every string in language is ending with aa.

There is 1 question to complete.