CS311 SAMPLE Final Exam --- NAME_______________________________

Write your answers on notebook paper. Write your NAME on this exam sheet and turn it in FLAT on top of your answer sheets.

1. (a)Provide a regular expression for the language accepted by the NFA in the following figure.

[[NFA DIAGRAM HERE]]

(b)Why is the NFA nondeterministic? Make reference to the definition of an FA.

(c) Add one state and two labelled arrows to make the machine into a DFA which accepts the same language.


2. (a) Write down a regular grammar that generates the language accepted by the NFA in problem 1(a).

(b) Write down a regular grammar that generates the language accepted by the DFA in problem 1(c).

(c) Explain why is it that these two grammars (a),(b) generate the same language?


3. Construct an NFA (or NFA-/\) accepting the language generated by this regular grammar, including /\ :

[[A SIMPLE REGULAR GRAMMAR HERE]]

4. Describe three (3) different simple non-regular languages, and explain why they are not regular.
5. Design an FA that accepts {a,b}* - L (the complement of L), where L is the regular language of problem 1. Explain your design.
6. Construct the 3-state NPDA acceptor for the language generated by the CFG:
[[A SIMPLE CFG GRAMMAR HERE]]

7. Explain why the grammar in problem 6 is LL(1).
8. The following CFG has left-recursive productions.
[[A SIMPLE LEFT-RECURSIVE GRAMMAR HERE]]
Find a new grammar generating the same language having no left-recursive productions.
9. (a) Describe three (3) different decision problems for regular languages.

(b) Describe two(2) different decision problems for CF languages.


10. Describe three (3) different simple languages which cannot be generated by any CFG.
11. EXTRA CREDIT. Convert the NPDA of problem 6 to a DPDA acceptor.