next up previous
Next: About this document Up: No Title Previous: No Title

Sergio A. Alvarez web: http://www.cs.wpi.edu/ tex2html_wr
ap_inline63 alvarez/
Department of Computer Science e-mail: alvarez@cs.wpi.edu
Worcester Polytechnic Institute phone: (508) 831-5118
Worcester, MA 01609 USA fax: (508) 831-5776

CS 3133, A Term 1998
Midterm Exam

Instructions.

Read each problem carefully. Write solutions neatly in the spaces provided.
Include a brief description of your solution strategy for each problem.

  1. Find a regular expression for each of the following languages over the alphabet tex2html_wrap_inline67 :
    1. all strings that start with (at least one) a and contain exactly two b's.

    2. all strings that do not contain the substring ab.

  2. Consider the context-free grammar G over tex2html_wrap_inline77 defined as follows.

    displaymath79

    1. Give a leftmost derivation in G for the string eabbab.
    2. Construct a nondeterministic finite automaton (NFA) that accepts L(G).
    3. Find a regular expression for the language L(G).

  3. Let M be the NFA over tex2html_wrap_inline91 having state set tex2html_wrap_inline93 , start state A, accepting state set tex2html_wrap_inline97 , and transition function tex2html_wrap_inline99 satisfying tex2html_wrap_inline101 and tex2html_wrap_inline103 for all other pairs tex2html_wrap_inline105 .
    1. Draw the state transition diagram of the machine M.
    2. Construct a deterministic finite automaton (DFA) equivalent to M.

  4. In this problem L denotes the language over tex2html_wrap_inline67 consisting of all strings that contain an equal number of a's and b's. You will show that L is not a regular language.
    1. For every natural number k find a string tex2html_wrap_inline123 in L of length k or greater for which pumping is guaranteed to produce some strings that are not in L. Specifically, this means that length tex2html_wrap_inline131 and for every decomposition of tex2html_wrap_inline123 as uvw, where the strings u, v, w satisfy length tex2html_wrap_inline143 , length, there must be some natural number n such that the pumped string is not in L.

    2. Aiming to reach a contradiction, assume tentatively that L actually is a regular language. Explain carefully how the pumping lemma together with part (a) above lead to a contradiction for a certain value of k. Explain the significance of the value of k in this context.

next up previous
Next: About this document Up: No Title Previous: No Title

Sergio A. Alvarez
Sun Sep 20 16:24:33 EDT 1998