EECS 510 Review problems for test 3

advertisement
EECS 510
Review problems for final exam
Fall 14
The following questions are not designed to be all inclusive—i.e. any topic from the material
covered in class may appear in a test question, even if there is no question below on that
topic. Some of the topics you should brush up on are:
Regular languages
grammars, regular expressions
finite automata, construction and minimization
conversion of NFA to DFA
regular grammar to automaton algorithm
pumping lemma
closure properties, including proofs
Context-free languages
construction of grammars and PDAs
simplification of grammars and normal forms
pumping lemma
closure properties, including proofs
deterministic CFLs and DPDAs
Turing machines
construction of machines
Examples of specific languages to satisfy particular properties such as two DCFLs whose
union is not a DCFL; CFL whose complement is not a CFL, etc.
1. Construct a context-free grammar for the language L = {uawb | u, w {a, b}*, |u| = |w|}.
Then put your grammar into CNF. Finally, construct a PDA that recognizes L. Be sure to
use the algorithm used in class and in the text to convert to CNF.
2. Find a regular expression and a regular grammar for the following language over  = {0, 1}.
L = {w | w starts with 0 and has odd length or starts with 1 and has even length}
3. The following problems from the text:
a. p. 170 # 15
b. p. 220 # 17 Construct a grammar.
c. p. 236 # 7 h
4. Prove that if G is a CFG in Chomsky normal form then for any string w  L(G) of
length n  1, exactly 2n – 1 steps are required for any derivation of w.
5. Use closure under homomorphism and/or closure under inverse homomorphisms to prove
that the following language is not context-free. L = {aib2ic3i | i  0}
6. L1, L2 and L3 are languages satisfying L1  L2  L3. Find infinite languages L1, L2, and L3
such that L1 and L3 are not regular and L2 is regular.
7. Construct a context-free grammar to generate the set of strings over {b, c} that begin and
end with b, and have an even number of c's between any two b's. Is this language
regular? If so, construct a finite automaton to recognize it.
8. Construct a Turing machine that recognizes all string over {a, b, c} in which the first c is
immediately preceded by the substring aaa. How would your machine change if the word
“immediately” was removed?
9. Construct a finite automaton for L = {w  {a, b}* | if w contains substring aa then |w| is odd}.
10. Find language generated by this grammar. To what class of languages does it belong?
S  AB
A  aAa | bAb | a | b
B  aB | bB | 
11. Prove that L is a CFL and its complement is not where L = {aibjck | i  j or i  k}
12. Use the pumping lemma to prove that the language below is not regular.
L = {w = xcy | x, y  {a, b}* and |x| = |y| and na(x)  na(y)
13. Construct a CFG for the complement of {anbn | n  0}.
Go back over the old exams and the review sheets for tests 1 and 2.
Download
Related flashcards
Semantics

31 Cards

Markup languages

34 Cards

Parts of speech

13 Cards

Formal languages

20 Cards

Create flashcards