Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Similar documents
R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

JNTUWORLD. Code No: R

UNIT I PART A PART B

AUTOMATA THEORY AND COMPUTABILITY

Multiple Choice Questions


QUESTION BANK. Unit 1. Introduction to Finite Automata

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

CT32 COMPUTER NETWORKS DEC 2015

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

Answer All Questions. All Questions Carry Equal Marks. Time: 20 Min. Marks: 10.

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81%

CS 44 Exam #2 February 14, 2001

AUBER (Models of Computation, Languages and Automata) EXERCISES

Compiler Construction

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

QUESTION BANK B.TECH II YEAR II SEM (R17) ( ) DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Decidable Problems. We examine the problems for which there is an algorithm.

R10 SET a) Explain the Architecture of 8085 Microprocessor? b) Explain instruction set Architecture Design?

1. [5 points each] True or False. If the question is currently open, write O or Open.

CpSc 421 Final Solutions

Theory Bridge Exam Example Questions Version of June 6, 2008

Decision Properties for Context-free Languages

ROEVER COLLEGE OF ENGINEERING AND TECHNOLOGY Elambalur, Perambalur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-I AUTOMATA

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

CS402 - Theory of Automata FAQs By

Formal Languages and Automata

Models of Computation II: Grammars and Pushdown Automata

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

Theory of Computation

Formal Grammars and Abstract Machines. Sahar Al Seesi

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Final Course Review. Reading: Chapters 1-9

QUESTION BANK CS2303 THEORY OF COMPUTATION

PDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3)

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

Learn Smart and Grow with world

CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/ ItIauIafIaAblll~AladUnrtel1ity

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

Automata Theory CS S-FR Final Review

Outline. Language Hierarchy

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

UNIT 1 SNS COLLEGE OF ENGINEERING

Turing Machine Languages

Ambiguous Grammars and Compactification

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Formal Languages and Compilers Lecture VI: Lexical Analysis

KHALID PERVEZ (MBA+MCS) CHICHAWATNI

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

3 rd Year - Computer Science and Engineering,

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

CS154 Midterm Examination. May 4, 2010, 2:15-3:30PM

1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}.

Regular Languages. MACM 300 Formal Languages and Automata. Formal Languages: Recap. Regular Languages

Theory of Computation, Homework 3 Sample Solution

Pushdown Automata. A PDA is an FA together with a stack.

COMP 330 Autumn 2018 McGill University

Languages and Compilers

Front End: Lexical Analysis. The Structure of a Compiler

LECTURE NOTES THEORY OF COMPUTATION

CS402 - Theory of Automata Glossary By

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Chapter 14: Pushdown Automata

CS525 Winter 2012 \ Class Assignment #2 Preparation

LECTURE NOTES THEORY OF COMPUTATION

Glynda, the good witch of the North

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

Computer Sciences Department

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

Department of Computer Science and Engineering

Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

QUESTION BANK ADVANCED DATA STRUCTURES Class II B.Tech (CSE-A&B) II Sem Name of the Faculty- K. Nuka Raju

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

PS3 - Comments. Describe precisely the language accepted by this nondeterministic PDA.

Actually talking about Turing machines this time

2. Lexical Analysis! Prof. O. Nierstrasz!

DVA337 HT17 - LECTURE 4. Languages and regular expressions

Specifying Syntax COMP360

Introduction to Syntax Analysis

Regular Languages and Regular Expressions

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

CMPT 755 Compilers. Anoop Sarkar.

Automating Construction of Lexers

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6503 / THEORY OF COMPUTATION III YEAR / V SEM QUESTION BANK UNIT I AUTOMATA

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Transcription:

Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory which carries 25 marks. Answer all questions in Part A. Part B consists of 5 Units. Answer any one full question from each unit. Each question carries 10 marks and may have a, b, c as sub questions. PART-A 1) a) Define the terms alphabet, string, prefix, suffix, language give examples to each. b) Give DFA & NFA which accept the language { (10)n : n 0 } c) Define a linear grammar d) Define a ambiguous CFG e) Construct a CFG for the set of all strings over the alphabet {a,b} with exactly twice 10 as many a s and b s. f) Distinguish between DPDA and NPDA g) Explain the operations of a NPDA with diagram? h) Define unrestricted grammar. i) What is the modified version of PCP PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. R 13 3) Construct the corresponding Mealy machine to the Moore machine described by the transition table given. 4) a) Construct an equivalent unambiguous grammar on the below production rules. b) Construct an unambiguous grammar for all arithmetic expressions with no redundant parenthesis. A set of parenthesis is redundant if its removal does not change the expressions. E E + E / E * E / E / id 5) Explain left & right derivations and left & right derivation trees with examples? 6) State and prove pumping lemma for CFG? 7) Explain CNF with example? 8) Design Turing Machine to increment the value of any binary number by one. The output should also be a binary number with value one more the number given.

9) Explain LBA with example? 10) a) Design Turing Machine over b) Draw the transition diagram for above language. 11) a) Explain un decidability of posts with example? b) Explain universal Turing machine?

Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) PART-A 1) a) What are Universal Turing Machines b) Define computations of a TM? c) Define CFG and What are its advantages d) Define unit production. e) Find all strings in L ((a+b)*b(a+ab)*) of length less than four f) Compare NFA & DFA g) Write a note on applications of formal languages and automata. h) Define regular expression,give a regular expression for L={anbm : n 4, m 3} i) Prove or disprove the following for regular expressions r,s,and t (rs+r)r=r(sr+r)* PART-B 2) a) Construct DFA and NFA accepting the set of all strings containing 10 as a substring. b) Draw the transition diagram of a FA which accepts all strings of a's and b's in which both the number of b's and a's are even. c) Define NFA with epsilon with an example. 3) a) Construct a DFA with reduced states equivalent to the regular expression 10 + (0 + 11)0* 1. b) Prove (a + b)* = a*(ba*)* 4) prove pumping lemma of regular sets? 5) Explain left & right derivations and left & right derivation trees with examples? R 13 6) Convert the following Push down Automata to Context Free Grammar 7) Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3}, {a,b},p,s) Where P consists of the following 8) Design Turing Machine to increment the value of any binary number by one. The output should also be a binary number with value one more the number given. 9) Explain counter machine 10) What are the various variations of TM? How to achieve complex tasks using TM 11) a) Explain correspondence problem? b) Explain P and NP problems?

Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory which carries 25 marks. Answer all questions in Part A. Part B consists of 5 Units. Answer any one full question from each unit. Each question carries 10 marks and may have a, b, c as sub questions. PART-A 1) a) Give a description about FA with empty moves b) Define regular grammar with example. c) Give the set and explain in English the sets denoted by following regular expressions. i) (11+0) (00+1) ii) (1+01+001)(0+00) iii) (0+1)00(0+1) iv) 0 1 2 v) 00 11 22 d) Explain dependency graph & its applications in CFG. e) Prove the substitution rule of context free grammar? R 13 f) Give a CFG generating the following set that is the set of palindromes over alphabet{a,b} g) Let G be the grammar S->aS asbs epsilon. prove that L(G)={x each prefix of x has atleast as many a s and b s} PART-B 2) Design a Moore machine to determine the residue mod 5 for each binary string treated as integer. 3) Draw the transition table, transition diagram, transition function of DFA a) Which accepts strings which have odd number of a s and b s over the alphabet {a,b} b) Which accepts string which have even number of a s and b s over the alphabet {a,b} c) Which accepts all strings ending in 00 over alphabet {0, 1} d) Which accepts all strings having 3 consecutive zeros? e) Which accepts all strings having 5 consecutive ones? f) Which accepts all strings having even number of symbols? 4) Convert the following finite automata to regular expressions: 5) Find a Regular expression corresponding to each of the following subsets over {0,1}*. a) The set of all strings containing no three consecutive 0 s. b) The set of all strings where the 10th symbol from right end is a 1. c) The set of all strings over {0,1} having even number of 0 s & odd number of 1 s. d) The set of all strings over {0,1} in which the number of occurrences of is divisible by 3 6) Convert the following grammar into CNF. S->aAD A->aB->bAB B->b

D->d 7) Prove that the following language is not context-free language L={www w {a,b}*} is not context free. 8) a) Describe the TM that accepts the language L = {w a{a,b,c}_ w contains equal number of a s, b s, and c s}. b) Explain in detail Church s hypothesis. 9) a) Design a Turing Machine that accepts the set of all even palindromes over {0,1}. b) Given _ = {0,1}, design a Turing machine that accepts the language denoted by the regular expressions 00* 10) a) What is decidability? Explain any two undecidable problems. b) Show that the following post correspondence problem has a solution and give the solution. I List A List B 1 11 11 2 100 001 3 111 11 11) a) Find whether the post correspondence problem P={(10,101),(011,11),(101,011)} has a match. Give the solution. b) Explain Turing reducibility machines. c) Show that if L and L? Are recursively enumerable, and then L is recursive.

Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory which carries 25 marks. Answer all questions in Part A. Part B consists of 5 Units. Answer any one full question from each unit. Each question carries 10 marks and may have a, b, c as sub questions. PART-A 1) a) Find the DFA that recognizes the set of all string on Σ={a,b} starting with the prefix ab b) Construct a DFA & NFA to accept all string in {a,b} such that every a has one b immediately 8 to its right? c) Find all strings in L ((a+b)*b(a+ab)*) of length less than four d) Prove the following identities for regular expression r,s and t here r=s means 6 L(r)=L(s) r+s=s+r, (rs)t=r(st),(r+s)t=rt+st e) Find the NFA that accepts the language L{ab*aa+bba*ab) f) What are CFG s Give CFG for the language L= {an b2n n>0} g) Define context free grammars formally. Give some examples. h) Why FAs are less powerful than the PDA s R 13 PART-B 2) a) Construct DFA and NFA accepting the set of all strings not containing 101 as a substring. b) Draw the transition diagram of a FA which accepts all strings of 1's and 0's in which both the number of 0's and 1's are even. c) Define NFA with an example. 3) a) Draw the transition diagram of a FA which accepts all strings of 1's and 0's in which both the number of 0's and 1's are even. b) Construct NFA which accepts the set of all strings over f0; 1g in which there are at least two occurrences of 1 between any two occurrences of 0. Construct DFA for the same set. 4) Represent the following sets by regular expressions 5) Discuss about a) Context Free Grammar b) Left most derivation c) Right most derivation d) Derivation tree. 6) Which of the following are CFL's? Explain

7) a) Eliminate epsilon productions from the grammar `G' given as b) Convert the following grammar to Greibach Normal Form 8) Write a note on Turing Thesis. Define algorithm in terms of TM. 9) Write short notes on: a) Halting Problem of Turing Machine b) Application of CFG c) Multi Tape Turing Machine d) Post-Correspondence Problem 10) a) Find whether the post correspondence problem P={(10,101),(011,11),(101,011)} has a match. Give the solution. b) Explain Turing reducibility machines. c) Show that if L and L? Are recursively enumerable, and then L is recursive. 11) Write brief about the following a) Decidability of problems b) RICE Theorem c) Undecidability of post correspondence problem.

Code No: R09220504 R09 Set No. 2 II B.Tech II Semester Examinations,December-January, 2011-2012 Computer Science And Engineering Answer any FIVE Questions All Questions carry equal marks 1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata. (b) Convert the following Context Free Grammar to Push Down Automata S aaa A as bs a. [7+8] 2. Describe, in the English language, the sets represented by the following regular expressions: (a) a(a+b)*ab (b) a*b + b*a [15] 3. (a) What is unit production? Explain the procedure to eliminate unit production with example. (b) What is ε-production? (c) What is the use of Chomsky Normal Form or Greibach Normal Form?[6+5+4] 4. The grammar E E + E E * E (E) id. Generate the set of arithmetic expressions with +, *, paranthesis and id. The grammar is ambiguous since id + id * id can be generated by two distinct left most derivations. (a) Construct an equivalent unambiguous grammar. (b) Construct an unambiguous grammar for all arithmetic expressions with no redundant paranthesis. A set of paranthesis is redundant if its removal does not change the expressions. [7+8] 5. (a) Construct a Mealy machine which is equivalent to the Moore machine given in table. Present State Next State Output a=0 a=1 q 0 q 3 q 1 0 q 1 q 1 q 2 1 q 2 q 2 q 3 0 q 3 q 3 q 0 0 (b) Construct the corresponding Mealy machine to the Moore machine described by the transition table given. 1

Code No: R09220504 R09 Set No. 2 Present State Next State Output a=0 a=1 q 1 q 1 q 2 0 q 2 q 1 q 3 0 q 3 q 1 q 3 1 [7+8] 6. Design Turing Machine for recognition of binary palindromes. [15] 7. (a) Consider the Finite State Machine whose Transition function δ is given in the form of a transition table (figure 1). Here, Q = {q 0,q 1,q 2,q 3 }, Σ ={0,1},F={q 0 }. Give the entire sequence of states for the inputstring 110001. Transition Table: Figure 1: (b) Let M = (Q,Σ,δ, q0, F) be a finite automaton. Let R be a relation in Q defined by q 1 R q 2 if δ (q 1,a)=δ(q 2,a) for some a Σ. Is R an equivalence relation? [8+7] 8. Construct LR(0) items for the grammar given find it s equivalent DFA S AB aab A a Aa B b [15] 2

Code No: R09220504 R09 Set No. 4 II B.Tech II Semester Examinations,December-January, 2011-2012 Computer Science And Engineering Answer any FIVE Questions All Questions carry equal marks 1. Represent the following sets by regular expressions (a) {0,1,2} (b) {1 2n+1 n>0} (c) {w ε{a, b}* w has only one a } (d) The set of all strings over {0,1}, which has at most two zeros [15] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3}, {a,b},p,a) Where P consists of the following A1 A2 A3 A2 A3 A1 b A3 A1 A2 a [15] 3. Construct (a) A context-free but not regular grammar. (b) A regular grammar to generate {a n n>=1}. [15] 4. (a) Design a Turing Machine to perform following computations q 0 w q f ww, w ε {0}* (b) Turing Machine not only used for recognizing language but also computes. Explain. [9+6] 5. (a) Draw the transition diagram of a FA which accepts all strings of 1 s and 0 s in which both the number of 0 s and 1 s are even. (b) Construct NFA which accepts the set of all strings over {0, 1} in which there are at least two occurrences of 1 between any two occurrences of 0. Construct DFA for the same set. [7+8] 6. (a) Construct a NFA accepting {ab,ba} and use it to find a DFA accepting the same set. (b) Write the steps in construction of minimum automaton. [8+7] 7. Construct LR(0) items for the grammar given find it s equivalent DFA. S ( S ) a [15] 8. Which of the following are CFL s? explain 3

Code No: R09220504 R09 Set No. 4 (a) {a i b j i j and i 2j} (b) {a i b j i 1 and j 1} (c) {(a+b)*- {a n b n n 1}} (d) {a n b n c m n m 2n }. [15] 4

Code No: R09220504 R09 Set No. 1 II B.Tech II Semester Examinations,December-January, 2011-2012 Computer Science And Engineering Answer any FIVE Questions All Questions carry equal marks 1. (a) Write the steps in construction of minimum automaton. (b) Draw NFA without ε-moves transition with diagram and table equivalent to NFA whose transition table is given. [7+8] 2. Discuss about (a) Composite Turing Machine (b) Universal Turing Machine (UTM). [7+8] 3. (a) Explain the procedure to convert Push Down Automata to Context Free Grammar. (b) Convert the following Context Free Grammar to Push Down Automata S ( S ) S ε. [7+8] 4. (a) Define DFA. (b) Give DFA accepting the set of all strings such that every block of 5 consecutive symbols contains at least two 0 s over an alphabet {0, 1}. (c) Construct the NFA accepting the set of all strings with an equal number of 1 s and 0 s such that no prefix has two more 0 s than 1 s nor two more 1 s than 0 s over an alphabet {0, 1}. Give one example string which is accepted by this NFA and write the sequence of steps. [2+6+7] 5. (a) What is context sensitive grammar? Give examples. (b) Let Σ = { 0, 1 } and A,B be the list of 3 strings each. Verify below PCP has a solution or not? List A List B I W i X i 1 00 0 2 001 11 3 1000 011 [7+8] 6. Construct a transition system corresponding to the regular expressions (a) (ab + a)* (aa +b) (b) a*b + b*a [15] 7. Construct context-free grammars to generate the following 5

Code No: R09220504 R09 Set No. 1 (a) {o m 1 n m n, m, n >= 1}. (b) {a l b m c n one of l, m, n equals 1 and the remaining two are equal}. [7+8] 8. (a) Eliminate ε - productions from the grammar G given as A abb bba B ab bb ε. (b) Convert the following grammar to Greibach Normal Form S ABA AB BA AA B A aa a B bb b. [7+8] 6

Code No: R09220504 R09 Set No. 3 II B.Tech II Semester Examinations,December-January, 2011-2012 Computer Science And Engineering Answer any FIVE Questions All Questions carry equal marks 1. (a) If G=({S}, {0, 1}, {S 0S1, S ε}, S), find L(G). (b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [7+8] 2. (a) Construct DFA and NFA accepting the set of all strings not containing 101 as a substring. (b) Draw the transition diagram of a FA which accepts all strings of 1 s and 0 s in which both the number of 0 s and 1 s are even. (c) Define NFA with an example. [6+5+4] 3. (a) Write the applications of Finite Automata. (b) Define NFA with ε-moves. (c) Draw NFA with ε -moves transition diagram and table which accepts the language consisting of any number (including zero) of 0 s followed by any number (including zero) of 1 s followed by any number (including zero) of 2 s. [6+2+7] 4. (a) Consider the fallowing grammar G = ({S,A},{a,b},P,S) Where P consists of S aas / a A SbA / SS / ba For the string aabbaa show i. Left Most Derivation ii. Right Most Derivation iii. Parse Tree (b) Find the Context Free Language generated by the following grammar G=({S},{a,b},P,S) where P: S asb ab [7+8] 5. Design Push Down Automata for L = {a 2n b n n 1}. [15] 6. Write briefly about the following (a) Decidability of problems (b) RICE Theorem (c) Undecidability of post correspondence problem. [5+5+5] 7. Design Turing Machine which will recognize strings containing equal number of 0 s and 1 s. [15] 7

Code No: R09220504 R09 Set No. 3 8. (a) construct a finite automaton accepting all strings over {0, 1} ending in 010 or 0010. (b) Show that the set L= {a pow(i,2) >= 1} is not regular. [pow(i,2) = i 2 ] [7+8] 8