Professional Documents
Culture Documents
ACD Course Assignment
ACD Course Assignment
ASSIGNMENT QUESTIONS
Course Name: Automata Theory & Compiler Design Course Code: CS3103
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. Construct a DFA with minimum number of states, accepting all strings over {a,
b} such that the number of a’s is divisible by three and the number of b’s is
divisible by two.
3. Draw a DFA which accepts all strings over {a, b} such that no string has three
consecutive occurrences of the letter b.
4. Design a DFA to recognize all strings over {a,b} such that L={awa : w ϵ {a,b}*}.
5. Design a DFA to accept all strings over {a,b} such that L={aw 1aaw2a : w1 , w2 ϵ
{a,b}* .
6. Design a DFA for Σ = {a, b} that can accept all strings with no more than three
a’s.
7. 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}
8. Consider the set of strings on {0,1}. Design a DFA to accept all strings where
every 00 is followed immediately by a 1.
9. Draw a DFA for all binary strings divisible by 3.
10. Draw a DFA for all binary strings divisible by 2.
11. Suppose Σ = {0, 1, 2}. Draw a DFA for the language L = {w | the sum of digits in
w is divisible by 5}.
12. Draw a DFA for L = {0n1m | m ≥ 1 , n ≥ 0 ; (n + m) is divisible by 3}.
13. 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.
14. Construct a DFA accepting all strings w over Σ = {0, 1} such that the number of
1’s in w is 3 mod 4.
15. Construct a DFA to accept all strings over Σ = {a, b} that ends in bb.
16. Design a DFA to accept all strings over Σ = {a, b} with even number of a’s and
even number of b’s.
17. 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.
c. {an | n is divisible by 2 or 3 or n=5}.
d. The set of all strings over {a, b} beginning and ending with a.
18. Construct a transition system corresponding to the following regular expressions:
23. Write down the steps for Regular expression to finite automata using Thomson’s
construction.
24. Convert FA to Right Linear Regular Grammar:
(a) Consider a Finite automaton (FA) as given below –
25. Convert right linear grammar to left linear grammar for the given regular expression.
RE = a(a+b)*
27. Construct a FSM that recognizes the language generated by the following regular
grammar G:
S → a | aA | bB |
A → aA | aS
B → cS |
28. Construct the regular grammar from FSM.
29. Let L = {(10)p 1q | p, q ∈ N, p ≥ q}. Prove that L is not regular using pumping lemma.
30. Let L = {an bn | n ∈ N, n ≥ 0}. Prove that L is not regular using pumping lemma.
31. What is Context Free Grammar, Derivation Tree ( Parse Tree) , and its types?
Explain with examples.
32. Consider the following grammar-
S → ABC
A→a
B→b
C→c
56. Evaluate the following expression in accordance with the given grammar-
2+3x5x6+2
57. Consider the given grammar-
E→E+T/E–T/T
T→TxF/T÷F/F
F→G↑F/G
G → id
58. Evaluate the following expression in accordance with the given grammar-
2x1+4↑2↑1x1+3
59. Removal of Useless Symbols
T → xxY | xbX | xxT
X → xX
Y → xy | y
Z → xz
60. Remove the ε production from the CFG given below by preserving its meaning.
S → ABA
A → 0A | ε
B → 1B | ε
61. Removing Unit Productions:
S → 0X | 1Y | Z
X → 0S | 00
Y→1|X
Z → 01
62. Convert the given CFG to CNF. Consider the given grammar G:
63. Convert the given CFG to GNF. Consider the given grammar G:
S → XB | AA
A → a | SA
B→b
X→a
64. Design a PDA for accepting a language {anb2n | n>=1}.
65. Design a PDA for accepting a language {0n1m0n | m, n>=1}.
66. Construct a PDA that accepts the language L over {0, 1} by empty stack which
accepts all the string of 0's and 1's in which a number of 0's are twice of
number of 1's.
67. Design NPDA for Palindrome strips.
68. Convert the following grammar to a PDA that accepts the same language.
S → 0S1 | A
A → 1A0 | S | ε
69. Construct PDA for the given CFG, and test whether 010000 is acceptable by this
PDA.
S → 0BB
B → 0S | 1S | 0
71. Q1. Let ‘L’ be the language containing only the string S where:
72. Let L’ be the complement of language ‘L’. Show that whether language L and
L’ are decidable or not.
76. What are countable sets? Show that set of all strings over any finite alphabet
are countable.
77. If a language L and its complement L’ are both recursively enumerable then
show that both languages are recursive. If language L is recursive and L’ is also
recursive, show that both are recursively enumerable.
78. Show that emptiness and infiniteness problem of finite automata is decidable.
80. If two sets S1 and S2 are countable sets, then show that S1 U S2 is countable and
S1 X S2 is also countable.