Question
Consider the following language.
Which one of the following deterministic finite automata accepts ?
Official answer and solution
- Official answer
- D
- From
- Official GATE 2021 answer key
Solution
Construct the state transitions of the minimal DFA that detects the pattern 011 at the end of the input string.
The language consists of all binary strings ending in . The minimal DFA requires 4 states corresponding to the longest matched prefix of that appears as a suffix of the input read so far:
- State (start state): suffix
- State : suffix ending in
- State : suffix ending in
- State (accept state): suffix ending in
Verify the transitions:
- From : on 0 go to ; on 1 stay in .
- From : on 0 stay in (suffix is still 0); on 1 go to (suffix is 01).
- From : on 0 go to (suffix 010 ends in 0); on 1 go to (suffix is 011).
- From : on 0 go to (suffix 0110 ends in 0); on 1 go to (suffix 0111 has no overlap with 011, so it resets to ).
DFA diagram D faithfully implements these transitions with as the sole accepting state.
D
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology (CS, Set-1)
- Question
- 48 of 65, printed as CS Q.38
- 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.