CS 475/575 Quiz 6
Fall 2013
Study guide
Read Chapter 7.
Be prepared to answer these kinds of questions:
Given a context-free grammar, remove its useless symbols, and eliminate -productions
and unit productions. Also convert the grammar to Chomsky normal f
CS 475/575 Quiz 8
Fall 2013
Solution
1. Which of these instances of Post's Correspondence Problem (PCP) have a solution?
For each instance, either write a matching sequence or explain why no match exists. [30 points]
a
a.
,
aba
ab
ba ,
ba
ab ,
b
CS 475/575 Quiz 6
Fall 2013
Solution
1. Trace the CYK dynamic programming algorithm for input string bccaabbc using this
Chomsky normal form grammar. First complete the table below, and then use the table
to draw a parse tree for the string bccaabbc. [36
CS 475/575 Quiz 7
Fall 2013
Solution
1. Given the Turing machine below with input alphabet cfw_a,b,c,d,e. First write all the accepted
strings that have length 5. Then choose any one accepted string of length 5, and write an
accepting computation sequence
CS 475/575 Quiz 5
Fall 2013
Solution
1. Let M denote this (non-deterministic) pushdown automaton:
, /
1
c, /C
f, /F
a, /A
d, /D
2
3
b, /B
e, /E
4
a, A/
b, B/
c, C/
, Z0/
6
d, D/
e, E/
f, F/
5
a. Write an accepting computation sequence for the shortest str
CS 475/575 Quiz 2
Fall 2013
Solution
+
1. Given this regular expression: (a bc*d) (e fg) (h jc*k)
a. Write all the generated strings that have length 5. [10 points]
aeeeh
afgeh
aeejk
bdeeh
afgjk
bdfgh
aejck
bdejk
aefgh
bcdeh
b. Draw an equivalent determin
CS 475/575 Quiz 1
Fall 2013
Solution
1. Given this non-deterministic finite-state machine:
a
1
d
2
b
c
d
3
a. Write all the accepted strings that have length 4. [12 points]
abad
abcd
adad
cdad
adba
cdba
adcd
cdcd
adda
cdda
addd
cddd
b. Draw an equivalent
CS 475/575 Quiz 3
Fall 2013
Solution
1. Let L = cfw_ t1 c t1R d t2 c t2R d d tm c tmR | m 1 and each tj (ab)* , where tjR denotes the
reverse of string tj. Examples: babacabab, aabcbaadbbacabb, bacabdabcbadbacab. Use the
pumping theorem to show that this
CS 475/575 Quiz 8
Fall 2013
Study guide
Read Chapter 9.
Be prepared to answer these kinds of questions:
Short-answer questions about reductions and decidable, undecidable, Turingrecognizable, and non-Turing-recognizable languages.
Prove that a given langu
CS 475/575 Quiz 7
Fall 2013
Study guide
Read Chapter 8.
Be prepared to answer these kinds of questions:
Given a Turing machine, write an accepting computation sequence for a given input
string.
Given a Turing machine, determine all accepted strings with s
CS 475/575 Quiz 4
Fall 2013
Study guide
Read Chapter 5.
Be prepared to answer these kinds of questions:
Given a (possibly ambiguous) context-free grammar, draw each distinct parse tree for a
given input string.
Given a (possibly ambiguous) context-free gr
CS 475/575 Quiz 5
Fall 2013
Study guide
Read Chapter 6.
Be prepared to answer these kinds of questions:
Given a pushdown automaton, write an accepting computation sequence for a given
input string.
Given a pushdown automaton, determine all accepted string
CS 475/575 Quiz 4
Fall 2013
Solution
1. Given this context-free grammar with production numbers as shown:
(1)
(2, 3, 4)
(5, 6, 7)
(8, 9, 10)
S XYZ
X aXb | aX |
Y bY | Yc |
Z cZd | Zd |
a. Draw five distinct parse trees for input string abcd. [20 points