You are on page 1of 2

MEDINA COLLEGE

DEPARTMENT OF COMPUTER SCIENCE


CS304-THEORY OF AUTOMATA & FORMAL LANGUAGES
FINAL EXAMINATION
SEM: 1 - SY: 2023-2024

STUDENT NAME: _________________________________________________ EXAM DATE: _______________

NOTE: - ERASURE OF ANY KIND WILL MERIT A WRONG MARK.


- ANY FORM OF CHEATING WILL NOT BE TOLERATED, PAPERS OF VIOLATORS WILL NOT BE ACCEPTED.

I – PROVIDE THE ANSWER (30 PTS)


Determinism
1. In DFA, given the current state we know what the ________ state will be
2. It has only one _______________ next state
3. It has ______________ choices or randomness

Non – Determinism
4. In NFA, given the current state there could be ____________ next states
5. The next sate may be chosen at ____________
6. All the next states may be chosen in _________________
7. If there is any way to run the machine that ends in any set of states out of which at least one state is a final state, then the NFA
____________.
8. All DFA are a subset of _____________, But there is an equivalent DFA for every NFA.

Regular Language
9. A language is said to be a Regular Language if and only if some Finite State Machine _______________ it.
10. So what languages are Not Regular Language, The Languages which are not recognized by any FSM and which require
_______________.
11. FSM memory is very __________________ it cannot store or count strings.

12. __________________ - A U B {x | x € A or x € B}

13. __________________ - A o B = { xy | | x € A and x € B}

14. __________________ - A* = { x1, x2, x3 …….xk | k >= 0 and each x; € A}


15. What does this theorem mean? _________________________________________________________________________________
Theorem 1: The class of Regular Languages is closed under UNION
Theorem 2: The class of Regular Languages is closed under CONCATENATION

II. CONSTRUCT NFA (21 PTS)


1. Construct an NFA L1= {Set of all strings that starts with ‘0’}

2. Construct an NFA L2 = {Set of all strings of length 2}

3. Construct an NFA L3 = {Set of all strings that ends with ‘1’}

4. Construct an NFA L4 = {Set of all strings that contains ‘0’}

5. Construct an NFA L5 = {Set of all strings that starts with ‘01’}


6. Construct an NFA L6 = {Set of all strings that contains ‘01’}

7. Construct an NFA L7 = {Set of all strings that ends with ‘11’}

III – CONSTRUCT DFA (12PTS)

1. Construct a DFA that accepts the string that containing ‘abac’ over {a,b,c}

2. Construct a DFA base on the state transition diagram, q0 = A, F = B

0 1
A A B
B A B

3. Construct a DFA where:


Q = {Q0, q1, q2, q3} ∑ = {a, b} q0 = Q0 F = q3 state transition Diagram

a b
Q0
Q1
Q2
Q3

IV – CONVERT NFA TO DFA (7PTS)


L = {Set of all strings over (a,b,c) that ends with c}
NFA Transition State Diagram

a b c

Q0

Q1

DFA

a b c
Q0
Q1

PREPARED BY:
“ Honesty is the fastest way to
DUANE CHINO A. ATIS * prevent a mistake from turning
INSTRUCTOR into a failure. ” by James Altucher

You might also like