next up previous
Next: About this document

Sergio A. Alvarez web: tex2html_wrap_inline51 alvarez/
Department of Computer Science e-mail:
Worcester Polytechnic Institute phone: (508) 831-5118
Worcester, MA 01609, USA fax: (508) 831-5776

CS 3133, A Term 1998
Midterm Exam Practice Problems

Solutions now available

  1. Find a regular expression for each of the following languages over the alphabet tex2html_wrap_inline53 :
    1. all strings in which any a's precede all b's (in a left-to-right scan).
    2. all strings that do not contain the substring bb.
  2. Construct a context-free grammar over the alphabet tex2html_wrap_inline53 that generates the language tex2html_wrap_inline63 . Use three nonterminal symbols tex2html_wrap_inline65 .
  3. Is the language defined in the preceding problem regular? If you answer yes, give a regular expression that describes the language. Otherwise, prove that the language is not regular.
  4. Consider the machine M over tex2html_wrap_inline69 having state set tex2html_wrap_inline71 , start state A, accepting state set tex2html_wrap_inline75 , and transition function tex2html_wrap_inline77 satisfying tex2html_wrap_inline79 and tex2html_wrap_inline81 for all other pairs tex2html_wrap_inline83 .
    1. Draw the state transition diagram of the machine M.
    2. Find a regular expression for the language L(M).
  5. Define a context-free grammar G over tex2html_wrap_inline91 as follows.


    1. Give a leftmost derivation in G for the string acaacb.
    2. Find a regular expression for the language L(G).
    3. Construct a nondeterministic finite automaton M with possible lambda transitions (i.e., an NFA- tex2html_wrap_inline103 ) that accepts L(G).
    4. Construct a deterministic finite automaton (DFA) equivalent to the NFA- tex2html_wrap_inline103 that you found above in part (3) of this problem.

Sergio A. Alvarez
Mon Sep 14 11:41:44 EDT 1998