Next: About this document
Sergio A. Alvarez
web: http://www.cs.wpi.edu/ alvarez/
Department of Computer Science
email: alvarez@cs.wpi.edu
Worcester Polytechnic Institute
phone: (508) 8315118
Worcester, MA 01609, USA
fax: (508) 8315776
CS 3133, A Term 1998
Midterm Exam Practice Problems
Solutions now available

Find a regular expression for each of the following languages over
the alphabet :
 all strings in which any a's precede all b's (in a lefttoright scan).
 all strings that do not contain the substring bb.

Construct a contextfree grammar over the alphabet
that generates the language .
Use three nonterminal symbols .

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.

Consider the machine M over having
state set , start state A, accepting state
set , and transition function
satisfying
and for all other pairs .
 Draw the state transition diagram of the machine M.
 Find a regular expression for the language L(M).

Define a contextfree grammar G over as follows.
 Give a leftmost derivation in G for the string acaacb.
 Find a regular expression for the language L(G).
 Construct a nondeterministic finite automaton M with possible lambda transitions
(i.e., an NFA ) that accepts L(G).
 Construct a deterministic finite automaton (DFA) equivalent to the NFA
that you found above in part (3) of this problem.
Sergio A. Alvarez
Mon Sep 14 11:41:44 EDT 1998