TOC Assignment 01
5th Semester B.TechIT
1) For Σ= {a,b}, construct dfa's that accept the sets consisting of
a) all strings with exactly one a,
b) all strings with at least one a,
c) all strings with no more than three a's,
d) all strings with at least one a and exactly two b’s,
e) all the strings with exactly two a’s and more than two b’s.
2) Give dfa's for the languages
a) L= {ab5wb2: w ∈ {a,b}*},
b) L= {abnam: n ≥ 2,m ≥3},
c) L= {w1abw2: w1 ∈ {a,b}*,w2 ∈ {a,b}*},
d) L= {ban: n ≥ 1,n≠ 5}.
3) Find dfa's for the following languages on Σ = {a,b}.
a) L= {w: |w| mod 3 = 0}.
b) L= {w: |w| mod 5 ≠ 0}.
c) L= {w: na(w) mod 3 > 1}.
d) L= {w: na(w) mod 3 >nb(w)mod 3}.
e) L= {w :(na(w) – nb(w)) mod 3 > 0}.
f) L= {w :(na(w)+2nb(w)) mod 3 < 2}.
g) L= {w: |w| mod 3 = 0, |w| ≠6}.
4) A run in a string is a substring of length at least two, as long as possible and
consisting entirely of the same symbol. For instance, the string abbbaab contains a
run of b's of length three and a run of a's of length two. Find dfa's for the following
languages on {a,b}.
a) L= {w: w contains no runs of length less than four}.
b) L= {w: every run of a’s has length either two or three}.
c) L= {w: there are at most two runs of a’s of length three}.
d) L= {w: there are exactly two runs of a’s of length 3}.
5) Consider the set of strings on {0,1} defined by the requirements below. For each,
construct an accepting dfa.
a) Every 00 is followed immediately by a 1. For example, the strings 101, 0010,
0010011001 are in the language, but 0001 and 00100 are not.
b) All strings containing 00 but not 000.
c) The leftmost symbol differs from the rightmost one.
d) Every substring of four symbols has at most two 0’s. For example, 001110 and
011001 are in the language, but 10010 is not since one of its substrings, 0010,
contains three zeros.
e) All strings of length five or more in which the fourth symbol from the right end is
different from the leftmost symbol.
f) All strings in which the leftmost two symbols and the rightmost two symbols are
identical.
g) All strings of length four or greater in which the leftmost three symbols are the
same, but different from the rightmost symbol.
6) Design an nfa with no more than five states for the set {ababn: n >0}∪{aban: n ≥ 0}.
7) Construct an nfa with three states that accepts the language {ab,abc}*.
8) Find an nfa with three states that accepts the language L={an: n>= 1}∪{bmak : m>=0,
k>=0}
9) Find an nfa with four states for L= {an: n ≥ 0}∪{bna: n ≥ 1}.
10)