Question
Consider the set of strings on {0, 1} in which, every substring of 3 symbols has at most two zeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings of length less than 3 are also in the language. A partially completed DFA that accepts this language is shown below.
The missing arcs in the DFA are
Official answer and solution
- Official answer
- D
- From
- Official GATE 2012 answer key
Solution
Identify the state invariant of the DFA and determine the missing state transitions preventing three consecutive zeros (000).
-
Condition: Every substring of length 3 must contain at most two zeros. That is, the substring
000is forbidden. -
In the DFA, each state tracks the last two characters read:
- State
00: last two characters were00. - State
01: last two characters were01. - State
10: last two characters were10. - State
11: last two characters were11. - State : trap/dead state entered when three consecutive zeros are detected.
- Transition evaluation:
- From state
00: if input is0, three consecutive zeros000occur, transitioning to trap state (so ). If input is1, the last two characters become01(so ). - From state
01: on input1, the last two characters become11(so ). - From state
10: on input0, the last two characters become00(so ). - From state
11: on input0, the last two characters become10(so ).
- Matching with candidate tables:
Table (D) specifies:
- Row
00: column 01 has 1, column has 0 - Row
01: column 11 has 1 - Row
10: column 00 has 0 - Row
11: column 10 has 0
- This confirms option (D).
D
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2012 Computer Science and Information Technology (CS)
- Question
- 46 of 65, printed as CS Q.46
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.