P. A.
COLLEGE OF ENGINEERING AND TECHNOLOGY
An Autonomous Institution & Affiliated to Anna University
Accredited by NAAC with ‘A’ Grade
POLLACHI – 642 002
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Accredited by NBA
EVEN SEMESTER 2024 – 2025
CYCLE TEST – I
ANSWER KEY
PART - A (10 x 2 = 20 MARKS)
ANSWER ALL THE QUESTIONS
1. Define Automata.
Automata are the kind of machines which take some string as input. This input goes through a finite
number of states and may enter in the final state
2. What are the key components of a finite automaton?
A finite automaton consists of the following key components:
1. States (Q) – A finite set of states.
2. Alphabet (Σ) – A finite set of input symbols.
3. Transition Function (δ) – A function defining state transitions.
4. Start State (q₀) – The initial state.
5. Final States (F) – A set of accepting states.
3. List the application of automata theory.
1. Compiler Design – Lexical analysis and syntax parsing.
2. Text Searching – Pattern matching in search engines.
3. Artificial Intelligence – Decision-making models.
4. Network Protocols – Design and verification of communication protocols.
5. Natural Language Processing – Syntax checking and parsing.
6. Robotics – Control systems and automated decision-making.
4. 7. VLSI
Compare the Design – Circuit
difference verification
between DFA and and optimization.
NFA.
1
5. Construct a finite automata for the language {0n | mod 3 = 2, n>=0}.
6. Design DFA to accept strings over ∑=(0,1) with two consecutive 0’s.
7. Define regular expression. Give an example.
A regular expression (regex) is a sequence of characters defining a search pattern, mainly used for
pattern matching in strings. It represents regular languages in automata theory.
Example:
The regex a*b matches strings with zero or more 'a' followed by a 'b', such as "b", "ab", "aaab".
8. Relate Does the string "abbb" match the regular expression a(b∗)a(b*)a(b∗)?
Yes, the string "abbb" matches the regular expression "a(b*)a(b*)a(b*)".
Explanation:
Breakdown of the regular expression:
a: Matches a single 'a' character.
(b*): Matches zero or more occurrences of 'b'.
Applying to "abbb":
The first 'a' matches the first 'a' in the string.
The (b*) matches the three 'b's following the first 'a'.
The second 'a' matches the next 'a' in the string.
The final (b*) matches the remaining 'b's (which are none in this case).
9. Find out the language generated by regular expression (0+1)*
L = {ε, 0, 1, 00, 11, 01, 10,111, ....}
2
10. Build RE to describe an identifier and positive integer.
An identifier typically starts with a letter (lowercase or uppercase) or an underscore, followed by
letters, digits, or underscores.
[a-zA-Z_][a-zA-Z0-9_]*
[a-zA-Z_]: The first character must be a letter (either lowercase or uppercase) or an
underscore.
[a-zA-Z0-9_]*: The subsequent characters can be letters, digits, or underscores, and can
repeat zero or more times.
A positive integer is a number consisting of one or more digits, starting from 1-9 (no leading zeros).
[1-9][0-9]*
[1-9]: The first digit must be between 1 and 9 (no leading zeros).
[0-9]*: The subsequent digits can be any digit from 0 to 9, and can repeat zero or more
times.
PART - B (3 x 10 = 30 MARKS)
ANSWER ANY THREE QUESTIONS
11. Determine the DFA from a given NFA.
States a b
q0 {q0,q1} {q1}
q1 - {q0,q1}
3
12. How can you eliminate ε-transitions from a given ε-NFA to convert it into an equivalent
NFA without ε-transitions?
4
δ'(q0, 0) = ε-closure(δ(δ^(q0, ε),0))
= ε-closure(δ(ε-closure(q0),0))
= ε-closure(δ(q0, 0) ∪ δ(q1, 0) U δ(q2, 0) )
= ε-closure(δ(q0,q1,q2), 0))
= ε-closure(q0 U Φ ∪ Φ)
= ε-closure(q0)
= {q0,q1, q2}
δ'(q0, 1) = ε-closure(δ(δ^(q0, ε),1))
= ε-closure(δ(q0, 1) ∪ δ(q1, 1) U δ(q2, 1) )
= ε-closure(δ(q0,q1,q2), 1))
= ε-closure(Φ ∪q1 U Φ)
= ε-closure(q1)
= {q1, q2}
δ'(q0, 2) = ε-closure(δ(δ^(q0, ε),2))
= ε-closure(δ(q0, 2) ∪ δ(q1, 2) U δ(q2, 2) )
= ε-closure(δ(q0,q1,q2), 2))
= ε-closure(Φ U ΦU q2)
= ε-closure(q2)
= {q2}
δ'(q1, 0) = ε-closure(δ(δ^(q1, ε),0))
= ε-closure(δ(q1,q2), 0))
= ε-closure(Φ ∪ Φ)
= ε-closure(δ(q1, 0) U δ(q2, 0) )
= ε-closure(Φ)
=Φ
δ'(q1,1) = ε-closure(δ(δ^(q1, ε),1))
= ε-closure(δ(q1,q2), 1))
= ε-closure(q1 ∪ Φ)
= ε-closure(δ(q1, 1) U δ(q2, 1) )
= ε-closure(q1)
= {q1,q2}
δ'(q1, 2) = ε-closure(δ(δ^(q1, ε),2))
= ε-closure(δ(q1,q2), 2))
= ε-closure(Φ ∪ q2)
= ε-closure(δ(q1, 2) U δ(q2, 2) )
= ε-closure(q2)
= {q2}
δ'(q2, 0) = ε-closure(δ(δ^(q2, ε),0))
= ε-closure(δ(q2), 0))
= ε-closure(δ(q2, 0))
= ε-closure(Φ)
=Φ
5
δ'(q2, 1) = ε-closure(δ(δ^(q2, ε),1))
= ε-closure(δ(q2), 1)
= ε-closure(δ(q2, 1))
= ε-closure(Φ)
=Φ
δ'(q2, 2) = ε-closure(δ(δ^(q2, ε),))
= ε-closure(δ(q2), 2))
= ε-closure(δ(q2, 2))
= ε-closure(q2)
= {q2}
Now, we will summarize all the computed δ' transitions as given below −
δ'(q0,0)={q0,q1,q2}
δ'(q0,1)={q1,q2}
δ'(q0,2)={q2}
δ'(q1,0)= { Φ }
δ'(q1,1)={q1,q2}
δ'(q1,2)={q2}
δ'(q2,0)={ Φ }
δ'(q2,1)={ Φ }
δ'(q2,2)={q2}
The transition table is given below −
States 0 1 2
q0 {q0,q1,q2} {q1,q2}{q2}
q1 Φ {q1,q2}{q2}
q2 Φ Φ {q2}
The NFA without epsilon is given below
13. Explain the DFA Minimization algorithm with an example.
Minimization of DFA means reducing the number of states from given FA. Thus, we get the
FSM(finite state machine) with redundant states after minimizing the FSM.
We have to follow the various steps to minimize the DFA. These are as follows:
Step 1: Remove all the states that are unreachable from the initial state via any set of the
6
transition of DFA.
Step 2: Draw the transition table for all pair of states.
Step 3: Now split the transition table into two tables T1 and T2. T1 contains all final states,
and T2 contains non-final states.
Step 4: Find similar rows from T1 such that:
1. δ (q, a) = p
2. δ (r, a) = p
That means, find the two states which have the same value of a and b and remove one of
them.
Step 5: Repeat step 3 until we find no similar rows available in the transition table T1.
Step 6: Repeat step 3 and step 4 for table T2 also.
Step 7: Now combine the reduced T1 and T2 tables. The combined transition table is the
transition table of minimized DFA
Example:
Solution:
Step 1: In the given DFA, q2 and q4 are the unreachable states so remove them.
Step 2: Draw the transition table for the rest of the states.
State 0 1
→q0 q1 q3
q1 q0 q3
*q3 q5 q5
*q5 q5 q5
Step 3: Now divide rows of transition table into two sets as:
1. One set contains those rows, which start from non-final states:
7
State 0 1
q0 q1 q3
q1 q0 q3
2. Another set contains those rows, which starts from final states.
State 0 1
q3 q5 q5
q5 q5 q5
Step 4: Set 1 has no similar rows so set 1 will be the same.
Step 5: In set 2, row 1 and row 2 are similar since q3 and q5 transit to the same state on 0
and 1. So skip q5 and then replace q5 by q3 in the rest.
State 0 1
q3 q3 q3
State 0 1
→q0 q1 q3
q1 q0 q3
*q3 q3 q3
Now it is the transition table of minimized DFA.
8
14. Construct NFA for RE b+ba*
b
a
a
a
Faculty In-charge HoD