Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five questions All questions carry equal marks - - - 1.a) What is Automata? Discuss why study automata. b) Define DFA and Design the DFA for the following languages on Σ = {a, b} i) The set of all strings that either begins or ends or both with substring ab. ii) The set of all strings that ends with substring abb. [15] 2.a) Design an NFA that accepts the language (aa*(a+b)*). b) Consider the following NFA ε ε a b c p Φ {p} {q} {r} q {p} {q} {r} Φ r {q} {r} Φ {p} i) Compute the ε-closure of each state. ii) Give all the strings of length 3 or less accepted by the automation. iii) Convert the automation to DFA. [15] 3.a) Prove that every language defined by a Regular expression is also defined by Finite automata. b) State and prove pumping lemma for regular languages. Apply pumping lemma for following language and prove that it is not regular L={a n / n is prime}. c) If L 1 and L 2 are regular languages then prove that family of regular language is closed under L 1 -L 2. [15] 4.a) Define CFG. Obtain CFG for the following languages i) L={ R WW W is in (a,b)*, R W is the reversal of W} ii) L=(W W has a substring} b) What is an ambiguous grammar? Show that the following grammar is ambiguous E E+E E-E E*E E/E (E) a where E is the start symbol. Find the unambiguous grammar. [15] 5.a) Define PDA and construct a PDA that accepts the following languages L={W W is in (a+b)* and number of a s equal to number of b s} write the instantaneous description for the string aababb. b) For the following grammar construct a PDA S aabb aaa A abb a B bbb A C a. [15] 6.a) State and prove pumping lemma for context free languages. b) What are CNF and GNF for context free grammar? Give examples. c) Using CFL pumping lemma show that the following language is not context free L={a i b j c k i<j<k}. [15]
7.a) What is Turing Machine and Multi tape Turing Machine? Show that the language accepted by these machines are same. b) Design Turing Machine for the language to accept the set of strings with equal number of 0 s and 1 s and also give the instantaneous description for the input 110100. [15] 8. Write short notes on a) Homomorphism b) Recursive Languages c) Post s correspondence problem. [15] ********
Code No: R09220504 R09 SET-2 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five questions All questions carry equal marks - - - 1.a) Define the following terms. i) Alphabets ii) Strings iii) Power of an alphabet iv) Language. b) Define DFA. Design a DFA to accept the binary numbers which are divisible by 5. [15] 2.a) Consider the transition table of DFA given below: 0 1 A B A B A C C D B D D A E D F F G E G F G H G D i) Draw the table of distinguish abilities of this automaton. ii) Construct the minimum state equivalent DFA. b) Design an NFA that accepts the language (0+1)*1(0+1)*. [15] 3.a) Define a regular expression. Find the regular expression for the Language L={a 2n b 2m n 0, m 0}. b) State pumping lemma for regular languages. Prove that the following language {a n b n n 1} is not regular. c) Convert the regular expression (01+1)* to an NFA ε. [15] 4.a) Define Context free grammar and write context free grammar for the languages i) L={a i b j c k i+j=k,i 0,j 0} ii) L={a n b m c k n+2m=k}. b) Consider the Grammar E +EE *EE -EE x y. Find the leftmost and rightmost derivation for the string +*-xyxy and write parse tree. c) What is ambiguous grammar? Prove that the following grammar is ambiguous on the string aab S as asbs ε. [15] 5.a) Define PDA. Discuss about the languages accepted by a PDA. Design a Non Deterministic PDA for the language L={0 n 1 n n 1}. b) Convert the following grammar to a PDA that accepts the same language by empty stack. S 0S1 A A 1A0 S ε [15]
6.a) What are useless Symbols? Remove all useless Symbols and all ε productions from the grammar S aa ab A aaa B ε B b bb D B b) Define CNF. Convert the following CFG to CNF S ASB ε A aas a B SbS A bb. [15] 7.a) With a neat diagram, explain the working of a basic Turing Machine. Design a Turing Machine to accept L={1 n 2 n 3 n n 1} b) Explain the differences between PDA and T M. [15] 8. Write short notes on a) Multi tape Turing Machine b) Post s correspondence problem c) Chomsky hierarchy. [15] ********
Code No: R09220504 R09 SET-3 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five questions All questions carry equal marks - - - 1.a) Define the following i) Power of an alphabet ii) NFA b) Design a DFA to accept the following language over the alphabet {0,1} i) L={w / w is an even number} ii) L={(01) i 1 2j / i 1, j 1} iii) The set of strings either start with 01 or end with 01. [15] 2.a) Define distinguishable and indistinguishable states. Minimize the following DFA. 0 1 A B F B G C C A C D C G E H F F C G G G E H G C b) Explain in detail with an example the conversion of NDFA to DFA. [15] 3.a) Write the regular expressions for the following languages i) The set of all strings over Σ={a,b,c} containing atleast one a and atleast one b ii) The set of strings of 0 s and 1 s whose 10 th symbol from the right end is 1. b) Convert the regular expression (0+1)*1(0+1)* to an NFA ε. c) State and prove the pumping lemma for regular languages. [15] 4.a) Define CFG. Write CFG for the language L={0 n 1 n n 1} i.e. the set of all strings of one or more 0 s followed by an equal number of 1 s. b) Consider the grammar S as/asbs/ε Is the above grammar ambiguous? Show in particular that the string aab has no: i) Parse tree ii) Leftmost derivation iii) Rightmost derivation. [15] 5.a) Discuss the languages accepted by a PDA. Design a PDA for the language that accepts the strings with number of a s less than number of b s where w is in (a+b)* and show the instantaneous description of the PDA on input abbab. b) Convert the following grammar to a PDA that accepts the same language by empty stack S 0S1 A A 1A0 S ε [15]
6.a) What are useless symbols? Eliminate Null, unit and useless production from the following grammar S AaA CA BaB A aaba CDA aa DC B bb bab bb as C Ca bc D D bd ε b. What is CNF and GNF? Obtain the following grammar in CNF S aba abba A ab AA B ab a [15] 7.a) Explain with neat diagram, the working of a Turing Machine model. b) Design a Turing machine to accept all set of palindromes over {0,1}*. Also write its transition diagram all Instantaneous description on the string 10101. [15] 8. Write short notes on the following a) post s Correspondence problem b) Recursive languages c) Universal Turing Machine. [15] ********
Code No: R09220504 R09 SET-4 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five questions All questions carry equal marks - - - 1.a) Define the following terms with an example for each i) Transition Table ii) Transition Diagram iii) Power set iv) Language. b) Mention the differences between DFA, NFA and NFA ε. [15] 2.a) Prove the equivalence of NFA and DFA. b) Define Moore and Mealy machines with examples. [15] 3.a) Define a regular expression. Find regular expression for the following languages on {a,b} i) Language of all strings w such that w contains exactly one 1 and even number of 0 s. ii) Set of strings over {0,1,2} containing atleast one 0 and atleast one 1. b) Prove that if L is regular language over alphabet Σ then L is also regular language. c) Prove that the language L={0 n 1 n+1 n>0} is not regular. [15] 4.a) Construct the CFG for the following languages i) L={a 2n b m n 0,m 0} ii) L={0 i 1 j 2 k i=j or j=k} and generate leftmost derivation for the string 01122. b) Define ambiguous Grammar. Prove that the following grammar is Ambiguous. Find an unambiguous grammar. S as asbs ε [15] 5.a) Define PDA and Design PDA to accepts the following languages by final state L={W W is in (a+b)* and number of a s equal to number of b s}. Draw the graphical representation of PDA. Also show the moves made by the PDA for the string abbaba. b) Convert the following CFG to PDA S aabb aaa A abb a B bbb A C a [15] 6.a) Consider the grammar S ABC BaB A aa BaC aaa B bbb a D C CA AC d ε i) Eliminate NULL productions ii) Eliminate Unit Productions in the resulting grammar iii) Eliminate Useless Symbols in the resulting grammar. b) What is CNF? Convert the following grammar into CNF S ABa A aab B Ac [15]
7.a) With a neat diagram, explain the working of a basic Turing Machine. Design a Turing Machine to accept L={WW R W is in (a+b)*} b) Explain the general structure of multi-tape and deterministic Turing Machines and show that these are equivalent to basic Turing machine. [15] 8. Write short notes on a) Post Correspondence problem b) Chomsky hierarchy c) Homomorphism. [15] ********