DFA Examples
There are many DFA Examples are as given. But you make sure that you have already read or covered the topic of Deterministic Finite Automata (DFA) in TOC. So, different examples of DFA are as follow.
DFA Example: 01
Draw a DFA which accept only input string “a”
Over input alphabets Σ = {a,b,c}

At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
At State q1
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
At State q2
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {a,b,c}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 02
Draw a DFA which accept only input string “b”
Over input alphabets Σ = {a,b,c,d}

At State q0
- For Input b: Transition goes to q1.
- For Input a: Transition goes to q2.
- For Input c: Transition goes to q2.
- For Input d: Transition goes to q2.
At State q1
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
- For Input d: Transition goes to q2.
At State q2
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
- For Input d: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {a,b,c,d}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 03
Draw a DFA which accept only input string “c”
Over input alphabets Σ = {a,b,c,d}

At State q0
- For Input c: Transition goes to q1.
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input d: Transition goes to q2.
At State q1
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
- For Input d: Transition goes to q2.
At State q2
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
- For Input d: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {a,b,c,d}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 04
Draw a DFA which accept only input string “1”
Over input alphabets Σ = {0,1}
At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q2.
At State q1
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q2.
At State q2
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 05
Draw a DFA which accept only input string “10”
Over input alphabets Σ = {0,1}

At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q3.
At State q1
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q3.
At State q2
- For Input 0: Transition goes to q3.
- For Input 1: Transition goes to q3.
At State q3
- For Input 0: Transition goes to q3.
- For Input 1: Transition goes to q3.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q2
- Dead State = q3
So, DFA Transition Table are also given.

DFA Example: 06
Draw a DFA which accept only input string “1110”
Over input alphabets Σ = {0,1}

At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q5.
At State q1
- For Input 1: Transition goes to q2.
- For Input 0: Transition goes to q5.
At State q2
- For Input 1: Transition goes to q3.
- For Input 0: Transition goes to q5.
At State q3
- For Input 0: Transition goes to q4.
- For Input 1: Transition goes to q5.
At State q4
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q5.
At State q5
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q5.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3,q4,q5}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q4
- Dead State = q5
So, DFA Transition Table are also given.

DFA Example: 07
Draw a DFA which accept only input string “bc”
Over input alphabets Σ = {a,b,c}

At State q0
- For Input b: Transition goes to q1.
- For Input a: Transition goes to q3.
- For Input c: Transition goes to q3.
At State q1
- For Input c: Transition goes to q2.
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q3.
At State q2
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q3.
- For Input c: Transition goes to q3.
At State q3
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q3.
- For Input c: Transition goes to q3.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3}
- Input Alphabet = {a,b,c}
- Initial State = q0
- Final State = q2
- Dead State = q3
So, DFA Transition Table are also given.

DFA Example: 08
Draw a DFA which accept only input string “ab”
Over input alphabets Σ = {a,b

At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q3.
At State q1
- For Input b: Transition goes to q2.
- For Input a: Transition goes to q3.
At State q2
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q3.
At State q3
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q3.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3}
- Input Alphabet = {a,b}
- Initial State = q0
- Final State = q2
- Dead State = q3
So, DFA Transition Table are also given.

DFA Example: 09
Draw a DFA which accept only input string “abb”
Over input alphabets Σ = {a,b}

At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q4.
At State q1
- For Input b: Transition goes to q2.
- For Input a: Transition goes to q4.
At State q2
- For Input b: Transition goes to q3.
- For Input a: Transition goes to q4.
At State q3
- For Input a: Transition goes to q4.
- For Input b: Transition goes to q4.
At State q4
- For Input a: Transition goes to q4.
- For Input b: Transition goes to q4.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3,q4}
- Input Alphabet = {a,b}
- Initial State = q0
- Final State = q3
- Dead State = q4
So, DFA Transition Table are also given.

DFA Example: 10
Draw a DFA which accept only input string “1010”
Over input alphabets Σ = {0,1}

At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q5.
At State q1
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q5.
At State q2
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q3.
At State q3
- For Input 0: Transition goes to q4.
- For Input 1: Transition goes to q5.
At State q4
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q5.
At State q5
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q5.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3,q4,q5}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q4
- Dead State = q5
So, DFA Transition Table are also given.

DFA Example: 11
Draw a DFA which accept only input string “0101”
Over input alphabets Σ = {0,1}

At State q0
- For Input 0: Transition goes to q1.
- For Input 1: Transition goes to q5.
At State q1
- For Input 1: Transition goes to q2.
- For Input 0: Transition goes to q5.
At State q2
- For Input 0: Transition goes to q3.
- For Input 1: Transition goes to q5.
At State q3
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q4.
At State q4
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q5.
At State q5
- For Input 0: Transition goes to q5.
- For Input 1: Transition goes to q5.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3,q4,q5}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q4
- Dead State = q5
So, DFA Transition Table are also given.

DFA Example: 12
Draw a DFA which accept only input string “11101”
Over input alphabets Σ = {0,1}

At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q6.
At State q1
- For Input 1: Transition goes to q2.
- For Input 0: Transition goes to q6.
At State q2
- For Input 1: Transition goes to q3.
- For Input 0: Transition goes to q6.
At State q3
- For Input 0: Transition goes to q4.
- For Input 1: Transition goes to q6.
At State q4
- For Input 0: Transition goes to q6.
- For Input 1: Transition goes to q5.
At State q5
- For Input 0: Transition goes to q6.
- For Input 1: Transition goes to q6.
At State q6
- For Input 0: Transition goes to q6.
- For Input 1: Transition goes to q6.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3,q4,q5,q6}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q5
- Dead State = q6
So, DFA Transition Table are also given.

DFA Example: 13
Draw a DFA which accept only input string “a(a+b)*”
Over input alphabets Σ = {a,b}

At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q2.
At State q1
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q1.
At State q2
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {a,b}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 14
Draw a DFA which accept only input string “b(b+a)*”
Over input alphabets Σ = {a,b}

At State q0
- For Input b: Transition goes to q1.
- For Input a: Transition goes to q2.
At State q1
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q1.
At State q2
- For Input a: Transition goes to q2.
- For Input b: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {a,b}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 15
Draw a DFA which accept only input string “a(a+b)*a”
Over input alphabets Σ = {a,b}

At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q3.
At State q1
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q2.
At State q2
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q2.
At State q3
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q3.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3}
- Input Alphabet = {a,b,c,d}
- Initial State = q0
- Final State = q1
- Dead State or Trap State = q3
So, DFA Transition Table are also given.

DFA Example: 16
Draw a DFA which accept only input string “1(1+0)*”
Over input alphabets Σ = {0,1}

At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q2.
At State q1
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q1.
At State q2
- For Input 1: Transition goes to q2.
- For Input 0: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 17
Draw a DFA which accept only input string “0(0+1)*”
Over input alphabets Σ = {0,1}

At State q0
- For Input 0: Transition goes to q1.
- For Input 1: Transition goes to q2.
At State q1
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q2.
At State q2
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q2.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q1
- Dead State = q2
So, DFA Transition Table are also given.

DFA Example: 18
Draw a DFA which accept only input string “1(1+0)*1”
Over input alphabets Σ = {0,1}

At State q0
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q3.
At State q1
- For Input 1: Transition goes to q1.
- For Input 0: Transition goes to q2.
At State q2
- For Input 0: Transition goes to q2.
- For Input 1: Transition goes to q1.
At State q3
- For Input 0: Transition goes to q3.
- For Input 1: Transition goes to q3.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3}
- Input Alphabet = {0,1}
- Initial State = q0
- Final State = q1
- Dead State or Trap State = q3
So, DFA Transition Table are also given.

DFA Example: 19
Draw a DFA which accept only input string “abacba”
Over input alphabets Σ = {a,b,c}

At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q7.
- For Input c: Transition goes to q7.
At State q1
- For Input b: Transition goes to q2.
- For Input c: Transition goes to q2.
- For Input a: Transition goes to q7.
At State q2
- For Input a: Transition goes to q3.
- For Input b: Transition goes to q7.
- For Input c: Transition goes to q7.
At State q3
- For Input c: Transition goes to q4.
- For Input a: Transition goes to q7.
- For Input b: Transition goes to q7.
At State q4
- For Input b: Transition goes to q5.
- For Input a: Transition goes to q7.
- For Input c: Transition goes to q7.
At State q5
- For Input a: Transition goes to q6.
- For Input b: Transition goes to q7.
- For Input c: Transition goes to q7.
At State q6
- For Input a: Transition goes to q7.
- For Input b: Transition goes to q7.
- For Input c: Transition goes to q7.
At State q7
- For Input a: Transition goes to q7.
- For Input b: Transition goes to q7.
- For Input c: Transition goes to q7.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q4,q5,q6,q7}
- Input Alphabet = {a,b,c}
- Initial State = q0
- Final State = q6
- Dead State = q7
So, DFA Transition Table are also given.

DFA Example: 20
Draw a DFA which accept only input string “abcd”
Over input alphabets Σ = {a,b,c,d,e}
At State q0
- For Input a: Transition goes to q1.
- For Input b: Transition goes to q5.
- For Input c: Transition goes to q5.
- For Input d: Transition goes to q5.
- For Input e: Transition goes to q5.
At State q1
- For Input b: Transition goes to q2.
- For Input a: Transition goes to q5.
- For Input c: Transition goes to q5.
- For Input d: Transition goes to q5.
- For Input e: Transition goes to q5.
At State q2
- For Input c: Transition goes to q3.
- For Input a: Transition goes to q5.
- For Input b: Transition goes to q5.
- For Input d: Transition goes to q5.
- For Input e: Transition goes to q5.
At State q3
- For Input d: Transition goes to q4.
- For Input a: Transition goes to q5.
- For Input b: Transition goes to q5.
- For Input c: Transition goes to q5.
- For Input e: Transition goes to q5.
At State q4
- For Input a: Transition goes to q5.
- For Input b: Transition goes to q5.
- For Input c: Transition goes to q5.
- For Input d: Transition goes to q5.
- For Input e: Transition goes to q5.
At State q5
- For Input a: Transition goes to q5.
- For Input b: Transition goes to q5.
- For Input c: Transition goes to q5.
- For Input d: Transition goes to q5.
- For Input e: Transition goes to q5.
Explanation:
Hence, the more explanation of the above DFA are as given.
- States = {q0,q1,q2,q3,q4,q5}
- Input Alphabet = {a,b,c,d,e}
- Initial State = q0
- Final State = q4
- Dead State = q5
So, DFA Transition Table are also given.


