100% found this document useful (10 votes)
109K views12 pages

DFA Solved Examples

The document provides 37 examples of Deterministic Finite Automata (DFA) with their corresponding solutions. The examples cover a range of languages over the alphabet {0,1}, including languages defined by prefixes, suffixes, substrings, and counts of symbols. For each example, a DFA is given to accept strings matching the defined language.

Uploaded by

Laiba Babar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (10 votes)
109K views12 pages

DFA Solved Examples

The document provides 37 examples of Deterministic Finite Automata (DFA) with their corresponding solutions. The examples cover a range of languages over the alphabet {0,1}, including languages defined by prefixes, suffixes, substrings, and counts of symbols. For each example, a DFA is given to accept strings matching the defined language.

Uploaded by

Laiba Babar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Example 2 - DFA for Strings Ending with '1': Describes a DFA accepting strings that end with '1'.
  • Example 1 - DFA for Strings Ending with '0': Illustrates a DFA for the language accepting strings that end with '0'.
  • Example 3 - DFA for Strings Ending with '01': Explains constructing a DFA for strings ending with '01'.
  • Example 5 - DFA for Strings Ending with '0110': Displays a DFA for strings ending with '0110'.
  • Example 7 - DFA for Strings Ending with '0': Provides a DFA for strings ending with '0'.
  • Example 6 - DFA for Strings Ending with '0011': Details a DFA for strings ending with '0011'.
  • Example 8 - DFA for Strings Containing '0' and '1': Demonstrates a DFA accepting strings only containing '0' and '1'.
  • Example 10 - DFA for Strings Starting with '01': Explores a DFA for strings starting with '01'.
  • Example 9 - DFA for Strings Starting with '0': Creates a DFA for strings starting with '0'.
  • Example 13 - DFA for Strings Starting with '0110': Presents a DFA for strings starting with '0110'.
  • Example 12 - DFA for Strings Starting with '011': Illustrates a DFA for strings starting with '011'.
  • Example 11 - DFA for Strings Starting with '00': Shows a DFA for strings starting with '00'.
  • Example 14 - DFA for Strings Starting with '0011': Describes a DFA for strings starting with '0011'.
  • Example 15 - DFA for Strings Starting with '00' or '11': Defines a DFA for strings starting with '00' or '11'.
  • Example 16 - DFA for Strings Containing Even Binary Numbers: Explains a DFA for strings containing even binary numbers.
  • Example 19 - DFA for Even or Odd Binary Numbers: Illustrates a DFA accepting even and odd binary numbers.
  • Example 18 - DFA for Odd Binary Numbers: Outlines a DFA for strings with odd binary numbers.
  • Example 20 - DFA for Even Total Zeros: Provides a DFA for strings with an even number of total zeros.
  • Example 21 - DFA for Different Start and End Characters: Explores a DFA for strings starting and ending with different characters.
  • Example 22 - DFA for Same Start and End Characters: Shows a DFA for strings starting and ending with the same character.
  • Example 23 - DFA for Strings Starting and Ending with '0': Explains a DFA for strings starting and ending with '0'.
  • Example 24 - DFA for Three Consecutive '0's: Constructs a DFA for strings containing three consecutive '0's.
  • Example 25 - DFA for Strings '0' Preceded by '1': Details a DFA for strings where '0' is preceded by '1'.
  • Example 29 - DFA with '011' as Substring: Defines a DFA for strings containing '011' as a substring.
  • Example 28 - DFA for Exactly Two '0's: Presents a DFA for strings with exactly two '0's.
  • Example 27 - DFA for At Least Two '0's: Illustrates a DFA for strings with at least two '0's.
  • Example 32 - DFA After Last '1': Illustrates a DFA that processes any string after the last '1'.
  • Example 30 - DFA Ending with '01' or '10': Shows a DFA for strings ending in '01' or '10'.
  • Example 31 - DFA Containing '01' or '10': Explains a DFA for strings containing '01' or '10' as substring.
  • Example 33 - DFA for Even 'a's and 'b's: Constructs a DFA for strings with even numbers of 'a's and 'b's.

DFA solved examples

Example 1: Draw a DFA for the language accepting strings ending with ‘0’ over
input alphabets ∑={0, 1} ?
Solution:

Example 2: Draw a DFA for the language accepting strings ending with ‘01’ over
input alphabets ∑={0, 1} ?
Solution:

Example 3: Draw a DFA for the language accepting strings ending with ‘00’ over
input alphabets ∑={0, 1} ?
Solution:

Example 4: Draw a DFA for the language accepting strings ending with ‘011’ over
input alphabets ∑ = {0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 5: Draw a DFA for the language accepting strings ending with ‘0110’ over
input alphabets ∑ = {0, 1} ?
Solution:

Example 6: Draw a DFA for the language accepting strings ending with ‘0011’ over
input alphabets ∑ = {0, 1} ?
Solution:

Example 7: Draw a DFA for the language accepting strings with ‘0’ only over input
alphabets ∑={0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 8: Draw a DFA for the language accepting strings with ‘0’ and ‘1’ only
over input alphabets ∑={0, 1} ?
Solution:

Example 9: Draw a DFA for the language accepting strings starting with ‘0’ over
input alphabets ∑={0, 1} ?
Solution:

Example 10: Draw a DFA for the language accepting strings starting with ‘01’ over
input alphabets ∑={0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 11: Draw a DFA for the language accepting strings starting with ‘00’ over
input alphabets ∑={0, 1} ?
Solution:

Example 12: Draw a DFA for the language accepting strings starting with ‘011’
over input alphabets ∑ = {0, 1} ?
Solution:

Example 13: Draw a DFA for the language accepting strings starting with ‘0110’
over input alphabets ∑ = {0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 14: Draw a DFA for the language accepting strings starting with ‘0011’
over input alphabets ∑ = {0, 1} ?
Solution:

Example 15: Draw a DFA for the language accepting strings starting with ‘00’ or
’11’ over input alphabets ∑ = {0, 1} ?
Solution:

Example 16: Draw a DFA for the language accepting strings without substring ‘00’
over input alphabets ∑ = {0, 1} ?
Solution:

Example 17: Draw a DFA for the language accepting even binary numbers strings
over input alphabets ∑ = {0, 1} ?
Soluntion:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 18: Draw a DFA for the language accepting odd binary numbers strings
over input alphabets ∑ = {0, 1} ?
Solution:

Example 19: Draw a DFA for the language accepting odd or even binary numbers
strings over input alphabets ∑ = {0, 1} ?
Solution:

Example 20: Draw a DFA for the language accepting strings containg even number
of total zeros over input alphabets ∑ = {0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 21: Draw a DFA for the language accepting strings starting and ending
with different characters over input alphabets ∑ = {0, 1} ?
Soluiton:

Example 22: Draw a DFA for the language accepting strings starting and ending
with same character over input alphabets ∑ = {0, 1} ?
Solution:

Example 23: Draw a DFA for the language accepting strings starting and ending
with ‘0’ always over input alphabets ∑ = {0, 1} ?

EasyExamNotes.com DFA solved examples


DFA solved examples

Solution:

Example 24: Draw a DFA for the language accepting strings containing three
consecutives ‘0’ always over input alphabets ∑ = {0, 1} ?
Solution:

Example 25: Draw a DFA for the language accepting strings such that each ‘0’ is
immediately preceded and followed by ‘1’ over input alphabets ∑ = {0, 1} ?
Solution:

Example 26: Draw a DFA for the language accepting strings containing at most two
‘0’ over input alphabets ∑ = {0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 27: Draw a DFA for the language accepting strings containing at least two
‘0’ over input alphabets ∑ = {0, 1} ?
Solution:

Example 28: Draw a DFA for the language accepting strings containing exactly two
‘0’ over input alphabets ∑ = {0, 1} ?
Solution:

Example 29: Draw a DFA for the language accepting strings with ‘011’ as substring
over input alphabets ∑ = {0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 30: Draw a DFA for the language accepting strings ending in either ’01’,
or ’10’ over input alphabets ∑ = {0, 1} ?
Solution:

Example 31: Draw a DFA for the language accepting strings containing ’01’, or ’10’
as substring over input alphabets ∑ = {0, 1} ?
Solution:

Example 32: Draw DFA that accepts any string which ends with 1 or it ends with an
even number of 0’s following the last 1. Alphabets are {0,1}.
Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 33: Construct DFA accepting set of all strings containing even no. of a’s
and even no. of b’s over input alphabet {a,b}.
Solution:

Example 34: Give DFA accepting the language over alphabet {0,1} such that all
strings of 0 and 1 ending in 101.
Solution:

Example 35: Construct DFA for anb | n>=0.


Solution:

Example 36: construct DFA for binary integer divisible by 3 ?


Solution:

EasyExamNotes.com DFA solved examples


DFA solved examples

Example 37: Draw a DFA for the language accepting strings containing neither
’00’, nor ’11’ as substring over input alphabets ∑ = {0, 1} ?
Solution:

EasyExamNotes.com DFA solved examples

(https://i0.wp.com/lh3.googleusercontent.com/-DZWAjHa6SPs/X5vsUiIB2fI/AAAAAAAAGjY/VXpqIPVyuX04MsOlqs8KjfU5EaN5wKslwCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-0Gl-26obkzM/X5rDiDomgJI/AAAAAAAAGdc/MPKJWgW40ucUiFhngoWtXnyTC7X5KB1ewCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-VzMji1XFbEA/X5rHgGJTbOI/AAAAAAAAGeI/g9GOfACg2bs8cc7YWOX915CU5DwpuAC4wCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-iwPVuH-bsTA/X5rrUHEaxgI/AAAAAAAAGes/5Z1OBcm5yTAZodFMNjQ9MCX0oCUKq4z2QCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-aTHc2EcOqRY/X5rvuT6CrwI/AAAAAAAAGfY/CiNnrfKEmhI0qJFgW1i7GjD3LPdSqZ95QCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-ly8J1rI6apQ/X5r0CuGHTbI/AAAAAAAAGf4/NW2bAz8rZ_8VM5WCfV2pVnhHM2Ul4U6AgCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-41n8L4Tp5RE/X5r2CFrXkhI/AAAAAAAAGgU/9gevE8BmNvkq-G0MNzO6EKYpYWxQ11QHQCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-lv7ATPT-QPA/X5r57pudSVI/AAAAAAAAGg4/1s2fY3fCi0wdmQKn9eUpapTJcNYH6SrAQCLcBGAsYH
(https://i0.wp.com/lh3.googleusercontent.com/-sfZ3nInH_cA/X5r8ym9l-OI/AAAAAAAAGhg/HJVb4mlYx141TNLb13AylqfM8a5oF3yGwCLcBGAsYH
(https://i0.wp.com/1.bp.blogspot.com/-fA3ZMj0qOlU/X4DTcaCrHCI/AAAAAAAAGY8/6g0rAzT2E0QPUxZFAoAcJh-oo6oPegdoQCLcBGAsYHQ/s512/i

You might also like