0% found this document useful (0 votes)
23 views17 pages

COS2601 Oct 2017 Memo

Ghhhh

Uploaded by

rebecca malebje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
23 views17 pages

COS2601 Oct 2017 Memo

Ghhhh

Uploaded by

rebecca malebje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 17
UNIVERSITY EXAMINATIONS. UNIVERSITEITSEKSAMENS UNISA|E= COS2601 OctoberiNovember 2017 THEORETICAL COMPUTER SCIENCE II Duraton 2 Hours 100 Marks EXAMINERS. FIRST MR CL PILKINGTON ‘SECOND DR WIC VAN STADEN Closed book examination ‘This exammation question paper remains the property ofthe Unwversity of South Affica and may not be removed from the examination venue This examination question paper consists of 20 pages Instructions 1 Answer all questions in the spaces provided on this exam paper 2 Extra pages are provided at the end of the exam paper for all rough work 3 The mark for each question 1s given in brackets next to the question 4 Unless othenmse specttied, all languages in the questions are defined over the alphabet E = (a 6} ALL THE BEST!! [TURN OVER] 2 cos2601 October/November 2017 QUESTION 1: Languages [10] (a) Let S = (ab bb} and let T = {ab bb bbb} () Is S* a subset of T*? Motivate your answer (i) Is S* = 7°? Motivate your answer (4) "VS ee elo of 7 aN Neb iSecdley te Bond Yul s0Ne. Wades “14 ase nA wy ay VF lob exusle in 1” (‘i Se cap ep ed a ortcastcosen Idee = oS (b) Gwen S = {ab abe cc}, give all the words in S* that have length less than or equal to4 (3) ab jabe, cc, doce, ceals, abel) itis (c)_ Given $ = {ab bab baab} Are the following words in S*? Indicate why or why not Wa (u) abbabaabab (3) ee et me Sane hE] Dose i, (ab) (eal) _saboate etalon ae a erd clacalonaldals wo nck iq 6 : NSAAS “euler De ue Ee sy ie a) 0 \eene (TURN OVER} 3 c0s2601 October/November 2017 QUESTION 2: Regular expressions [10] (a) Give a regular expression that generates the language that consists of all words that start with a double letter (that 1s, two a's or two b's), end in a b, and have at least 4 characters @) Tes Ae GRY Gwe (0) Can abbaabaaabba be generated by the regular expression (a + b)(abb + baa)*aa"? Explain fully why you say so by showing how the word 1s, or is not, generated by the regular expression 2 abloeebaaalska ccuweh lee aproded | ei a os Rei no 4 0 opi (c) Does the regular expression alaa + bb + ab + ba + aaa + abb + aab + aba + aab + bbb + baa + bab)” define the language consisting of all words starting with an a and in which words of length 2 do not occur? If yes, explain why you say so, ifno, give acounterexample (3) \ Sel dees nek eume aleba Ie 19 tle Craaag leuk comnak Le gorerabdl Ly Reveqlar expresion @ the simplest terms possible, the language generated by the regular Provide another regular expression that generates the same language (2) (a th y> ; | Ae A all cg Hob ns a al | L \ mcdidwe We aul Mee I [TURN OVER] 4 cos2601 October/November 2017 QUESTION 3: Recursive definitions [10] A recursive definition for the language ODDA defined over the alphabet ¥ = {2 b} should be compiled ODDA consists of all words of odd length that contain the @-substnng Provide (a) an appropnate universal set, 1) (b) the generator(s) of ODDA, (1) (c) an appropnate function on the universal set, and then (1) (4) use these concepts to wnte down a recursive definition for the language ODDA @ NOTE Marks will be Subtracted for words that are introduced into the language that are not in ODDA (a) SF i Sx Ly (b) ey (c) ConcAr ® ononc S~ cE OPO A ION se CONN. We, Gncrt(w,0a), COncaTCos, ab) , CONCAT (, bbe )) Conca Tay bq Canmeat Coa, wy), BNar bw CONG (a 4) OD) costla oo) & ONOA S {TURN OVER} 5 cos2601 October/November 2017 QUESTION 4: Mathematical induction [10] (a) Provide a recursive definition for the set P of all integers greater than or equal to.0, (1) (b) formulate the associated induction principle, and then (1) (c) apply this induction principle to prove that n? + 2n is divisible by 3 for alln 2 0 (8) Remember that to prove x 1s divisible by 3 you need to show that x = 3y for some ye Z ° rs EP, Man Beanrye @ Sedlesalimane ge Peel bal dy iS a errienl 7A. 1f ea tic arn i a os\eth carey eee ee ene (o) pre aes BS ee en P suc, KLed 246 = 0420) 2 Emallgle & 2) Mmm CER te LP t2y < sy where — equredto pole VE A te (er 0 act ‘aid eee GJS Qe? ater) =e =e Ce ee) y Gia bul WEYL - ay, 2, = (44) 4 ay rane = Die Wop nO ee arom eel s Se NereQce Nee sume algo hushe Ra? queen gti beth ger and the al NSO be {TURN OVER] a arpze' OV lager speaker Wan O gacl, ML) ba be beebokt4 med meaning Lek CUS 's durshle ‘| Neal Lys ce sible. PAES 4 6 cos2601 October/November 2017 QUESTION 5: Finite automata [10] (a) Provide an example of a finite automaton (FA) that does not accept any words @) 4b [TURN OVER] 7 cosz2601 October/November 2017 (b) Consider the language L, defined over the alphabet 5 = (a 6}, consisting of all words that * are of even length, and * donot contain the ab-substring Build an FA (finite automaton) that accepts L_Note that it you provide a nondeterministic {inte automata (NFA) or transition graph (TG), the maximum mark you may be awarded 182 Ensure that you build a deterministic FA (8) (TURN OVER} 8 cos2601 October/November 2017 QUESTION 6: Regular language acceptors [10] Consider the following Mealy machine of Cy b/0 PG area (@) What isthe output f the mput stnnig aabab is run on the above Mealy machine? (1) AAO) (b) Convert the given Mealy machine to a Moore machine 6 [TURN OVER} 9 cos2601 October/November 2017 (©) Whats the output if the input string aabab is run on the Moore machine from (b)?__ (1) US (d) Ge a transition graph (TG) with two states that accepts the same language as the language accepted by the following finite automaton (FA) 3) [TURN OVER] 10 cos2601 October/November 2017 QUESTION 7: Kleene’s theorem (TG to RE) [10] By applying Kleene’s theorem, find a TG with 2 states that generates the language accepted by the following TG (10) [TURN OVER] "1 cos2601 October/November 2017 Eliminate state S_ liminate state _2. oleae @ Eimnate state_C. ae S60 bak eo bb fess (9). 4a, ao ¢ Eliminate state (givng the final regular expression) wm | . QO Gt) Coll thg)(20 taalt Kabes t aor si) [TURN OVER] 12 QUESTION 8: Kleene’s theorem (RE to FA) cos2601 October/November 2017 [10] Let ri and rz be regular expressions and FA: and FA be finite automata that accept exactly the languages defined by r and re respectively By applying Kleene's theorem, build another FA that accepts all the words of the language defined by ri + rz the union language) (10) FA e a FA Ve oe Cob ) 2 ao. +) QAO Use the table below to find your solution Some z states have been provided for you, and they are not an indication of how many you will need. Remember to indicate start and final state(s) New state 4 b Sema) %. {as Sa +] 2o Xe YY 22 Sanh Xa Yo = Sq + RursX, sles Mai ae ere Rie get st [TURN OVER} cos2601 October/November 2017 Now draw the new FA for ri + rz ITURN OVER} 14 COS2601 October/November 2017 QUESTION 9: Pumping lemma with length [10] Use the Pumping Lemma with length to prove that the following language is non-regular L=(aor'e,n20} (10) QE Ae OS [Neral €3) GS and sud There wiare WpSiie hoice(s) for y Use the prompts below to complete the proof ae es (Ze a) ules Then there whe ‘A Nv Mev ull Wasbdes cue Qn and sserds 9 We choose any word w= Cy e hy where. a NiGos.. Gea < Thus wecanwnte w= LD dow oll deni. Wy SNS Then according to the pumping lemma with length, bo. \\, > O 4 coneels ot. As on, Y consicle -V Vis a cenaels & Co om tenajake - and&, We We EM LeeRee accept a Cnde tan kets © Nisa 2017 [TURN OVER} 7 cos2601 October/November 2017 ROUGH WoRK Wotk done here wil not be marked [TURN OVER]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy