



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Torng; Class: Computability and Languages; Subject: Computer Science & Engineering; University: Michigan State University; Term: Fall 2000;
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




The 1.0 points on this exam sum to 26. The 2.0 points on this exam sum to 23. The 3.0 points on this exam sum to 21. The 4.0 points on this exam sum to 16.
There is one question on Chomsky Normal Form worth a total of 3 extra credit 4.0 points.
3 C a X C aX 4 C a a C aa 5 C b a D /
6 D b a D /
7 D /\ X E X
8 F a Y F aaY 9 F a a F aaa 10 F b a G /
11 G b a G /
12 G /\ Y H Y
(a) Give the 4 shortest strings in L(G 1 ). [2, 1.0] (b) Draw a leftmost derivation of the string bbbbb. [2, 1.0] (c) Draw the derivation tree that corresponds to your leftmost derivation above. [2, 1.0] (d) Draw the rightmost derivation that corresponds to your leftmost derivation above. [2, 1.0] (e) Prove that G 1 is an ambiguous grammar. [2, 2.0] (f) What is L(G 1 )? [2, 1.0] (g) Give a regular expression r such that L(r) = L(G 1 ). [2, 1.0]
Suppose M is the PDA that results from applying the construction given in class so that L(M ) = L(G). List all the transitions in M. [2, 2.0]
(a) Suppose we apply the construction covered in class to construct an NFA-λ M 3 from NFA-λ M 1 with 8 accepting states and NFA-λ M 2 with 7 accepting states such that L(M 3 ) = L(M 1 ) ∪ L(M 2 ). How many accepting states does M 3 have? [2, 2.0] (b) Suppose we apply the construction of Theorem 4.1 and construct an FSA M 5 from NFA M 4 with 3 states total, 1 of which is accepting, such that L(M 5 ) = L(M 4 ). How many accepting states does M 5 have counting all states that are unreachable from the initial state? [2,2.0]
(a) For any program P , which of the following represents Y (P ): [2, 1.0]
i. We show L 1 ∩ L = L 2 where L 1 is a context-free language and L 2 is a half-solvable but not solvable language. ii. We show that L 1 ∩ L 2 = L where L 1 is a context-free but not regular language and L 2 is a finite language. iii. We show that L 1 ∩ L = L 2 where L 1 is a context-free language and L 2 is not a context-free language. iv. We show that L 1 ∩ L 2 = L where L 1 is a context-free language and L 2 is a context- free language. v. We show that L 1 ∩L = L 2 where L 1 is a regular language and L 2 is not a half-solvable language.
(a) anbn (b) a^11 b^10 (c) a^2 nbn (d) a^2 n+1b^2 n (e) (ab)na
(a) In order to prove that L(G) ⊆ AB, which of the following statements would we try and prove? Circle your answer. [2, 2.0]
(a) Define what it means for a CFG G to be ambiguous. [2, 1.0] A grammar is ambiguous if there exists some string x ∈ L(G) such that there are two distinct parse trees for string x.
(b) Identify which one of the following statements most accurately represents why we do not like ambiguous grammars. Circle your answer. [2, 3.0]
Suppose f is a function that shows that EM P T Y R ≤ EM P T Y G.
(a) Give a specification for f. That is, state what its input and output should be and how they should be related to each other. [2, 2.0] (b) Give an algorithm f that shows that EM P T Y R ≤ EM P T Y G. You do not need to specify all the details of your algorithm, but your answer should be fairly complete. One possibility is to describe this algorithm in terms of another algorithm we have seen in class highlighting where this algorithm is different from the previous construction. [2, 4.0]
(a) If P ′^ halts on x, what is Y (P ′′′)? [2, 1.0] (b) If P ′^ loops on x, what is Y (P ′′′)? [2, 1.0] (c) This program P 3 can be used to prove that the halting problem transforms to some of the following problems. Identify all such problems, and for those which this does not apply, state whether or not there is a Yes→No violation or a No→Yes violation. You must get at least 5 correct to receive any credit. [2, 4.0] i. Input: Program P. Yes/No Question: Is Y (P ) nonempty?
S → T U V, T → λ | bT, U → λ | aU, V → λ | ccV
(a) Show the grammar that results after eliminating null productions. [1, extra credit 4.0] (b) Show the grammar that results after eliminating unit productions. [1, 4.0] (c) Show the grammar in Chomsky Normal Form. [1, 4.0]