10
CSCE 355, Fall 2008 Foundations of Computation - Test 2 November 10,2008 M Matthews November 7,2008 1;0"'0: ~~ ~ _ ~ ~ -------------- Instructions Email: _ Make sure your test is complete. There should be 7 pages including this cover sheet. Note there is no page number 1. No Calculators, cell phones, or other electronic devices. Answer in the space provided if at all possible. If a question is unclear please ask early in the test. Good Luck!

CSCE 355, Fall 2008matthews/Courses/C_Introduction/...Given the regular expression construct an NFA that will accept the language denoted by the regular expression (a) a*(b + a)*c*

Embed Size (px)

Citation preview

CSCE 355, Fall 2008

Foundations of Computation - Test 2November 10,2008

M Matthews

November 7,2008

1;0"'0: ~~ ~ _

~ ~ --------------

Instructions

Email: _

• Make sure your test is complete. There should be 7 pages including this cover sheet. Note there is no pagenumber 1.

• No Calculators, cell phones, or other electronic devices.

• Answer in the space provided if at all possible.

• If a question is unclear please ask early in the test.

• Good Luck!

Test2 Fall 2008

CSCE 355 Foundations of Computation

1. Relations

2

Test2 Fall 2008

(a) Given a relation R = {(a, b), (b, e), (a, a), (b, b), (e, en does it satisfy the following properties? If notindicate why the relation does not have the property.

i. reflexive

ii. transitive Nto

iii. symmetric AJ D

iv. injective

v. surjective

(b) Define the derives relation, ::::}

Test2 Fall 2008

2. Regular Expr -

(a) Given the following regular expression, a* bbb* cc*, describe in English the language it denotes.

3

(b) Is a'(a+ ba)'a' ~ (a+ba)'?Whyo,whynot? Yes be~-Jtut'V/7 tf)& ~ ~ ~ r:h chc 6eJ W ~ £,

fMMf d {# Wu A 'ti',1!fl1 ffrJJX CovJ£ju> t- v~~ D~/Ce .

3. Regular Expr - Give regular expressions that represent the following language: Strings of D's and l's such thatevery 1 is immediately followed by two D's.

(Df JOO)-;

Test2 Fall 2008 4

4. Given the regular expression construct an NFA that will accept the language denoted by the regular expression

(a) a*(b + a)*c*

(b) a*(aa + ba)*

Test2 Pall 2008

5. Given the grammar

• 8 -+ 081 I Z I E

• Z -+ OZ I E

(a) Give a parse tree for 000011

s/ I""o S I

~

o ~ ~,

::c

/\o ~

!\() ~

I

5

(b) Give a leftmost derivation for 000011 f::

~ ~~tt'~;. U1MJ ~\V~:~ ~...J- h<. Q-e+1:~.)-t

JVWltW ~ ~j) ~'jV1"t-t"1.Z>:;t S ,'v'\,c.c 6~

~\fM~ ~~ ~(~ ~ \tWttt-WtV1ttt~.

~ -:::::;>.e,P S I -==:> 0~'f, I I-=-'") D D -C l (:::::::j 0 0 0 =2:- ( \

=-;> 0 0 DO.:c (l

:-=;J 60 D~ c l \-:::;0000 {\

Test2 Fall 2008

o

6

0,1

start

6. Given the DFA give strings that distinguish states Band E.

10o

'B I ~ D -'-) ra

to, \~ -) \-\ - ~ IT

o

V1A2V\ ?i { L-ef-b'vt 1

AC ler-b'vt-.:J

0,1

Test2 Fall 2008

7

7. Non-regular proof by Pumping Lemma L = { i/..; k I' ..'. aifC z=Jorz=k}

~pt;~ It:? £+.~ !o)~ ~~ ~<€ ~~T ~ 1<\>t:JS~~ ...

-r~ dwot>~ W;1IJ ~ ~ tt b~~ G L-

~ '-Jh ~l/1MItf;--"'-'J ~ W-t (cu-­

f~-t-~t-\'" ~ W::: lC J ~W~~

\\ ) \}( ~I ~ V\

G\} I ~ \ > 0

UMl0\) iJ"" WJ ~~D KOL:r G L.-::CJ w:: tt11 !::;'t'l.::. X;) =t. cv.J. \ ~ ~ t Z 11

~ K "i C, ~ ~~ ..J I ,

.s1t\L~ 1~\'> 0 "0 ~ 4; ~1 (W ~.

~ J,r ~"''D &. X~O~ It)t-'J '\~ ~ r\ tt(~\ _ n l\j}1 b~ ~ V\ c... S

cw.l +~ Y-.j:l- ~ L .lh,i'J ~:-C);- j ~ PL<Mft "j ~ J~ k ~ \M-t 'r-~~ ~

Test2 FalI 2008

8. Give a grammar for the language L = {ai~ ck I i = j or i = k}

S :y Bv:B7OG~b

D-' LV } E:

\

\

8

C-7ACc..\G

[-9 \9£ \~

Test2 Fall 2008

9. Construct a PDA for the context free language given by the grammar below

• 8 ---> 081 I Z I E

• Z ---> OZ I E

9

Test2 Fall 2008 10

10. Terminology: Explain of define

(a) What is the Pigeon hole principle?

H- ~ ~ V\ f\bt~.5· --\-..(J~ ~ ~ V\{4J~

~O\AA II'\. mi;~ ~ "'f't ~t ~ tv..-ft....yo~ CAAt. &CL.

(b) State the pumping lemma.

(c) What does it mean for a string z to distinguish two states p and q in a DFA?

~ (f) =b-) f.- r-- ~ ~ (1)) ~) 1= F\.

t> V V \ c.~ VBv5.t:.L

(d) What does it mean for a language L to distinguish two strings x and y?

JtvnllM6~ ~~ ~t>t7 PL ~'~e;.:c 6U~~

x,::z: ~!-.. w... 0~ ~ L- ~ vi t<-"en~ )