Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | GATE-CS-2009 | Question 60

  • Last Updated : 28 Jun, 2021

The below DFA accepts the set of all strings over {0,1} that


(A) begin either with 0 or 1
(B) end with 0
(C) end with 00
(D) contain the substring 00.

Answer: (C)

Explanation: If the strings beginning with 0 and 1 are 01 and 11 respectively, then the DFA doesn’t accept these( because it doesn’t reach to the final terminating/accepting state). Hence not option A.

If the string ending with 0 is 10, then the DFA doesn’t accept this also. Hence not option B.

If the string which contains substring 00 is 1001, then the DFA doesn’t accept this also. Hence not option D.

Now, take any string which ends with 00, like 00, 100, 1100, 10100, 0100 all are accepted by the given DFA. Hence option C.

Intuitively we can also observe here by looking at the DFA that there is only one direct path to reach the final terminating state C ( lets say given 3 states(circles) are A, B and C from left to right in the diagram ), then the path is A–>B–>C , and this path requires 00 in the current substring of the input to reach from A to C.

Now after reaching C, either the string should terminate to be accepted by the given DFA, or it can also have any number of 0’s following it, for the string to be accepted. In either of the case the string would be ending with 00.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!