Which of the regular expressions given below represent the following DFA? I)…

2014

Which of the regular expressions given below represent the following DFA?

I) 0*1(1+00*1)*

II) 0*1*1+11*0*1

III) (0+1)*1

  1. A.

    I and II only

  2. B.

    I and III only

  3. C.

    II and III only

  4. D.

    I, II, and III

Attempted by 140 students.

Show answer & explanation

Correct answer: B

Key insight: the DFA accepts exactly all non-empty binary strings whose last symbol is 1.

Reasoning about transitions: start state (non-accepting) loops on 0 and moves to the accepting state on 1; the accepting state loops on 1 and moves back to the start on 0. Therefore, after reading any input, the machine is in the accepting state exactly when the last symbol read is 1.

  • Hence the language is all strings that end with 1, which can be written as (0+1)*1.

Check each given regular expression:

  1. Expression I: 0*1(1+00*1)*

    Explanation: 0*1 forces the first occurrence of 1 (so the string ends with at least one 1). Each factor in (1+00*1) either adds a single 1 or adds a block that is some zeros followed by a 1; every piece ends with 1. Any string that ends with 1 can be decomposed into an initial block of zeros (possibly empty) followed by a sequence of chunks each ending in 1, so the expression generates exactly all strings ending with 1. Thus it is equivalent to (0+1)*1.

  2. Expression II: 0*1*1 + 11*0*1

    Explanation: This union does not cover all strings that end with 1. For example, the string 00101 ends with 1 and so is accepted by the DFA and by (0+1)*1, but it is not matched by 0*1*1 + 11*0*1: the first alternative requires all zeros to come before a final run of ones (no zeros between ones), and the second alternative requires the string to begin with 1. Therefore expression II is not equivalent to the DFA language.

  3. Expression III: (0+1)*1

    Explanation: This directly describes all strings whose last symbol is 1, so it matches the DFA language exactly.

Conclusion: Expressions I and III both denote the set of binary strings that end with 1, while expression II does not. Therefore the correct selection is the choice that states I and III only.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir