{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

381-2007fa-final-solutions

381-2007fa-final-solutions - CS 381 Fall 2007 Final Exam...

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

View Full Document Right Arrow Icon
CS 381 Final Exam Thursday Dec 13 Fall 2007 Closed Book 7:00 pm to 9:30 pm Hollister B14 Partial credit will depend on clarity and conciseness of your answers. Please do not put down correct but irrelevant information. 1. (a) Write a regular expression for the set of all strings of a ’s and b ’s in which each a is immediately preceded and immediately followed by a b . (b) Write a regular expression for all strings of a ’s and b ’s which do not contain the substring aab . Solution : (a) ( ) * * * b ba bb ε + (b) ( ) * * * * b abb a 2. Prove that the class of regular sets is closed under inverse homomorphisms. Two or three sentences should suffice. Solution : Construct a finite automaton ' M that applies the homomorphism to each input symbol and feeds the resulting string to the finite automata M accepting the regular set. Then ( ) ( ) ( ) 1 ' L M h L M = . 3. Write a context-free grammar for the set { } | 0 and i-j is even i j L a b i j = . Solution : S aSb S T T aaT T ε . 4. Is the set ( ) { } | * R L ww w w a b = + a regular set, a context-free language that is not a regular set, or not a context-free language. Prove your answer using a construction, closure properties, and/or the pumping lemma. You cannot use the fact that any language is known not to be regular or context-free.
Background image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}