CMPSCI 501: Theory of Computation
First Midterm Exam, Spring 2016
David Mix Barrington
17 February 2016
Directions:
- Answer the problems on the exam pages.
- There are twelve problems (some with multiple parts)
for 130 total points.
Actual scale was A = 115, C = 75.
- If you need extra space use the back of a page.
- No books, notes, calculators, or collaboration.
- The first five questions are statements -- in each case say
whether
the statement is true or false and give a convincing justification
of your answer --
a proof, counterexample, quotation from the book or from lecture, etc.
You get five points for the correct boolean answer (so
there is no reason not to guess if you don't know) and up to five for
the justification.
Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 10 points
Q6: 10 points
Q7: 15 points
Q8: 10 points
Q9: 10 points
Q10: 10 points
Q11: 10 points
Q12: 15 points
Total: 130 points
The language X over the alphabet {a, b, c} is denoted
by the regular expression (ab)*c(ab)*.
The language Y over the alphabet {a, b, c} is the set
{wcw: w ∈ {a, b}*}.
The grammar G has input alphabet {a, b, c}, nonterminals S and T,
start symbol S, and rules S → aTb, T → bSa, and
S → c.
- Question 1 (10):
True or false with justification:
If L is any language that is not context-free, and R
is any regular language, then L ∩ R cannot be context-free.
- Question 2 (10):
True or false with justification:
The language L(G), where G is the grammar defined above, is regular.
- Question 3 (10):
True or false with justification:
For any non-negative integer n, let f(n) be the number of strings of
length n in the language X defined above. Then f(n) = O(1), that
is,
there is some constant c such that for all sufficiently large n,
f(n) ≤ c.
- Question 4 (10):
True or false with justification:
For any non-negative integer n, let g(n) be the number of strings of
length n in the language Y defined above. Then g(n) is not
polynomially bounded, that is, it is not the case there is a
polynomial p such that, for sufficiently large n, we have g(n) ≤
p(n).
(Note: The paraphrase of "polynomially bounded" was incorrect on the
actual exam sheet.)
- Question 5 (10):
True or false with justification:
Let M and N by any two DFA's. Let Z be the language
{u1v1u2v2...ukvk:
k ≤ 0, ui ∈ L(M), vi L(N)}. Then Z must
be a regular language.
- Question 6 (10):
Prove that there does not exist any PDA M such that Y = L(M), wehre Y
is defined above.
- Question 7 (15):
Suppose that M' is a PDA in which the transition (p, ε,
ε; q, ε) occurs. (Recall that ε is the
empty string.)
- (a, 5) If we transform M' into a PDA in the correct normal
form for the PDA-to-CFG construction, what transitions and other
entities will we add to replace the transition (p, ε,
ε; q, ε)?
- (b, 10) What rules of the resulting CFG will come from the
transitions added in part (a)?
- Question 8 (10):
Give an NFA N such that L(N) = X, using the regular expression for X
given above. Remember that NFA's may include ε-moves.
- Question 9 (10):
Build (by any valid method) a DFA D such that L(D) = X, where X is
given above. Explain why you believe your DFA to be correct.
- Question 10 (10):
Describe the equivalence classes for the relation of X-equivalence,
in the sense of the Myhill-Nerode Theorem. (Again, X is the
language given above.) You may use any valid method.
- Question 11 (10):
Describe a PDA MG such that L(MG) = L(G), where
G is the grammar given above. You may use any valid method.
- Question 12 (15): Let L1, a subset of {a, b,
c}*, be the set of strings that contain exactly one c.
- (a, 5) Build a DFA D1 such that L(D1) = L1.
- (b, 10)
Use the construction given in lecture and in the text to create a
regular expression for the language L1 from your DFA.
Last modified 26 February 2016