COT 4420 Theory of Computation Final Examples 1. The following language is context-free: (a) L = { an : n is a prime number } (b) L = { anbncmdm : n ≥ m ≥ 0 } (c) L = { anbn+mcm : n ≥ 0, m ≥ 1 } (d) L = { aibjck : 0 < i < j < k } (e) None of the above are context-free. 2. The following statement about languages is not true: (a) there exists a recursively enumerable language whose complement is not r.e. (b) there exists an enumeration procedure for recursive languages. (c) context free languages are a proper subset of recursive languages. (d) the set of all languages over Σ*, where Σ = {a, b, c}, is countable. (e) All of the above are true. 3. Consider the following grammar G: S → aNb | Nab Na → b | λ N → bNb | b The least powerful machine that can accept the language generated by G is: (a) a deterministic pda. (b) a linear bounded automaton (corresponds to context-sensitive grammars). (c) a finite state machine. (d) a Turing machine. (e) a push down automaton. 4. Suppose you use the pumping lemma for context-free languages to show that the following language is not context-free: L = {anbncn : n ≥ 0} Assume that m is as in the lemma and you let w = a2mb2mc2m. Then, (a) vxy cannot overlap b’s and c’s. (b) vxy cannot overlap a’s and c’s (c) vxy cannot overlap a’s and b’s (d) both (b) and (c) are correct. (e) None of the above. Final, spring 2016 1 5. Consider the following transitions for a Turing machine with initial state q0, final state q3 and the blank symbol as □: δ(q0, b) = (q1, b, R) δ(q1, b) = (q2, b, R) δ(q2, a) = (q2, a, R) δ(q2, □) = (q3, □, R) This Turing machine accepts the following language: (a) b(a+b)* (b) a(a+b)* (c) bba* (d) b*a* (e) None of the above. 6. A string that is in the set represented by the regular expression (1 + 01*) (10*) is: (a) 1010 (b) 1101 (c) 0101 (d) 0010 (e) none of the above. 7. You are asked to minimize the following Mealy machine using the state reduction algorithm (that is, find the reduced machine). X Q 0 1 ---------------------------------q0 q3/0 q4/0 q1 q4/0 q3/0 q2 q4/0 q3/1 q3 q4/1 q0/0 q4 q4/1 q1/0 q5 q1/1 q4/0 The number of equivalence classes in the reduced machine is: (a) 1. (b) 2. (c) 3. (d) 4. (e) 5. Final, spring 2016 2