• edited by
25,801 views
103 103 votes

Consider the following deterministic finite state automaton $M$.

Let $S$ denote the set of seven bit binary strings in which the first, the fourth, and the last bits are $1$. The number of strings in $S$ that are accepted by $M$ is

  1. $1$
  2. $5$
  3. $7$
  4. $8$

9 Answers

Best answer
110 110 votes

Language of above DFA is all strings over $\{0,1\}$ that contain substring $001$.

Regular expression of above DFA is $(0+1)^*00\mathbf{1}(0+1)^*$

$\mathbf{1}$ that is underlined  can not be first bit of $7$-bit binary no, but can be fourth bit or last bit.

Case 1: if it is $4$th bit ,then possible set of strings can be

First $001$ twobits Last   =  $\mathbf{1} 00 \mathbf{1}(00+01+10+11)\mathbf{1} =  4$ strings 

Case 2 : if it is last bit, then possible set of strings can be 

First twobits fourth $001  = \mathbf{1} (00+01+10+11)\mathbf{1} \ 00\mathbf{1} = 4$ strings

String common in both cases $\mathbf{1}00\mathbf{1}00\mathbf{1}$

Total strings $= 4 + 4 - 1 = 7$ strings

Correct Answer: $C$

• edited by
140 140 votes

In this type of question Just write down all the possibilities Speedily and count the correct ones by analyzing the DFA.

See below img .Here we are getting total 7 required Strings.

16 16 votes

We will observe the given bit pattern of 7 bit binary string and then try to make it accept.

Given that D1, D4 and D7 are 1.

We will try different combinations of D2 and D3 and on requirement to get the string accepted by machine we'll adjust the D5 D6 bits.

D1 D2 D3 D4 D5 D6 D7 Remarks
1 0

0

1 X X 1 Case 1
1 0 1 1 0 0 1 Case 2
1 1 0 1 0 0 1 Case 3
1 1 1 1 0 0 1 Case 4

Case 1 : When D2 and D3 are 0 0 : the string starts with 1001 and after that whatever comes will be accepted because 1001 will move to final state. D5 and D6 are marked as Don't Cares as whether they are 0 or 1 it doesn't matter string will get accepted.

So number of combinations for this string?

D5 can take 2 values (0 or 1)

D6 can take 2 values (0 or 1)

total strings for this case which will be accepted : 4

Case 2 : When D2 and D3 are 0  1 : Now D5 and D6 both need to be 0 0 for the string to be accepted.

Number of String for this case - 1

Case 3: When D2 and D3 are 1 0 : Similar to case 2, D5 and D6 both need to be 0 0 for the string to get accepted.

Number of String for this Case : 1

Case 4 : When D2 and D3 are 1 1 : Here also D5 and D6 need to be 0 0 for the string to be accepted.

Number of String for this Case  : 1

Now we have finally exhausted all cases where a 7 bit string can be accepted by this machine M.

Total number of strings :

4+1+1+1=7 Ans(Add up all cases)

3 3 votes
Regular expression : (1+01)*000*1(0+1)*

they ask: 1_ _1 _ _ 1
 
so possiblities are : from regular expression : 00 must be string
                                    
                                   10 0 1 _ _ 1 ------> 1001 (0+1)*  1
                                               0 0
                                               0 1
                                               1 0
                                               1 1

                                 1 _ _ 1 0 0 1 -------> 1 (1+01)* 1001
                                    1 1 1
                                    1 0 1
                                    0 1 1

there for total : 4+3 = 7 string can be possible.
1 1 vote

here you can see there are 4 casses  
case 1) 1 followed by 001--->1001(this takes me to final and after there are four possiblity again and all possiblity will keep me at final

you can see in figure).
case 2 )1followed by 011--->1011 by reading this i will stay at starting  then after only one case that took me to final which is 001

so from here i get one more string which get accepted

case 3) it also gives one valid string
case 4) also gives one valid string 

so totol 7 string are possible.
and you can see in figure

 

Answer:
Position:
Show:

Related questions

61 61 votes
5 answers 5 answers
14.7k
14.7k views
Kathleen asked Sep 17, 2014
14,720 views
A program consists of two modules executed sequentially. Let $f_1(t)$ and $f_2(t)$ respectively denote the probability density functions of time taken to execute the two ...
68 68 votes
8 answers 8 answers
24.0k
24.0k views
Kathleen asked Sep 17, 2014
24,004 views
Consider the NFA $M$ shown below.Let the language accepted by $M$ be $L$. Let $L_1$ be the language accepted by the NFA $M_1$ obtained by changing the accepting state of ...
59 59 votes
6 answers 6 answers
18.7k
18.7k views
Kathleen asked Sep 17, 2014
18,720 views
A single tape Turing Machine $M$ has two states $q0$ and $q1$, of which $q0$ is the starting state. The tape alphabet of $M$ is $\{0, 1, B\}$ and its input alphabet is $\...
89 89 votes
6 answers 6 answers
28.1k
28.1k views
Kathleen asked Sep 17, 2014
28,054 views
Let $G=\left(\left\{S\right\}, \left\{a,b\right\},R,S\right)$ be a context free grammar where the rule set R is $S \to a S b \mid S S \mid \epsilon$Which of the following...