0% found this document useful (0 votes)
51 views3 pages

Automata Theory - Solution

Uploaded by

raheelkr2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views3 pages

Automata Theory - Solution

Uploaded by

raheelkr2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DEPARTMENT OF COMPUTER SCIENCE

UNIVERSITY OF ENGINEERING & TECHNOLOGY, PESHAWAR

COURSE TITLE: AUTOMATA THEORY STUDENT REG #: ___________________


MID TERM EXAM – SPRING 2025 BS (CS) – 3th SEMESTER
TIME ALLOWED: 02 HOURS TOTAL WEIGHTAGE: 25%
ATTEMPT ALL QUESTIONS INSTRUCTOR: DR. IMRAN KHALIL

Question 01. Deterministic Finite Automata [10]

Construct the MDFA over ∑ = {𝑎, 𝑏}∗ of the following language:

𝐿1 = {𝑊 such that |𝑊|𝑏 = 2(𝑚𝑜𝑑 3) }

Solution:

Question 02. Non-Deterministic Finite Automata [10]

Construct the NFA/ 𝝐𝑁𝐹𝐴 over ∑ = {0,1}∗ of the following language:

𝐿2 = {𝑊|𝑊 accepts all binary strings where the last symbol is 0 or that contains only 1𝑠 }

Solution:

Question 03. Conversion NFA to DFA [10]

Design a DFA equivalent to the following NFA:

Page 1 of 3
DEPARTMENT OF COMPUTER SCIENCE
UNIVERSITY OF ENGINEERING & TECHNOLOGY, PESHAWAR

𝐿3 = {𝑥 ∈ {0,1}∗ where 𝑥 is a string whose next-to-last symbol is 1}

Solution:

Transition table of NFA Transition table for DFA

𝜹 0 1 𝜹 0 1

→ 𝑞0 𝑞0 {𝑞0 , 𝑞1 } → 𝑞0 𝑞0 {𝑞0 , 𝑞1 }

𝑞1 𝑞2 𝑞2 {𝑞0 , 𝑞1 } {𝑞0 , 𝑞2 } {𝑞0 , 𝑞1 , 𝑞2 }

∗ 𝑞2 − − ∗ {𝑞0 , 𝑞2 } 𝑞0 {𝑞0 , 𝑞1 }

∗ {𝑞0 , 𝑞1 , 𝑞2 } {𝑞0 , 𝑞2 } {𝑞0 , 𝑞1 , 𝑞2 }

Question 04. Regular Expressions [10]

Write the regular expression for the language 𝐿4 over the alphabet {𝑎, 𝑏} consisting of all strings that start
with 'a' and end with 'b', with any combination of 'a's and 'b's in between.

Solution:

a. 𝒂(𝒂 + 𝒃)∗ 𝒃

b. Convert the following Finite Automata to Regular Expression:


Page 2 of 3
DEPARTMENT OF COMPUTER SCIENCE
UNIVERSITY OF ENGINEERING & TECHNOLOGY, PESHAWAR

𝒂∗ 𝒃(𝒄 + 𝒅𝒂∗ 𝒃)∗

Page 3 of 3

You might also like