in Theory of Computation edited by
20,722 views
57 votes
57 votes

Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive $0$'s and two consecutive $1$'s?

  1. $(0+1 )^ *0011 (0+1)^* +(0+1)^*1100(0+1)^*$
  2. $(0+1)^* (00(0+1)^*11+11(0+1)^*00)(0+1)^*$
  3. $(0+1)^*00(0+1)^* + (0+1)^*11 (0+1)^*$
  4. $00(0+1)^*11 +11(0+1)^*00$
in Theory of Computation edited by
20.7k views

4 Comments

thanks bro
0
0

@GovindYadav29 don’t forget the last (0+1)*. At last it can generate 00 by having prefix as 0011.

0
0
A . The set of string that contains 0011 or 1100 as a substring 
B  The set of string that contains either both 00 and11 OR 11 and 00 as a substring
C  The set of strings that contains only 00 OR 11 as a substring 
D the set of strings that start with 00 and end with 11 OR start with 11 and end with 00
1
1

4 Answers

129 votes
129 votes
Best answer

Set of all binary strings having two consecutive $0$s and two consecutive $1$s 

Anything $00$  Anything $11$Anything  + Anything $11$ Anything $00$ Anything

$(0+1)^*00(0+1)^*11(0+1)^*+(0+1)^*11(0+1)^*00(0+1)^*$

And it is same after taking common. 

$(0+1)^*(00(0+1)^*11 +11(0+1)^*00)(0+1)^*$

So, option B is answer.

Neither they said Both are immediate nor they give a predefined order, so it should be as above

edited by

4 Comments

It will not accept any string starting with 01 or 10 . E.g. '010011'
0
0
Is 0101001111 a valid string for the given question?
0
0

Yes.  0101001111

0
0
8 votes
8 votes
  1. $(0+1 )^ *0011 (0+1)^* +(0+1)^*1100(0+1)^*$  $\rightarrow$ Strings containing $0011$ or $1100$ as a substring.
  2. $(0+1)^* (00(0+1)^*11+11(0+1)^*00)(0+1)^*$  $\rightarrow$ Strings having two consecutive $0$s AND $1$s
  3. $(0+1)^*00(0+1)^* + (0+1)^*11 (0+1)^*$  $\rightarrow$ Strings having two consecutive $0$s OR $1$s
  4. $00(0+1)^*11 +11(0+1)^*00$ $\rightarrow$ Strings starting with $00$ and ending with $11$ or vice versa.

Option $B.$ is correct.

5 Comments

why not option A ??

If the qsn is meant for atleast.
0
0
option A is incorrect because we do not want $00$ and $11$ combined. We can't generate $110100$ using it which is a valid string.
1
1
How will you generate 101001110 using option B?
0
0
edited by

@,@,@,@

How option B generate 100101101?

0
0
$1$ from $(0+1)^*$

$    00 \    10\     11$  from  $00(0+1)^*11$

$01$ from  the last $(0+1)^*$
0
0
2 votes
2 votes
Option A doesn’t generate string “001011” as it has two consecutive 0’s and two consecutive 1’s.
Option C generates string “00” which doesn’t have two consecutive 1’s.
Option D doesn’t generate string “00110” which has two consecutive 0’s and two consecutive 1’s.
0 votes
0 votes
option a tells us about immediate concustive eg 0011 or 1100 ,it is accepted but not part of a language, option c says only about language such 001000 or 1101010 but not 00110011 so not c . option d cannot accept 10011 or 01100 so b is correct
Answer:

Related questions