Automata Assignment-1
Automata Assignment-1
Course Name: Automata Theory & Compiler Design Course Code: IT3202
1. Construct a DFA with minimum number of states, accepting all strings over {a,
b} such that the number of a’s is divisible by two and the number of b’s is
divisible by three.
2. Draw a DFA which accepts all strings over {a, b} such that no string has three
consecutive occurrences of the letter b.
3. Design a DFA to recognize all strings over {a,b} such that L={awa : w ϵ {a,b}*}.
4. Design a DFA for Σ = {a, b} that can accept all strings with no more than three
a’s.
5. Find DFA for the following languages on Σ = {a, b}:
a. L = {w : |w| mod 3 = 0
b. L = {w : na(w) mod 3 > nb(w) mod 3}
6. Consider the set of strings on {0,1}. Design a DFA to accept all strings where
every 00 is followed immediately by a 1.
7. Suppose Σ = {0, 1, 2}. Draw a DFA for the language L = {w | the sum of digits in
w is divisible by 5}.
8. Draw a DFA for L = {0n1m | m ≥ 1 , n ≥ 0 ; (n + m) is divisible by 3}.
9. Suppose Σ = {a, b}. Find a DFA for the set of strings w such that the number of
occurrences of the substring ab in w equals the number of occurrences of the
substring ba in w.
10. Construct a DFA accepting all strings w over Σ = {0, 1} such that the number of
1’s in w is 3 mod 4.
11. Represent the following sets by regular expression:
a. {12n+1 | n>0
b. {The set of all strings over {0,1} which has at most two zeros.
12. Construct a transition system corresponding to the following regular expressions:
a. (ab + c*)*b b. a + bb + bab*a
c. (ab + a)*(aa + b) d. (a*b + b*a)*a
13. Find the regular expressions representing the following sets:
a. The set of all strings over {0,1} having at most one pair of 0’s or at most one
pair of 1’s.
b. The set of all strings over {a,b} in which the number of occurrences of a is
divisible by 3.
c. The set of all strings over {a,b} in which there are at least two occurrences
of b between any two occurrences of a.
d. The set of all strings over {a,b} with three consecutive b’s.
14. Prove the following:
a. (0*1*)* = (0 + 1)*
b. (ab)* ≠ (a*b*)
c. (r + s)* ≠ r* + s*
d. λ + 1*(011)*(1*(011)*)* = (1 + 011)*
15. Construct R.E. using Arden’s theorem from the following FA’s:
a.
a B
→q1 q1 q2
*q2 q3 q2
q3 φ φ
b.
0 1
→* q1 q2
q1
q2 q3 q2
q3 q1 q2
16. Consider the grammar-
S → bB / aA
A → b / bS / aAA
B → a / aS / bBB
25. Convert the given CFG to CNF. Consider the given grammar G:
S → a | aA | B
A → aBB | ε
B → Aa | b