assignment-1-2023-2024

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Automata Theory and Compiler Design

ASSIGNMENT -1 Submission Date: 28:12:2023

1. Obtain DFA to accept set of all strings


a. containing 11 as substring over ∑={0,1}
b. containing 101 and 010 as substring over ∑={0,1}
c. strings ending with ab or ba over ∑={a,b}
d. strings that begin with 00 and end with 11 over ∑={0,1}
e. strings containing 11 as substring over ∑={0,1}
f. strings that do not contain 110 as substring over ∑={0,1}
2. Obtain DFA to accept set of all strings beginning with 1 and which when interpreted as a binary
integer is a multiple of 5.
3. Obtain DFA to accept set of all strings such that number of 1’s is even and 0’s are multiple of 3.
4. Draw a DFA to accept the language L={ w | Na(w) ≥1, Nb(w)=2} over ∑={a,b}
5. Design DFA that accepts the language L={w |w is even} over ∑={0,1}
6. Obtain DFA to accept set of all strings that either begins or ends with 01 over ∑={0,1}
7. Draw DFA to accept the language L={w | w has odd number of 1’s followed by even number of
0’s} over ∑={0,1}
8. Obtain DFA to accept language L={w |wϵ(a+b)*; Na(w) mod 3=2, Nb(w)mod 2=1}
9. Obtain DFA to accept the language L={(01)i 12j| i ≥1, j≥1}
10. Obtain DFA to accept the language L={w | |w|mod 5< >0}.
11. Design Non-Deterministic finite automaton for the following languages
a) L = {w ∈ {a - z}* : all five vowels a, e, i o, and u occur in w in alphabetical order.
b) L = {w ∈ {a, b}* : w is made up of an optional a followed by aa followed by zero or more b’s}.
c) L = {w ∈{a, b}* : w = aba or |w| is even}.
d) L = {w ∈ {a, b, c}* : x, y ∈{a, b, c}* (w = x abcabb y)}.
e) L = {w ∈ {a, b}* : the fourth to the last character is a}
f) ∑={a, b, c, d}, L = { w : there is a symbol a1 ∈ ∑ not appearing in w}.
g) L={ w ∈{0,1}*: w=either 101 or 110 as substring}
h) L={ w ∈{0,1}*: such that every 1 is followed immediately by 00}
i) L={ w ∈{0,1}*: such that w contain exactly two occurrences of 10}
j) Obtain an NFA to accept the following language L = {w | w ϵ ababn or aban where n≥0}
k) Obtain an NFA which accepts strings of a’s and b’s starting with the string ab.

12. Construct an NFA that searches for the words web and e-bay. Convert the same into an
equivalent DFA
13. Consider the following Ɛ-NFA:
Ɛ a b
p r q p,r
q ø p ø
*r p,q r p
a) Compute Ɛ-closure of each state.
b) Convert the automaton to DFA
14. What is the minimized DFA for the following ∂ a b
A B A
B A C
C D B
*D D A
E D F
F G E
G F G
H G D
15. Minimize the following DFA

16. Write Regular expression for the following


a. L = { an bm : m, n are even}
b. L = { an,bm : m>=2,n>=2}.
c. L={w: |w| mod 3=0}
d. L = { an b2n | n>=0}
e. Strings of a’s and b’s having two consecutive a’s
f. Strings of a’s and b’s whose 3rd symbol from right end is a
g. L = { a2n b2m+1 | n>=0,m>=0}
17. Conver the following to RE

18. Convert following RE’s into FSM’s


a. (ab*)* b. (a U b)* c. a*U b* d. (aUb)ab

19. What are the various phases of compilers? Explain each phase in detail. Mention the input and
output for each phase. Write down the output of each phase for the expression “position = initial
+rate*60”.

You might also like