QUESTION BANK. Unit 1. Introduction to Finite Automata

Similar documents
JNTUWORLD. Code No: R

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

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

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


Multiple Choice Questions

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

UNIT I PART A PART B

CT32 COMPUTER NETWORKS DEC 2015

Compiler Construction

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

AUTOMATA THEORY AND COMPUTABILITY

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

(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

AUBER (Models of Computation, Languages and Automata) EXERCISES

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

Ambiguous Grammars and Compactification

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

Formal Languages and Automata

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

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

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

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

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

CS 44 Exam #2 February 14, 2001

Final Course Review. Reading: Chapters 1-9

COMP 330 Autumn 2018 McGill University

Theory of Computation

Chapter 14: Pushdown Automata

3 rd Year - Computer Science and Engineering,

UNIT 1 SNS COLLEGE OF ENGINEERING

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

Decision Properties for Context-free Languages

Actually talking about Turing machines this time

CS402 - Theory of Automata FAQs By

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

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

Regular Languages and Regular Expressions

Automata Theory CS S-FR Final Review

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]

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 ǫ.

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

KHALID PERVEZ (MBA+MCS) CHICHAWATNI

Models of Computation II: Grammars and Pushdown Automata

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

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

Formal Grammars and Abstract Machines. Sahar Al Seesi

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

Theory Bridge Exam Example Questions Version of June 6, 2008

CSE 431S Scanning. Washington University Spring 2013

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

The CYK Algorithm. We present now an algorithm to decide if w L(G), assuming G to be in Chomsky Normal Form.

Lec-5-HW-1, TM basics

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Outline. Language Hierarchy

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

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limits of Computation p.1/?? Limits of Computation p.2/??

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

CMSC 330, Fall 2009, Practice Problem 3 Solutions

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

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

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

Context-Free Languages. Wen-Guey Tzeng Department of Computer Science National Chiao Tung University

Glynda, the good witch of the North

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

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

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

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

Chapter Seven: Regular Expressions

ECS 120 Lesson 16 Turing Machines, Pt. 2

Learn Smart and Grow with world

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

ECS 120 Lesson 7 Regular Expressions, Pt. 1

CS402 - Theory of Automata Glossary By

Theory of Computations Spring 2016 Practice Final Exam Solutions

Context-Free Languages. Wen-Guey Tzeng Department of Computer Science National Chiao Tung University

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

Context-Free Languages. Wen-Guey Tzeng Department of Computer Science National Chiao Tung University

Context-Free Languages. Wen-Guey Tzeng Department of Computer Science National Chiao Tung University

Computer Sciences Department

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

QUESTION BANK CS2303 THEORY OF COMPUTATION

Turing Machine Languages

Theory of Computation, Homework 3 Sample Solution

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

Introduction to Computers & Programming

Automating Construction of Lexers

Context-Free Grammars

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

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016

CSE 105 THEORY OF COMPUTATION

Dr. D.M. Akbar Hussain

Theory of Computations Spring 2016 Practice Final

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

1 Parsing (25 pts, 5 each)

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Formal Languages. Grammar. Ryan Stansifer. Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901

Transcription:

QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )(Jun-Jul 10) 2. Obtain a DFA to accept strings of a s and b s having even number of a s and b s.( 5m )(Jun-Jul 10) 3. Give Applications of Finite Automata. (5m )(Jun-Jul 10) 4. Define DFA, NFA & Language? (5m)( Jun-Jul 10) 5. Obtain a DFA to accept strings of a s and b s starting with the string ab. (6m )(Dec-Jan 10) (Jun-Jul 12) 6. Draw a DFA to accept string of 0 s and 1 s ending with the string 011. (4m)( Dec-Jan 10) (Jun-Jul 12) 7. Write DFA to accept strings of 0 s, 1 s & 2 s beginning with a 0 followed by odd number of 1 s and ending with a 2. (10m )(Dec-Jan 10)(Jun-Jul 12) 8. Design a DFA to accept string of 0 s & 1 s when interpreted as binary numbers would be multiple of 3. (5m )(Jun-Jul 11) 9. Find closure of each state and give the set of all strings of length 3 or less accepted by automaton.(5m )(Jun-Jul 11) 10. Obtain a DFA to accept strings of a s and b s having a sub string aa. (5m)(Jun-Jul-11) 11. Write Regular expression for the following L = { a n b m : m, n are even} L = { a n,b m : m>=2, n>=2}.(5m)(jun-jul 11) 12. δ a b p {r} {q} {p,r} q I {p} I *r {p,q} {r} {p} Convert above automaton to a DFA.(10m)(Dec-Jan 11) 13. Convert following NFA to DFA using subset construction method.(10m)(dec-jan 11) δn 0 1 p q *r *s {p,r} {r,s} {p,s} {q,r} {q} {p} {r} I Dept of CSE, SJBIT 1

14. Convert the following DFA to Regular Expression (10m)(Dec Jan-12) 15. Define NFA. With example explain the extended transition function(5m)(dec Jan-12) 16. Explain the ground rules of finite automata.(5m)(dec-jan12) Dept of CSE, SJBIT 2

UNIT 2 Finite Automata, Regular Expressions 1. P.T. Let R be a regular expression. Then there exists a finite automaton M = (Q,, G, q0, A) which accepts L(R). (10m)( June- july 2010) 2. Define derivation, types of derivation, Derivation tree & ambiguous grammar. Give example for each. (4m)(June- July 2010) 3. Obtain an NFA to accept the following language L = {w w abab n or aba n where n t 0} (6m)(June- July- 2010) 4. Convert the following NFA into an equivalent DFA. (10m)( Dec- Jan 2010) (Jun-Jul 12) 5. Convert the following NFA to its equivalent DFA(10m)( Dec- Jan 2011) (Jun-Jul 12) 6. Obtain an NFA which accepts strings of a s and b s starting with the string ab. ). (7m)( June- july 2011) 7. Define grammar? Explain Chomsky Hierarchy? Give an example (6m)(June- July 2011) 8. Is the following grammar ambiguous (7m)(June- July 2011) (Jun-Jul12) S -> ab ba A -> as baa a Dept of CSE, SJBIT 3

B -> bs abb b 9. Obtain grammar to generate string consisting of any number of a s and b s with at least one b. ( 5m)(Dec- Jan 2011) 10. Obtain a grammar to generate the following language L ={WWR Where W {a, b}*}. ( 5m)(Dec- Jan 2011) 11. Obtain a grammar to generate the following language: L = { 0 m 1 m 2 n m>= 1 and n>=0}. (5m)( Dec- Jan 2011) (Jun-Jul12) 12. Obtain a grammar to generate the following language: ( 5m)(Dec- Jan 2011) L = { w n a(w) > n b(w) } L = { a n b m c k n+2m = k for n>=0, m>=0} 13. Define PDA. Obtain PDA to accept the language L = {a n b n n>=1} by a final state. (5m)( Dec- Jan 2011) 14. Write a short note on application of context free grammar. ( 7m)(Dec- Jan 2012) 15. Explain finite automata with epsilon transition. (7m)(Dec-Jan 12) 16. Explain the application of regular expression (6m)(Dec-Jan 12) Dept of CSE, SJBIT 4

Unit 3 Regular Languages, Properties of Regular Languages 1. Prove pumping lemma? (4m)( June-July 2010) 2. Prove that L={w w is a palindrome on {a,b}*} is not regular. i.e., L={aabaa, aba, abbbba, } ( 8m)(June-July 2010) 3. Prove that L={ all strings of 1 s whose length is prime} is not regular. i.e., L={1 2,1 3,1 5,1 7,1 11,----} (8m)(June-July 2010) 4. Let M = (Q,, G, q0, A) be an FA recognizing the language L. Then there exists an equivalent regular expression R for the regular language L such that L = L(R). (8m)( Dec- Jan 2010) 5. What is the language accepted by the following FA. ( 6m)(Dec-Jan 2010) 6. Write short note on Applications of Regular Expressions ( 6m)(Dec-Jan 2010) 7. Show that following languages are not regular (10m)(June-July 2011) (Jun-Jul12) L={a n b m n, mt0 and n<m } L={a n b m n, mt0 and n>m } L={a n b m c m d n n, mt1 } L={a n n is a perfect square }L={a n n is a perfect cube } 8. Apply pumping lemma to following languages and understand why we cannot complete proof (10m)(June-July 2011) L={anaba n t0 } L={anbm n, mt0 } 9. Obtain a DFA to accept strings of a s and b s starting with the string ab (10m)( Dec-Jan 2011) 10. Obtain a regular expression for the FA shown below: (10m)( Dec-Jan 2011) (Jun-Jul12) Dept of CSE, SJBIT 5

11. Solve: (10m)(Dec-Jan12) 12. Explain Closure properties with an example. (10m)(Dec-Jan12) Dept of CSE, SJBIT 6

UNIT 4 Context-Free Grammars And Languages 1. P.T. If L and M are regular languages, then so is L M. (10m)June-July 2010) 2. Write a DFA to accept the intersection of L1=(a+b)*a and L2=(a+b)*b that is for L1 ˆL2. ( 10m)(June-July 2010) (Jun-Jul12) 3. Find the DFA to accept the intersection of L1=(a+b)*ab (a+b)* and L2=(a+b)*ba (a+b)* and that is for L1 ˆ L2 (10m)( Dec-Jan 2010) 4. P.T. If L and M are regular languages, then so is L M. ( 10m)(Dec-Jan 2010) 5. Design context-free grammar for the following cases (10m)(June-July 2011) L={ 0n1n n l } L={aibjck i j or j k} 6. Generate grammar for RE 0*1(0+1)* (10m)(June-July 2011) 7. P.T. If L is a regular language over alphabet S, then L = 6* - L is also a regular language. ( 8m)(Dec-Jan 2011) (Jun-Jul12) 8. P.T. - If L is a regular language over alphabet 6, then, L = 6* - L is also a regular language. ( 8m)(Dec-Jan 2011) 9. P.T. If L is a regular language, so is L R ( 6m)(Dec-Jan 2011) 10.. If L is a regular language over alphabet 6, and h is a homomorphism on 6, then h (L) is also regular. ( 10m)(Dec-Jan 2012). 11. Explain CGF with an example.. ( 5m)(Dec-Jan 2012) 12. Explain decision properties of regular language.. ( 5m)(Dec-Jan 2012) Dept of CSE, SJBIT 7

UNIT 5 Pushdown Automata 1.. Give leftmost and rightmost derivations of the following strings a) 00101 b) 1001 c) 00011 (4m)(June-July 2010) 2. Construct PDA: For the language (4m)(June-July2010) (Jun-Jul12) 3. Construct DPDA which accepts the language L = {wcwr w {a, b}*, c Σ}. (4m)(June-July 2010) (Jun-Jul12) 4. Construct DPDA for the following: (8m)(June-July 2010) Accepting the language of balanced parentheses. (Consider any type of parentheses) Accepting strings with number of a s is more than number of b s Accepting {0n1m n t m} 5. Design npda to accept the language: ( 10m)(Dec-Jan 2010) (Jun-Jul12) {aibjck i, j, kt0and i = j or i = k} {aibjci+j i, jt0} {aibi+jcj it0, jt1} 6. Construct PDA: For the language L = {anb2n a, b Σ, n t 0}( 5m)(Dec-Jan 2010) 7. Construct PDA to accept if-else of a C program and convert it to CFG. (This does not accept if if else-else statements) ( 5m)(Dec-Jan 2010) 8. Show that deviation for the string aab is ambiguous. (5m)(June-July 2011) 9. Suppose h is the homomorphism from the alphabet {0,1,2} to the alphabet { a,b} defined by h(0) = a; h(1) = ab & h(2) = ba a) What is h(0120)? b) What is h(21120)? c) If L is the language L(01*2), what is h(l)? d) If L is the language L(0+12), what is h(l)? If L is the language L(a(ba)*), what is h-1(l)? (5m)(June-July 2011) 10. Design a PDA to accept the set of all strings of 0 s and 1 s such that no prefix has more 1 s than 0 s. (5m)(June-July2011) 11. Construct PDA: Accepting the set of all strings over {a, b} with equal number of a s and b s. Show the moves for abbaba. (5m)(June-July2011) 12. Construct PDA: Accepting the language of balanced parentheses, (consider any type of parentheses). ( 5m)(Dec-Jan 2011) Dept of CSE, SJBIT 8

13. Construct PDA to accept by final state the language of all strings of 0 s and 1 s such that number of 1 s is less than number of 0 s. Also convert the PDA to accept by empty stack. (5m)( Dec-Jan 2011) 14. How do you convert From PDA to CFG. ( 5m)(Dec-Jan 2011) 15. Convert PDA to CFG. PDA is given by P = ({p,q}, {0,1}, {X,Z}, δ, q, Z)), Transition function δ is defined by ( 5m)(Dec-Jan 2011) δ(q, 1, Z) = {(q, XZ)} δ(q, 1, X) = {(q, XX)} δ(q, H, X) = {(q, H)} δ(q, 0, X) = {(p, X)} δ(p, 1, X) = {(p, H)} 16. Convert to PDA, CFG with productions ( 10m)(Dec-Jan 2012) A o aaa, A -> as bs a S -> SS (S) H S -> aas bab ab, A -> bbb as a, B -> ba a 17. Explain push down automata with an example( 10m)(Dec-Jan 2012) Dept of CSE, SJBIT 9

UNIT 6 Properties of Context-Free Languages 1. Eliminate the n->n-generating symb->ls fr->m S -> as A C, A ->a, B -> aa, C - > acb. (8m)(June-July 2010) 2. Draw the dependency graph as given above. A is non-reachable from S. After eliminating A, G1= ({S}, {a}, {S -> a}, S). (6m)(June-July 2010) 3. Find out the grammar without H Productions G = ({S, A, B, D}, {a}, {S o as AB, A -> H, B-> H, D ->b}, S). (6m)(June-July 2010) 4. Eliminate n->n-reachable symbols from G= ({S, A}, {a}, {S -> a, A ->a}, S) (10m)(Dec-Jan 10) (Jun-Jul12) 5. Eliminate non-reachable symbols from S -> as A, A -> a, B -> aa. (10m)(Dec- Jan 10) 6. Eliminate useless symbols from the grammar with productions S -> AB CA, B - >BC AB, A ->a, C -> AB b. (5m)(June-July 2011) 7. Eliminate useless symbols from the grammar (5m)(June-July 2011) P= {S o aaa, A ->Sb bcc, C ->abb, E -> ac} P= {S -> aba BC, A -> ac BCC, C ->a, B -> bcc, D -> E, E ->d} P= {S -> aaa, A -> bbb, B -> ab, C -> ab} P= {S -> as AB, A -> ba, B -> AA}. 8. Write Algorithm to find nullable variables. (5m)(June-July 2011) 9. Eliminate H - productions from the grammar. (5m)(June-July 2011) S -> a Xb aya, X -> Y H, Y -> b X S -> Xa, X -> ax bx H S -> XY, X ->Zb, Y -> bw, Z ->AB, W ->Z, A -> aa bb H, B -> Ba Bb H S -> ASB H, A -> aas a, B -> SbS A bb 10. Eliminate H - pr->ductions and useless symbols from the grammar S ->a aa B C, A ->ab H, B ->aa, C ->acd, D ->dd. (10m)(Dec-Jan-2011) (Jun-Jul12) 11. Show that L = {aibici i t1} is not CFL. (10m)(Dec-Jan 2011) 12. Show that L = {ww w {0, 1}*} is not CFL. (10m)( Dec-Jan 2012) 13. Using pumping lemma for CFL prove that below languages are not context free {p p is a prime}.. ( 10m)(Dec-Jan 2012) Dept of CSE, SJBIT 10

UNIT 7 Introduction To Turing Machine 1. Explain with example problems that Computers cannot solve.(6m)( June- July2010) 2. Explain briefly the following Halting problem.. ( 4m)(June-July2010) 3. Explain Programming techniques for Turning Machines( 10m)(Dec-Jan-2010) 4. Design a Turing machine to accept a Palindrome. ( 10m)(Dec-Jan-2011) 5. Design a TM to recognize a string of the form a n b 2n. ( 10m)(June-July2010) 6. Design a Turing machine to accept a Palindrome. ( 10m)(Dec-Jan-2012) (Jun- Jul12) 7. Define undesirability, decidability. (10m)( June-July 2011) (Jun-Jul12) 8. Post s Correspondence problem Design a TM to recognize a string of 0s and 1s such that the number of 0s is not twice as that of 1s. ( 10m)(Dec-Jan 2012) UNIT 8 Undecidability 1. Design a TM to recognize a string of the form a n b 2n. ( 10m)(June-July2010) 2. P.t If L is a recursive language, L is also recursive. ( 10m)( June-July2010) 3. Design a Turing Machine to recognize 0n1n2n. (10m)( Dec-Jan 2010) (Jun-Jul12) 4. Explain briefly the following Halting problem(6m)( Dec-Jan 2010) 5. Define undesirability, decidability. (8m)( June-July 2011) 6. Post s Correspondence problem Design a TM to recognize a string of 0s and 1s such that the number of 0s is not twice as that of 1s. (10m)( Dec-Jan 2012) (Jun- Jul12) 7. Design a Turing machine to accept a Palindrome. ( 7m)(Dec-Jan-2011) 8. Write a short note on: (20m) Dec-Jan 2012) a. Undesirability, Dept of CSE, SJBIT 11

b. Halting problem, c. decidability. Dept of CSE, SJBIT 12