midterm2sol - University of Illinois at Urbana-Champaign...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
University of Illinois at Urbana-Champaign Department of Computer Science Midterm 2 CS 373: Theory of Computation Fall 2009 Name: Netid: Print your name and netid, neatly in the space provided above; print your name at the upper right corner of every page. Please print legibly. This is a closed book exam. No notes, books, dictionaries, calculators, or laptops are permitted. You are free to cite and use any theorems from class or homeworks without having to prove them again. Write your answers in the space provided for the corresponding problem. Let us know if you need more paper. Suggestions: Read through the entire exam first before starting work. Do not spend too much time on any single problem. If you get stuck, move on to something else and come back later. If you run short on time, remember that partial credit will be given. If any question is unclear, ask us for clarification. Question Points Score Problem 1 20 Problem 2 15 Problem 3 10 Problem 4 15 Problem 5 20 Problem 6 20 Total 100
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 373 Midterm 1 – Fall 2009 2 Name: 1. Short Problems (20 points) Give answers to each of the following questions, including a short justification. For each, you will get two points for the correct answer and two points for the correct justification. (a) Consider a grammar G = ( V, Σ ,R,S ) in which Σ = { 0 , 1 } and the only rules are S A , A AB , and B A . What is L ( G )? (4 points) Sol: All the rules just substitute variables with variables. Therefore, there is no way to derive a string in { 0 , 1 } * from S . So L ( G ) = . (b) Is { a n b m c k d n Σ * | n,m,k 0 } a context-free language? (4 points) Sol: Yes, it is the language of this grammar S aSd | B B bB | Bc | ε (c) Let A and B be any two context-free languages. Must A \ B be a context-free language (here, \ denotes set difference)? (4 points) Sol: Note that for any set A , we have A = Σ * - A and Σ * is a CFL. Therefore if the claim is true, then CFLs would be closed under complementation. So the answer is No. (d) If a language
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/18/2010 for the course CS 373 taught by Professor Viswanathan,m during the Fall '08 term at University of Illinois, Urbana Champaign.

Page1 / 13

midterm2sol - University of Illinois at Urbana-Champaign...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online