1. Language L on ={a,b} is defined as L={w : na(w) mod 3 =1}.
a) Write all words of size 4 in L.
b) Find a DFA that accepts L.
c) Find a right-linear regular grammar of language L.
answer:
a. L={abbb, babb, bbab, bbba, aaaa}
b.
b
b
q
a
q
1
0
a
c. S bS | a A
A bA|aB| λ
BbB | aS
b
a
q
2
2. For regular language L=(ba*)+(ab*a*)
a. Construct NFA that accepts L.
b.
Construct DFA from the previous NFA that accepts L.(with the minimal
number of states)
answer:
a.
a
q
2
b
q
0
a
b
a
a
q
q
3
4
b.
a
q
2
b
b
T
q
0
a
b
a
b
a
q
q
3
4
a,b
3. Find an NFA with three states that accepts the language
L={an : n 1}{ bmak : m 0, k 0} .
answer:
a
a
{an : n 1}
q
q
0
1
b
a
a
q
q
0
1
{ bmak : m 0, k 0}
NFA:
a
a
λ
q
q
1
2
q
0
λ
b
a
a
q
q
3
4
NFA with three states:
a
q
1
a
a
q
0
λ
q
2
b
4. Let L1=(a*b*a) and L2 = (ab*a*)
a/ Find NFAs accepting languages L1 and L2.
b/ Find a DFA accepting language L=L1L2.
answer:
a.
a
b
λ
(a*b*a)
a
Q
0
P
R
1
2
0
b
U
(ab*a*)
a
0
a
a
V
W
1
2
b.
a
a
b
a
b
a,b
b
a
a, b
DFA (L1L2)
5. Determine whether the language L={a2nbm|n>=0,m>=0} is regular or not.
answer:
L={λ,aa,b,aab,aabb,aaaabb,……..}
a
q
a
1
q
1
b
q
2
b
the grammar :
q0aq1| bq2
q1aq0|λ
q2bq2|λ
there is a finite automata exist
the language is regular
6. Determine whether the language L={bnak|n>k} is regular or not.
answer:
n>k
let n = k+1
w = bk+1ak
Let m be the pumping lemma constant. Consider w = bm+1am
w=xyz, |xy| <m
|y| >= 1
let y = bs m>=s>=1
x,y are in b’s
m+1-s
m
x= b
z=a
wi= xyiz
m+1-s is m
wi = b
b a
let i = 0 since s ≥ 1
w0= bm+1-s am does not belong to L
L is not regular.
7. Prove that language L={ww : w{a,b}*} is not regular.
answer: Let m be the p.l constant
Consider w = ambmambm L
|w| >=m
|xy| <=m
|y| >=1
k
y=a
k≥1
xyiz = am+ (i-1) k bmambm not belong to L for i ≠1
L is not regular
© Copyright 2026 Paperzz