This document provides instructions and problems for a Theory of Computation midterm exam. It includes 3 problems assessing understanding of regular languages, regular expressions, context-free grammars, pushdown automata and properties of language classes. Problem 1 has 4 true/false statements about regular languages and regular expressions with explanations required. Problem 2 asks if a related language is regular with explanation. Problem 3 has 6 subquestions about context-free languages and pushdown automata, including determining if example languages are context-free, properties of the language classes, and constructing a 2-stack pushdown automaton.
This document provides instructions and problems for a Theory of Computation midterm exam. It includes 3 problems assessing understanding of regular languages, regular expressions, context-free grammars, pushdown automata and properties of language classes. Problem 1 has 4 true/false statements about regular languages and regular expressions with explanations required. Problem 2 asks if a related language is regular with explanation. Problem 3 has 6 subquestions about context-free languages and pushdown automata, including determining if example languages are context-free, properties of the language classes, and constructing a 2-stack pushdown automaton.
This document provides instructions and problems for a Theory of Computation midterm exam. It includes 3 problems assessing understanding of regular languages, regular expressions, context-free grammars, pushdown automata and properties of language classes. Problem 1 has 4 true/false statements about regular languages and regular expressions with explanations required. Problem 2 asks if a related language is regular with explanation. Problem 3 has 6 subquestions about context-free languages and pushdown automata, including determining if example languages are context-free, properties of the language classes, and constructing a 2-stack pushdown automaton.
Please solve all the problems. Due on Thu, Oct 21, after the class. If the alphabet is not specied, then take it to be {a, b}.
Problem 1: [20 Points]
For each of the following statements, answer whether it is true or false, and provide a brief explanation. No credit will be given without an explanation. 1. Every language with only nitely many strings is regular. 2. The language {0n | n 1} is regular. 3. If R and S are regular expressions, then the languages dened by the two expressions (R S) and R S are the same. 4. If every rule in a context-free grammar G is of the form A aB or A , then L(G) is regular. 3
Problem 2: [10 Points]
For a language L, let Llen 0 be a language dened as: Llen = {0i | there exists w L such that |w| = i}. If L is regular, then is Llen necessarily regular? Explain briey. No credit will be given without an explanation.
Problem 3: [30 Points]
Let = {a, b, c, d} and L1 , L2 be dened as: L1 = {w | w contains equal number of a s and b s}. L2 = {w | w contains equal number of c s and d s}. Let L = L1 L2 . Answer the following questions along with brief explanations. No credit will be given without an explanation. 1. Are L1 and L2 context-free ? 2. Are L1 and L2 context-free? 3. Is L context-free? (Hint: Consider strings of the form an cn bn dn ). 4. Is L context free? 5. Is the class of context-free languages closed under complementation? Is the class of contextfree languages closed under intersection? For both questions, if your answer is negative, then give an example based on the languages dened above. 6. Show that L is recognized by a push-down automaton that is allowed to use two stacks.