# QUESTION BANK. Unit 1. Introduction to Finite Automata

Size: px
Start display at page:

Transcription

1 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

2 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

3 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

4 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

5 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

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

7 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

8 UNIT 5 Pushdown Automata 1.. Give leftmost and rightmost derivations of the following strings a) b) 1001 c) (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

9 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

10 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

11 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

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

### JNTUWORLD. Code No: R

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

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

R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that

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

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

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

QUESTION BANK Formal Languages and Automata Theory(10CS56) Chapter 1 1. Define the following terms & explain with examples. i) Grammar ii) Language 2. Mention the difference between DFA, NFA and εnfa.

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject

### Multiple Choice Questions

Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

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

Multiple choice type questions. Which of the following regular expressions over {, } denotes the set of all strings not containing as a sub-string? 2. DFA has a) *(*)* b) ** c) ** d) *(+)* a) single final

### UNIT I PART A PART B

OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

### CT32 COMPUTER NETWORKS DEC 2015

Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10

### Compiler Construction

Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

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

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR-621113 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Third Year CSE( Sem:V) CS2303- THEORY OF COMPUTATION PART B-16

### AUTOMATA THEORY AND COMPUTABILITY

AUTOMATA THEORY AND COMPUTABILITY QUESTION BANK Module 1 : Introduction to theory of computation and FSM Objective: Upon the completion of this chapter you will be able to Define Finite automata, Basic

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

*4459255* [4459] 255 Seat No. T.E. (Computer Engineering) (Semester I) Examination, 2013 THEY OF COMPUTATION (2008 Course) Time : 3 Hours Max. Marks : 100 Instructions : 1) Answers to the two Sections

### (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

Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE

### AUBER (Models of Computation, Languages and Automata) EXERCISES

AUBER (Models of Computation, Languages and Automata) EXERCISES Xavier Vera, 2002 Languages and alphabets 1.1 Let be an alphabet, and λ the empty string over. (i) Is λ in? (ii) Is it true that λλλ=λ? Is

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% 1. (2 pts) See text. You can t be sloppy defining terms like this. You must show a bijection between the natural numbers

### Ambiguous Grammars and Compactification

Ambiguous Grammars and Compactification Mridul Aanjaneya Stanford University July 17, 2012 Mridul Aanjaneya Automata Theory 1/ 44 Midterm Review Mathematical Induction and Pigeonhole Principle Finite Automata

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

Assignment No.4 solution Question No.1 a. Suppose we have a language defined below, Pumping Lemma Version I and II a n b m Where m = n! (n-factorial) and n = 1, 2, 3 Some strings belonging to this language

### Formal Languages and Automata

Mobile Computing and Software Engineering p. 1/3 Formal Languages and Automata Chapter 3 Regular languages and Regular Grammars Chuan-Ming Liu cmliu@csie.ntut.edu.tw Department of Computer Science and

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

CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

### 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 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

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

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

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

Closure Properties of CFLs; Introducing TMs CS154 Chris Pollett Apr 9, 2007. Outline Closure Properties of Context Free Languages Algorithms for CFLs Introducing Turing Machines Closure Properties of CFL

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

Solved Subjective From Midterm Papers Dec 07,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM SPRING 2012 Q. Point of Kleen Theory. Answer:- (Page 25) 1. If a language can be accepted

### CS 44 Exam #2 February 14, 2001

CS 44 Exam #2 February 14, 2001 Name Time Started: Time Finished: Each question is equally weighted. You may omit two questions, but you must answer #8, and you can only omit one of #6 or #7. Circle the

### Final Course Review. Reading: Chapters 1-9

Final Course Review Reading: Chapters 1-9 1 Objectives Introduce concepts in automata theory and theory of computation Identify different formal language classes and their relationships Design grammars

### COMP 330 Autumn 2018 McGill University

COMP 330 Autumn 2018 McGill University Assignment 4 Solutions and Grading Guide Remarks for the graders appear in sans serif font. Question 1[25 points] A sequence of parentheses is a sequence of ( and

### Theory of Computation

Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

### Chapter 14: Pushdown Automata

Chapter 14: Pushdown Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu The corresponding textbook chapter should

### 3 rd Year - Computer Science and Engineering,

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 3 rd Year - Computer Science and Engineering, 5th Semester Theory of Computation QUESTION BANK 2 Marks Question and Answer 1. Define set. A set is a collection

### UNIT 1 SNS COLLEGE OF ENGINEERING

1 SNS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING THEORY OF COMPUTATION TWO MARKS WITH ANSWERS UNIT 1 1. Define set. A set is a collection of objects. E.g.: The collection of

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

Derivations of a CFG MACM 300 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop strings grow on trees strings grow on Noun strings grow Object strings Verb Object Noun Verb Object

### Decision Properties for Context-free Languages

Previously: Decision Properties for Context-free Languages CMPU 240 Language Theory and Computation Fall 2018 Context-free languages Pumping Lemma for CFLs Closure properties for CFLs Today: Assignment

### Actually talking about Turing machines this time

Actually talking about Turing machines this time 10/25/17 (Using slides adapted from the book) Administrivia HW due now (Pumping lemma for context-free languages) HW due Friday (Building TMs) Exam 2 out

### CS402 - Theory of Automata FAQs By

CS402 - Theory of Automata FAQs By Define the main formula of Regular expressions? Define the back ground of regular expression? Regular expressions are a notation that you can think of similar to a programming

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

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I 1) Is it true that the language accepted by any NDFA is different from the regular language? Justify your answer. 2) Describe the following sets

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

HKN CS 374 Midterm 1 Review Tim Klem Noah Mathes Mahir Morshed Midterm topics It s all about recognizing sets of strings! 1. String Induction 2. Regular languages a. DFA b. NFA c. Regular expressions 3.

### Regular Languages and Regular Expressions

Regular Languages and Regular Expressions According to our definition, a language is regular if there exists a finite state automaton that accepts it. Therefore every regular language can be described

### Automata Theory CS S-FR Final Review

Automata Theory CS411-2015S-FR Final Review David Galles Department of Computer Science University of San Francisco FR-0: Sets & Functions Sets Membership: a?{a,b,c} a?{b,c} a?{b,{a,b,c},d} {a,b,c}?{b,{a,b,c},d}

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

Normal Forms for CFG s Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form 1 Variables That Derive Nothing Consider: S -> AB, A -> aa a, B -> AB Although A derives

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

Code No: R05311201 Set No. 1 1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] 2. Compute the FIRST and FOLLOW sets of each

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

CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every

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

University of Virginia - cs3102: Theory of Computation Spring 2010 PS3 - Comments Average: 46.6 (full credit for each question is 55 points) Problem 1: Mystery Language. (Average 8.5 / 10) In Class 7,

### KHALID PERVEZ (MBA+MCS) CHICHAWATNI

FAQ's about Lectures 1 to 5 QNo1.What is the difference between the strings and the words of a language? A string is any combination of the letters of an alphabet where as the words of a language are the

### Models of Computation II: Grammars and Pushdown Automata

Models of Computation II: Grammars and Pushdown Automata COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Catch Up / Drop in Lab Session 1 Monday 1100-1200 at Room 2.41

CS/B.Tech/CSE/IT/EVEN/SEM-4/CS-402/2015-16 ItIauIafIaAblll~AladUnrtel1ity ~ t; ~~ ) MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY, WEST BENGAL Paper Code: CS-402 FORMAL LANGUAGE AND AUTOMATA THEORY

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

ROEVER COLLEGE OF ENGINEERING AND TECHNOLOGY Elambalur, Perambalur 621 220 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III / V Subject Code : CS6503 Subject Name : Theory of Computation

### Formal Grammars and Abstract Machines. Sahar Al Seesi

Formal Grammars and Abstract Machines Sahar Al Seesi What are Formal Languages Describing the sentence structure of a language in a formal way Used in Natural Language Processing Applications (translators,

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

1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}. (a) 0(010) 1 Examples: 01, 00101, 00100101, 00100100100101 (b) (21 10) 0012

### Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

### CSE 431S Scanning. Washington University Spring 2013

CSE 431S Scanning Washington University Spring 2013 Regular Languages Three ways to describe regular languages FSA Right-linear grammars Regular expressions Regular Expressions A regular expression is

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

CD5080 AUBER odels of Computation, anguages and Automata ecture 14 älardalen University Content Universal Turing achine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Decidability

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

CFG [1] The CYK Algorithm We present now an algorithm to decide if w L(G), assuming G to be in Chomsky Normal Form. This is an example of the technique of dynamic programming Let n be w. The natural algorithm

### Lec-5-HW-1, TM basics

Lec-5-HW-1, TM basics (Problem 0)-------------------- Design a Turing Machine (TM), T_sub, that does unary decrement by one. Assume a legal, initial tape consists of a contiguous set of cells, each containing

### Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Name: of 7 Theory of Computation Dr. Weiss Extra Practice Exam Solutions Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be

### Outline. Language Hierarchy

Outline Language Hierarchy Definition of Turing Machine TM Variants and Equivalence Decidability Reducibility Language Hierarchy Regular: finite memory CFG/PDA: infinite memory but in stack space TM: infinite

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

Code No: R22054 COMPUTER ORGANIZATION (Com. to CSE, ECC) 1. a) Explain the Architecture of 8085 Microprocessor? b) Explain instruction set Architecture Design? 2. Explain Memory Subsystem Organization

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

Computer Language Theory Chapter 4: Decidability 1 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/??

Context-Free Grammars (CFG) There are languages, such as {0 n 1 n n 0} that cannot be described (specified) by finite automata or regular expressions. Context-free grammars provide a more powerful mechanism

### Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down

### CMSC 330, Fall 2009, Practice Problem 3 Solutions

CMC 330, Fall 2009, Practice Problem 3 olutions 1. Context Free Grammars a. List the 4 components of a context free grammar. Terminals, non-terminals, productions, start symbol b. Describe the relationship

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

Formal Languages and Compilers Lecture IV: Regular Languages and Finite Automata Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/

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

P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

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

Decidable Problems We examine the problems for which there is an algorithm. Decidable Problems A problem asks a yes/no question about some input. The problem is decidable if there is a program that always

### 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 1 Context-Free Grammars Some languages are not regular. Eg. L={a n b n : n 0} A grammar G=(V, T, S, P)

### Glynda, the good witch of the North

Strings and Languages It is always best to start at the beginning -- Glynda, the good witch of the North What is a Language? A language is a set of strings made of of symbols from a given alphabet. An

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

Midterm Exam CS 341-451: Foundations of Computer Science II Fall 2014, elearning section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all

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

: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Scanner Parser Static Analyzer Intermediate Representation Front End Back End Compiler / Interpreter

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

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 1 Not all languages are regular So what happens to the languages which are not regular? Can we still come up with a language recognizer?

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

Pushdown Automata A PDA is an FA together with a stack. Stacks A stack stores information on the last-in firstout principle. Items are added on top by pushing; items are removed from the top by popping.

### Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

### ECS 120 Lesson 16 Turing Machines, Pt. 2

ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their

### Learn Smart and Grow with world

Learn Smart and Grow with world All Department Smart Study Materials Available Smartkalvi.com TABLE OF CONTENTS S.No DATE TOPIC PAGE NO. UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation

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

Code No: 134BD Set No. 1 JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech. II Year II Sem., I Mid-Term Examinations, February - 2018 FORMAL LANGUAGES AND AUTOMATA THEORY Objective Exam Name:

### ECS 120 Lesson 7 Regular Expressions, Pt. 1

ECS 120 Lesson 7 Regular Expressions, Pt. 1 Oliver Kreylos Friday, April 13th, 2001 1 Outline Thus far, we have been discussing one way to specify a (regular) language: Giving a machine that reads a word

### CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

### Theory of Computations Spring 2016 Practice Final Exam Solutions

1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try

### 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 Context-Free Grammars A grammar G=(V, T, S, P) is context-free if all productions in P are of form A

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

Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University

### 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 Context-Free Grammars A grammar G=(V, T, S, P) is context-free if all productions in P are of form A

### 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 Context-Free Grammars A grammar G=(V, T, S, P) is context-free if all productions in P are of form A

### Computer Sciences Department

1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 D E C I D A B I L I T Y 4 Objectives 5 Objectives investigate the power of algorithms to solve problems.

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

CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

### QUESTION BANK CS2303 THEORY OF COMPUTATION

QUESTION BANK CS2303 THEORY OF COMPUTATION UNIT-I AUTOMATA PART-A(2-MARKS) 1 What is Computation? and Write short notes on TOC. 2 Define Automaton 3 Define Inductive and Deductive proof 4 Define hypothesis.

### Turing Machine Languages

Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word

### Theory of Computation, Homework 3 Sample Solution

Theory of Computation, Homework 3 Sample Solution 3.8 b.) The following machine M will do: M = "On input string : 1. Scan the tape and mark the first 1 which has not been marked. If no unmarked 1 is found,

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

CMSC 330: Organization of Programming Languages Context Free Grammars Where We Are Programming languages Ruby OCaml Implementing programming languages Scanner Uses regular expressions Finite automata Parser

### TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

TABLE OF CONTENTS SNo DATE TOPIC PAGE NO UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation Techniques 3 3 Finite State systems 4 4 Basic Definitions 6 5 Finite Automaton 7 6 DFA NDFA

### Introduction to Computers & Programming

16.070 Introduction to Computers & Programming Theory of computation 5: Reducibility, Turing machines Prof. Kristina Lundqvist Dept. of Aero/Astro, MIT States and transition function State control A finite

### Automating Construction of Lexers

Automating Construction of Lexers Regular Expression to Programs Not all regular expressions are simple. How can we write a lexer for (a*b aaa)? Tokenizing aaaab Vs aaaaaa Regular Expression Finite state

### Context-Free Grammars

Context-Free Grammars 1 Informal Comments A context-free grammar is a notation for describing languages. It is more powerful than finite automata or RE s, but still cannot define all possible languages.

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

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of

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

Regular Expressions Lecture 10 Sections 3.1-3.2 Robb T. Koether Hampden-Sydney College Wed, Sep 14, 2016 Robb T. Koether (Hampden-Sydney College) Regular Expressions Wed, Sep 14, 2016 1 / 23 Outline 1

### CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.2, 1.3 Design NFA recognizing a given language Convert an NFA (with or without

### Dr. D.M. Akbar Hussain

1 2 Compiler Construction F6S Lecture - 2 1 3 4 Compiler Construction F6S Lecture - 2 2 5 #include.. #include main() { char in; in = getch ( ); if ( isalpha (in) ) in = getch ( ); else error (); while

### Theory of Computations Spring 2016 Practice Final

1 of 6 Theory of Computations Spring 2016 Practice Final 1. True/False questions: For each part, circle either True or False. (23 points: 1 points each) a. A TM can compute anything a desktop PC can, although

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

Regular Languages (14 points) Problem 1 (6 points) inimize the following automaton Show that the resulting DFA is minimal. Solution: We apply the State Reduction by Set Partitioning algorithm (särskiljandealgoritmen)

### 1 Parsing (25 pts, 5 each)

CSC173 FLAT 2014 ANSWERS AND FFQ 30 September 2014 Please write your name on the bluebook. You may use two sides of handwritten notes. Perfect score is 75 points out of 85 possible. Stay cool and please