CS 381
Final Exam
Thursday
Dec 13
Fall 2007
Closed Book
7:00 pm to 9:30 pm
Hollister B14
Partial credit will depend on clarity and conciseness of your answers.
Please do not put
down correct but irrelevant information.
1.
(a)
Write a regular expression for the set of all strings of
a
’s and
b
’s in which each
a
is immediately preceded and immediately followed by a
b
.
(b)
Write a regular expression for all strings of
a
’s and
b
’s which do not contain the
substring
aab
.
Solution
:
(a)
(
)
*
*
*
b
ba
bb
ε
+
(b)
(
)
*
* *
*
b
abb
a
2.
Prove that the class of regular sets is closed under inverse homomorphisms.
Two or
three sentences should suffice.
Solution
:
Construct a finite automaton
'
M
that applies the homomorphism to each input
symbol and feeds the resulting string to the finite automata
M
accepting the regular set.
Then
(
)
(
)
(
)
1
'
L M
h
L M
−
=
.
3.
Write a contextfree grammar for the set
{
}

0 and ij is even
i
j
L
a b
i
j
=
≥
≥
.
Solution
:
S
aSb
S
T
T
aaT
T
ε
→
→
→
→
.
4.
Is the set
(
)
{
}

*
R
L
ww w w
a
b
=
∈
+
a regular set, a contextfree language that is not a
regular set, or not a contextfree language.
Prove your answer using a construction,
closure properties, and/or the pumping lemma.
You cannot use the fact that any language
is known not to be regular or contextfree.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 HOPCROFT
 Formal language, Halting problem, CFL, contextfree language, blank tape, pm Hollister B14

Click to edit the document details