# JNTUWORLD. Code No: R

Size: px
Start display at page:

Transcription

1 Code No: R 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 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]

2 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 [15] 8. Write short notes on a) Homomorphism b) Recursive Languages c) Post s correspondence problem. [15] ********

3 Code No: R 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 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]

4 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] ********

5 Code No: R 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 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 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 [15] 8. Write short notes on the following a) post s Correspondence problem b) Recursive languages c) Universal Turing Machine. [15] ********

7 Code No: R 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 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 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]

8 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] ********

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

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

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

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

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

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

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

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

### QUESTION BANK. Unit 1. Introduction to Finite Automata

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### Context Free Grammars. CS154 Chris Pollett Mar 1, 2006.

Context Free Grammars CS154 Chris Pollett Mar 1, 2006. Outline Formal Definition Ambiguity Chomsky Normal Form Formal Definitions A context free grammar is a 4-tuple (V, Σ, R, S) where 1. V is a finite

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

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

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

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

### Department of Computer Science and Engineering

SHRI ANGALAMMAN COLLEGE OF ENGINEERING AND TECHNOLOGY (AN ISO 9001:2008 Certified Institution) SIRUGANOOR, TRICHY 621 105 Department of Computer Science and Engineering QUESTION BANK Subject Code /Title:

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

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

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

Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

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

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

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

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

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

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

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

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

Formal Languages Grammar Ryan Stansifer Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901 http://www.cs.fit.edu/~ryan/ March 15, 2018 A formal language is a set

### 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 (b) (21 10) 0012 (c) 1 (200) 100 01 Examples: 1, 200, 111,

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

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

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

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

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

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

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

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

DADI INSTITUTE OF ENGINEERING & TECHNOLOGY (Approved by A.I.C.T.E., New Delhi& Affiliated to JNTUK, Kakinada) NAAC Accredited Institute An ISO 9001:2008, 14001:2004 & OHSAS 18001:2007 Certified Institute

### ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures Lecture 9b Grammars I Overview How can a computer do Natural Language Processing? Grammar checking? Artificial Intelligence Represent knowledge so that brute force

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

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

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

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

### General Overview of Compiler

General Overview of Compiler Compiler: - It is a complex program by which we convert any high level programming language (source code) into machine readable code. Interpreter: - It performs the same task

### Normal Forms and Parsing. CS154 Chris Pollett Mar 14, 2007.

Normal Forms and Parsing CS154 Chris Pollett Mar 14, 2007. Outline Chomsky Normal Form The CYK Algorithm Greibach Normal Form Chomsky Normal Form To get an efficient parsing algorithm for general CFGs

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

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

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

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

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

CS 573 Automata Theory and Formal Languages Professor Leslie Lander Lecture # 20 November 13, 2000 Greibach Normal Form (GNF) Sheila Greibach s normal form (GNF) for a CFG is one where EVERY production

### Introduction to Syntax Analysis

Compiler Design 1 Introduction to Syntax Analysis Compiler Design 2 Syntax Analysis The syntactic or the structural correctness of a program is checked during the syntax analysis phase of compilation.

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 11 Ana Bove April 26th 2018 Recap: Regular Languages Decision properties of RL: Is it empty? Does it contain this word? Contains

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

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

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

### Homework. Context Free Languages. Before We Start. Announcements. Plan for today. Languages. Any questions? Recall. 1st half. 2nd half.

Homework Context Free Languages Homework #2 returned Homework #3 due today Homework #4 Pg 133 -- Exercise 1 (use structural induction) Pg 133 -- Exercise 3 Pg 134 -- Exercise 8b,c,d Pg 135 -- Exercise

### 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 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: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

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

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

### Total No. of Questions : 18] [Total No. of Pages : 02. M.Sc. DEGREE EXAMINATION, DEC First Year COMPUTER SCIENCE.

(DMCS01) Total No. of Questions : 18] [Total No. of Pages : 02 M.Sc. DEGREE EXAMINATION, DEC. 2016 First Year COMPUTER SCIENCE Data Structures Time : 3 Hours Maximum Marks : 70 Section - A (3 x 15 = 45)

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

### An Interactive Approach to Formal Languages and Automata with JFLAP

An Interactive Approach to Formal Languages and Automata with JFLAP Susan H. Rodger Duke University NSF CCLI Showcase March 9, 2007 Supported by NSF Grant DUE 0442513. Outline Overview of JFLAP Examples

### Homework. Announcements. Before We Start. Languages. Plan for today. Chomsky Normal Form. Final Exam Dates have been announced

Homework Homework #3 returned Homework #4 due today Homework #5 Pg 169 -- Exercise 4 Pg 183 -- Exercise 4c,e,i Pg 184 -- Exercise 10 Pg 184 -- Exercise 12 Pg 185 -- Exercise 17 Due 10 / 17 Announcements

### CS143 Midterm Fall 2008

CS143 Midterm Fall 2008 Please read all instructions (including these) carefully. There are 4 questions on the exam, some with multiple parts. You have 75 minutes to work on the exam. The exam is closed

### MIT Specifying Languages with Regular Expressions and Context-Free Grammars

MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Language Definition Problem How to precisely

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

### VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK V SEMESTER CS6503 - Theory of Computation Regulation 2013 Academic Year 2017

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

### MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Massachusetts Institute of Technology Language Definition Problem How to precisely define language Layered structure

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

### CMSC 330: Organization of Programming Languages. Context Free Grammars

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

### CS103 Handout 16 Winter February 15, 2013 Problem Set 6

CS103 Handout 16 Winter 2012-2013 February 15, 2013 Problem Set 6 How much firepower do context-free languages have? What are their limits? And just how awesome are PDAs? In this problem set, you'll get

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

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

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

### Introduction to Syntax Analysis. The Second Phase of Front-End

Compiler Design IIIT Kalyani, WB 1 Introduction to Syntax Analysis The Second Phase of Front-End Compiler Design IIIT Kalyani, WB 2 Syntax Analysis The syntactic or the structural correctness of a program

### 3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino

3. Syntax Analysis Andrea Polini Formal Languages and Compilers Master in Computer Science University of Camerino (Formal Languages and Compilers) 3. Syntax Analysis CS@UNICAM 1 / 54 Syntax Analysis: the

### CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing Fuhua (Frank) Cheng Department of Computer Science University of Kentucky 1 Table of Contents: Week 1: Preliminaries (set algebra, relations, functions) (read Chapters

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

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