Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Theory of Computing
Midterm Examination # 1 Solutions
NAME
ASU ID
ID: ___________
Page 1 of 5
05 October 2015
Ima Sample
You have 50 minutes to complete the exam. Do not open the exam until instructed to do so. No notes, texts,
computers, calculators, or communication devices are permitted. Write all answers on the examination paper itself.
BUDGET YOUR TIME WELL! SHOW ALL WORK!
Question 1
[10]
Question 2
[10]
Question 3
[10]
Question 4
[10]
Total
[40]
CSE 355
Fall 2015 - Colbourn
Theory of Computing
Midterm Examination # 1 Solutions
ID: ___________
Page 2 of 5
transitions from the new start state to the start state of M. Add -transitions from each final state
of M to the new start state. Make all final states of M non-final, and make the new start state be
final.
Using our results about GNFAs, we can often simplify. For example, if the only transition
leaving a state is an -transition, and the state is not final, we can easily remove it. It is ok to
simplify as long as the justification is clear and correct.
You should show at least some of the transition diagrams obtained.
(b) [4 marks] Using your NFA, give a regular grammar that generates L. (For the purposes
of this question, in a regular grammar we are permitted to have rules of the form A
bC, A b, A C, and A , where A and C are variables and b is a terminal.)
For example, S T | W; T 1U; U S; W A | H; A B | D; B 1C; C W; D 0E;
E 0F; F 1G; G W; H J; J K | N; K 0L; L 0M; N 1P; P 1Q. I have just
turned each transition of the NFA into a rule, assuming the start state of the NFA is S and the
final states are M and Q.
Question 3 [10 marks] Consider the NFA with start state q0, final state q3,. and transition function
0
1
State Symbol
q0
{q
q
}
{q
0, 1
3}
q1
{q2}
q2
{q2}
{q2}
q3
{q2}
{q3}
A
1
0
B
1
0
C
01
Final
I process state C and remove it. (There is no way to leave C so it just gets deleted.)
From State To State Start A B Final
Start
A
1
CSE 355
Fall 2015 - Colbourn
Theory of Computing
Midterm Examination # 1 Solutions
B
Final
ID: ___________
Page 3 of 5
B
1
Final
I process state A and remove it.
From State To State Start Final
Start
11*
Final
So the regular expression is 11*.
Question 4 [10 marks] The DFA M has start state q0, final state q0, and transition function
0
1
State Symbol
q0
q0
q1
q1
q1
q0
Let L be the language recognized by M.
The DFA M has start state q0, final state q2, and transition function
0
1
State Symbol
q0
q1
q2
q1
q0
q0
q2
q1
q1
Let L be the language recognized by M.
(a) [5 marks] Using the methods developed in class, produce a DFA for L L.
I use the product construction.
0
1
State Symbol
00 start
01
12
01
00
10
02 final
01
11
10
11
02
11
10
00
12
11
01
(b) [5 marks] Give a regular expression that describes infinitely many strings that are in L
but not in L. (You do not need to describe all, just an infinite number.)
The language of all strings in L but not in L is given by the DFA
0
1
State Symbol
00 start
01
12
01
00
10
02
01
11
10
11
02
11
10
00
12 final
11
01
Check out 1(101)*. This infinite set of strings is accepted.