MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
ab* in a regular expression denotes
A
zero or more occurrences of a and b
B
zero or more occurrences of a or b
C
one or more occurrences of a and b
D
letter a followed by zero or more occurrences of b
Explanation: 

Detailed explanation-1: -Save this answer. Show activity on this post. In normal regular expression grammar, (a+b)* means zero or more of any sequence that start with a, then have zero or more a, then a b .

Detailed explanation-2: -The * is an occurrence indicator representing zero or more occurrences. Together, [1-9][0-9]* matches any numbers without a leading zero. | represents the OR operator; which is used to include the number 0 . This expression matches “ 0 “ and “ 123 “; but does not match “ 000 “ and “ 0123 “ (but see below).

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*

There is 1 question to complete.