Which of the following statements is true for the given Regular Expression?…

2025

Which of the following statements is true for the given Regular Expression?

(a+b)*b(a+b)^4

  1. A.

    The set of strings containing ab as a substring

  2. B.

    The set of strings whose length is divisible by 6

  3. C.

    The set of strings having at most one pair of consecutive a’s and at most one pair of consecutive b’s

  4. D.

    The set of strings whose 5th symbol from the end is b

Attempted by 25 students.

Show answer & explanation

Correct answer: D

The regular expression requires a 'b' at the fifth position from the end of any matched string. The suffix (a+b)^4 consumes exactly four characters, ensuring the preceding 'b' is fixed relative to the string's end. This structural constraint defines the language accepted by this pattern.

Explore the full course: Mppsc Assistant Professor