UNIT 1 SNS COLLEGE OF ENGINEERING

Similar documents
3 rd Year - Computer Science and Engineering,

JNTUWORLD. Code No: R

CT32 COMPUTER NETWORKS DEC 2015

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

UNIT I PART A PART B

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

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

(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


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

Final Course Review. Reading: Chapters 1-9

Multiple Choice Questions

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

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

QUESTION BANK. Unit 1. Introduction to Finite Automata

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

AUTOMATA THEORY AND COMPUTABILITY

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

Languages and Compilers

Ambiguous Grammars and Compactification

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

AUBER (Models of Computation, Languages and Automata) EXERCISES

Compiler Construction

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

Learn Smart and Grow with world

Introduction to Automata Theory

Question Bank. 10CS63:Compiler Design

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

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

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Theory of Computation

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

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

Introduction to Syntax Analysis

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

CS402 - Theory of Automata Glossary By

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

Decision Properties for Context-free Languages

CS402 - Theory of Automata FAQs By

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

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

Regular Languages and Regular Expressions

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

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

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

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

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

Formal Languages and Automata

ECS 120 Lesson 7 Regular Expressions, Pt. 1

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

Models of Computation II: Grammars and Pushdown Automata

LECTURE NOTES THEORY OF COMPUTATION

Theory of Computation, Homework 3 Sample Solution

REGULAR EXPRESSIONS AND LANGUAGES

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CMSC 330: Organization of Programming Languages

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

KHALID PERVEZ (MBA+MCS) CHICHAWATNI

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

DVA337 HT17 - LECTURE 4. Languages and regular expressions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

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

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

LECTURE NOTES THEORY OF COMPUTATION

Automata Theory CS S-FR Final Review

Chapter 14: Pushdown Automata

Theory and Compiling COMP360

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

COP 3402 Systems Software Syntax Analysis (Parser)

Decision, Computation and Language

Formal Languages and Compilers Lecture VI: Lexical Analysis

UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES

Part 5 Program Analysis Principles and Techniques

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

Context Free Languages and Pushdown Automata

UNIT -2 LEXICAL ANALYSIS

CSE 105 THEORY OF COMPUTATION

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701)

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

Chapter Seven: Regular Expressions

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End

Name: Finite Automata

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

Zhizheng Zhang. Southeast University


About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

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

CMSC 330: Organization of Programming Languages

Lexical Analysis. Prof. James L. Frankel Harvard University

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Chapter 3: CONTEXT-FREE GRAMMARS AND PARSING Part 1

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

Theory Bridge Exam Example Questions Version of June 6, 2008

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata

CMSC 330: Organization of Programming Languages

Parsing. source code. while (k<=n) {sum = sum+k; k=k+1;}

CMSC 330: Organization of Programming Languages. Context Free Grammars

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

CS 44 Exam #2 February 14, 2001

Transcription:

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 the four letters. S={ a,b,c,d} 2. Define function. A function is a rule that assigns to elements of one set a unique element of another set. 3. Define relation. A relation is a set of pairs. The first component of each pair is chosen from a set called the domain and second component of each pair is chosen from a set called the range. 4. Give the examples/applications designed as finite state system. Text editors and lexical analyzers are designed as finite state systems. A lexical analyzer scans the symbols of a program to locate strings corresponding to identifiers, constants etc, and it has to remember limited amount of information. 5. Define alphabet. A finite set of non-empty set of symbols is called alphabet. 6. What do you mean by string? A finite sequence of symbols is called string. 7. Define language. The language can be defined as a collection of strings or words over certain input set. 8. Define Abstract machines with e.g. The computer which performs computation are not actual computers they are abstract machine. E.g.: Finite Automata, Push down automata and Turing machine. 10. Define Finite Automaton (FA) FA consists of a finite set of states and a set of transitions from state to state that occur on input symbols chosen from an alphabet _. Finite Automata is denoted by a 5- tuples (Q,, δ,q0,f), where Q is the finite set of states, _ is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and _ is the transition mapping function Q * to Q. 11. Define DFA. A DFA consists of A=( Q,, δ,q0,f) Where Q is the finite set of states, is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and δ is the transition mapping function Q * to Q. 12. Define NFA A NFA consists of A=( Q,, δ,q0,f) Where Q is the finite set of states, is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and δ is the transition mapping function δ : Q x ( U{ ε }) = 2Q

2 13. Define Transition diagram Transition diagram is a directed graph in which the vertices of the graph correspond to the states of FA. If there is a transition from state q to state p on input a, then there is an arc labeled a from q to p in the transition diagram. 14. What are the applications of automata theory? In compiler construction. In switching theory and design of digital circuits. To verify the correctness of a program. Design and analysis of complex software and hardware systems. To design finite state machines such as Moore and mealy machines. 15. What are the components of Finite automaton model? The components of FA model are Input tape, Read control and finite control. (a)the input tape is divided into number of cells. Each cell can hold one i/p symbol. (b)the read head reads one symbol at a time and moves ahead. (c)finite control acts like a CPU. Depending on the current state and input symbol read from the input tape it changes state. 16. Differentiate NFA and DFA. NFA or Non Deterministic Finite Automaton is the one in which there exists Many paths for a specific input from current state to next state. NFA can be used in theory of computation because they are more flexible and easier to use than DFA. Deterministic Finite Automaton is a FA in which there is only one path for a specific input from current state to next state. There is a unique transition on each input symbol 17. What is -closure of a state q0? -closure (q0) denotes a set of all vertices p such that there is a path from q0 to labeled. 18. What is a Regular Language? The language accepted by M is L(M) is the set {x δ (q0,x) is in F}. A language is regular if it is accepted by some finite automaton. 19. Define star closure and positive closure. Star closure zero or more. Occurrence Positive closure one or more occurrence (eg) a* = { ε,a,aa,.} a+ = {a,aa,.} L+ = L* - { ε } 20. Define NFA with _-transition. Is the NFA s with ε -transitions are more powerful that the NFA s without ε -transition? The NFA with - moves defined by 5 tuples or quintyple as similarly as NFA, except δ (Q,,δ,qo,F) with all components as before and δ: Qx( U{ ε}) = 2Q No, NFA with ε -transition and NFA without ε -transition have the same power. 21. Define Finite State Systems The finite automaton is a mathematical model of a system, with discrete inputs and outputs and a finite number of memory configuration called states. 22. Is it true the language accepted by NFA is different from the regular language? Justify. Your answer. No, it is false. For every regular expression r there exists a NFA with _- transition that accepts L(r).

3 UNIT-II 1. What is a regular expression? A regular expression is a string that describes the whole set of strings according to certain syntax rules. These expressions are used by many text editors and utilities to search bodies of text for certain patterns etc. Definition is: Let _ be an alphabet. The regular expression over _ and the sets they denote are: i. Φ is a r.e and denotes empty set. ii. is a r.e and denotes the set { } iii. For each a in, a+ is a r.e and denotes the set {a}. iv. If r and s are r.e denoting the languages R and S respectively then (r+s),(rs) and (r*) are r.e that denote the sets RUS, RS and R* respectively 2. List out the operator of regular expression. Union of two Languages Concatenation of two Languages Closure of a Language 3. Write a r.e to denote a language L which accepts all the strings which begin or end with either 00 or 11. The r.e consists of two parts: L1= (00+11) (any no of 0 s and 1 s) = (00+11) (0+1)* L2= (any no of 0 s and 1 s)(00+11) = (0+1)*(00+11) Hence r.e R=L1+L2 = [(00+11)(0+1)*] + [(0+1)* (00+11)] 4. Construct a r.e for the language which accepts all strings with atleast two c s over the set ={c,b} (b+c)* c (b+c)* c (b+c)* 5.Construct a r.e for the language over the set _={a,b} in which total number of a s are divisible by 3 ( b* a b* a b* a b*)* 6. what is: (i) (0+1)* (ii)(01)* (iii)(0+1) (iv)(0+1)+ (0+1)*= {, 0, 1, 01, 10,001,101,101001, } Any combinations of 0 s and 1 s. (01)*= {, 01,0101,010101,..} All combinations with the pattern 01. (0+1) = 0 or 1,No other possibilities. (0+1)+ = {0,1,01,10,1000,0101,.} 7.Reg exp denoting a language over ={1} having (i) even length of string (ii) odd length of a string (i) Even length of string R=(11)* (ii) Odd length of the string R=1(11)* 8.Reg exp for: (i)all strings over {0,1} with the substring 0101 (ii)all strings beginning with 11 and ending with ab (iii)set of all strings over {a,b}with 3 consecutive b s. (iv)set of all strings that end with 1 and has no substring 00 (i) (0+1)* 0101(0+1)* (ii) 11(1+a+b)* ab (iii) (a+b)* bbb (a+b)* (iv) (1+01)* (10+11)* 1 9. Reg exp for the language that accepts all strings in which a appears tripled over the set ={a} reg exp=(aaa)* 10. What is the closure property of regular sets? The regular sets are closed under union, concatenation and Kleene closure. r1ur2= r1 +r2 ; r1.r2= r1r2 ; ( r )*=r* The class of regular sets are closed under complementation, substitution, homomorphism and inverse homomorphism. 11. Write the exp for the language starting with and has no consecutive b s

4 reg exp=(a+ab)* 12. What is the order of precedence of operators used in regular expression? i. Operator is having the highest precedence. ii. Next the concatenation or dot operator (.). iii. + Operator is having the lowest precedence. 13. Describe the algebra of regular expression. Regular expressions obey many laws of arithmetic. a. Union and Concatenation are associative. b. Union is commutative. c. Union is idempotent. 14. Define pumping lemma for regular languages. Let L be a regular language. Then there exists a constant n such that for every string w in L such that w n. w = xyz such that a. y. b. xy n. c. For all i 0, xy i z L. 15. How do you test the emptiness of regular language? The emptiness is defined by checking whether there is a path from the start sate to some accepting state. If there is a path available the languages nonempty. If the accepting states are separated from the start state then the language is empty. 16 Write the formula for convert DFA to RE (Regular expression). Rij (k) = Rij(k-1)+Rik(k-1) ( Rkk(k-1))*Rkj(k-1) 17. List the application of regular expression. a. Regular expression in UNIX b. Lexical Analysis. c. Finding Patterns in a Text 18. What do you mean by equivalence and minimization of DFA? For each DFA it is possible to find an equivalent DFA which contains as few s states as any DFA accepting the same language. UNIT-III 1. What are the applications of pumping lemma? Pumping lemma is used to check if a language is regular or not. (i) Assume that the language (L) is regular. (ii) Select a constant n. (iii) Select a string (z) in L, such that z >n. (iv) Split the word z into u,v and w such that uv <=n and v >=1. (v) You achieve a contradiction to pumping lemma that there exists an 2. What are the applications of Regular expressions? Lexical analyzers and Text editors are two applications. Lexical analyzers: The tokens of the programming language can be expressed using regular expressions. The lexical analyzer scans the input program and separates the tokens. For eg identifier can be expressed as a regular expression as: (letter)(letter+digit)* If anything in the source language matches with this reg exp then it is Recognized as an identifier. The letter is{a,b,c,..z,a,b,c.z} and digit is {0,1, 9}.Thus reg exp identifies token in a language. Text editors: These are programs used for processing the text. For example UNIX text editors uses the reg exp for substituting the strings such as: S/bbb*/b/ 3. What are the applications of Finite automata? Gives the substitute a single blank for the first string of two or more blanks in a given line. In UNIX text editors any reg exp is converted to an NFA with ε- transitions, this NFA can be then simulated directly 4. What is Arden s Theorem? Arden s theorem helps in checking the equivalence of two regular expressions.

5 Let P and Q be the two regular expressions over the input alphabet _. The regular expression R is given as :R=Q+RP Which has a unique solution as R=QP*. 5. Define Homomorphisms. A string homomorphism is a function on string that works by substituting a particular string for each symbol. 6.. Define Inverse Homomorphisms Homomorphisms may also be applied backwards and this mode they also preserve regular language. 7. What are the closure properties of regular languages? i. Union ii. Intersection iii. Complement iv. Difference v. Reversal vi. Closure. vii. Concatenation. viii. Homomorphism. ix. Inverse Homomorphism. UNIT-IV 1. Define a context free grammar A context free grammar (CFG) is denoted as G=(V,T,P,S) where V and T are finite set of variables and terminals respectively. V and T are disjoint. P is a finite set of productions each is of the form A-> _ where A is a variable and _ is a string of symbols from (V U T)*. 2. What are the uses of Context free grammars? Construction of compilers. Simplified the definition of programming languages. Describes the arithmetic expressions with arbitrary nesting of balanced parenthesis { (, ) }. Describes block structure in programming languages. Model neural nets. 3. The language generated by G ( L(G) ) is {w w is in T* and S =w }. That is a G String is in L(G) if: (1) The string consists solely of terminals. (2) The string can be derived from S. 4. What is (a) CFL (b) Sentential Form? L is a context free language (CFL) if it is L(G) for some CFG G. A string of terminals and variables _ is called a sentential form if: *S => _, where S is the start symbol of the grammar. 5. What is the language generated by the grammar G=(V,T,P,S) where P={S->aSb, S->ab}? S=> asb=>aasbb=>..=>anbn Thus the language L(G)={ anbn n>=1}.the language has strings with equal number of a s and b s. 6. If S->aSb aab, A->bAa, A->ba.Find out the CFL soln. S->aAb=>abab S->aSb=>a aab b =>a a ba b b(sub S->aAb) S->aSb =>a asb b =>a a aab b b=>a a a ba b bb Thus L={an bm am bn, where n,m>=1} 7. What is an ambiguous grammar? A grammar is said to be ambiguous if it has more than one derivation trees for a sentence or in other words if it has more than one leftmost derivation or more than one rightmost derivation. 8.Give the context free grammar for generating the ambiguous L={a n b 2n ;n_1} SSbb Sabb_

6 9. Consider G whose productions are SaAS_a, ASbA_SSba. Show that S=>aabbaa. S=>Aas =>asbas =>aabas =>aabbas =>aabbaa 10. Find the language generated by a CFG. G=({S},{0,1},{S0 1 _, S0S0 1S1 S) S =>0S0 S =>1S1 =>01S10 =>10S01 =>0I0I0 =>10001 L= { w;w is a palindrome} 11. Differentiate sentences Vs sentential forms A sentence is a string of terminal symbols. A sentential form is a string containing a mix of variables and terminal symbols or all variables. This is an intermediate form in doing a derivation. 12.Define Pushdown Automata. A pushdown Automata M is a system (Q, _, _, _,q0, Z0,F) where Q is a finite set of states. _ is an alphabet called the input alphabet. _ is an alphabet called stack alphabet. q0 in Q is called initial state. Zo in _ is start symbol in stack. F is the set of final states. _ is a mapping from Q X (_ U { _ } ) X _ to finite subsets of Q X _ *. 13. Compare NFA and PDA. NFA 1. The language accepted by NFA is the regular language. 2. NFA has no memory. 3. It can store only limited amount of information 4. A language/string is accepted only by reaching the final state. PDA 1.The language accepted by PDA is Context free language. 2. PDA is essentially an NFA with a stack(memory). 3 It stores unbounded limit of information. 4. It accepts a language either by empty Stack or by reaching a final state. 14. What are the different types of language acceptances by PDA and define them, Two types 1. Acceptance by final state 2. Acceptance by empty stack 15.Is it true that the language accepted by a PDA by empty stack and final states are different languages. No, because the languages accepted by PDA s by final state are exactly the languages accepted by PDA s by empty stack. 16. What is the additional feature of PDA has when compared with NFA? Is PDA superior over NFA? Is PDA superior over NFA in the sense of language acceptance? Justify your answer: Additional features of PDA: a) PDA is eventually a FA with a stack. b) PDA can accept context free languages. c) PDA can recognize the context free languages which are not regular. Yes, PDA is superior over NFA in the sense of languages. 17. Is it true the nondeterministic PDA is more powerful than that of deterministic PDA? justify your answer. Yes, wwr is accepted by NPDA but not any DPDA in the sense of language acceptance.

7 18. Regular Language: A Language can be described by DFA or NFA. Context free language cannot be described by DFA (or) NFA since there is no memory. Pushdown Automata has a memory, which can be used to count the number. Pushdown Automata can accept context free languages. It is essentially an NFA with a stack. 19. A pushdown automata G=(Q,,G,d,q0,z,F) is said to be deterministic if 1. d(q,a,b)contains almost one element. 2. If d(q,l,b) is not empty, then d(q,c,b) must be empty for overy c_, q_q, b_g The first condition says that for any given input symbol and any stack top, at most one move can be made. The second condition say that when a l move is possible for some configuration, no input consuming alternative is available 20. What are the properties of the CFL generated by a CFG? Each variable and each terminal of G appears in the derivation of some word in L There are no productions of the form A->B where A and B are variables. 21. Give examples of languages handled by PDA. (1) L={ anbn n>=0 },here n is unbounded, hence counting cannot be done by finite memory. So we require a PDA,a machine that can count without limit. (2) L= { wwr w {a,b}* }, to handle this language we need unlimited counting capability. 22 Is NPDA (Nondeterministic PDA) and DPDA (Deterministic PDA)equivalent? The languages accepted by NPDA and DPDA are not equivalent. For example: wwr is accepted by NPDA and not by any DPDA. 23. State the equivalence of acceptance by final state and empty stack. If L = L(M2) for some PDA M2, then L = N(M1) for some PDA M1. If L = N(M1) for some PDA M1,then L = L(M2) for some PDA M2. where L(M) = language accepted by PDA by reaching a final state. N(M) = language accepted by PDA by empty stack. 24. State the equivalence of PDA and CFL. If L is a context free language, then there exists a PDA M such that L=N(M). If L is N(M) for some PDA m, then L is a context free language. 25. Define Deterministic PDA. A PDA M =( Q, _, _, _,q0, Z0,F ) is deterministic if: For each q in Q and Z in _, whenever _ (q, _,Z) is nonempty,then _ (q,a,z) is empty for all a in _. For no q in Q, Z in _, and a in _ U { _} does _ (q,a,z) contains more than one element. (Eg): The PDA accepting {wcwr w in ( 0+1 ) * }. 26. State the equivalence of acceptance by final state and empty stack. If L = L(M2) for some PDA M2, then L = N(M1) for some PDA M1. If L = N(M1) for some PDA M1,then L = L(M2) for some PDA M2. where L(M) = language accepted by PDA by reaching a final state. N(M) = language accepted by PDA by empty stack. 27. What is the informal definition of PDA? A PDA is a computational machine to recognize a Context free language. Computational power of PDA is between Finite automaton and Turing machines. The PDA has a finite control, and the memory is organized as a stack. 28. Give an example of Nondeterministic CFL The language L={ wwr : w {a,b}+ } is a nondeterministic CFL.

8 UNIT-V 1. What is a formal language? Language is a set of valid strings from some alphabet. The set may be empty,finite or infinite. L(M) is the language defined by machine M and L( G) is the languagedefined by Context free grammar. The two notations for specifying formal languages are: Grammar or regular expression(generative approach) Automaton(Recognition approach) 2. What are all the normal forms for CFG? Normal forms for CFG are: i. Chomsky normal form. ii. Greiback normal form. 3. What are the three ways to simplify a context free grammar? By removing the useless symbols from the set of productions. By eliminating the empty productions. By eliminating the unit productions. 3.. What are the properties of the CFL generated by a CFG? Each variable and each terminal of G appears in the derivation of some word in L There are no productions of the form A->B where A and B are variables. 4. True or False (a)cfl are not closed under intersection and complementation True. (b)a regular grammar generates an empty string True. (c) A regular language is also context free but not reverse True. (d)a regular language can be generated by two or more different grammar True. (e) Finite State machine (FSM) can recognize only regular grammar-true. 5. What is Backus-Naur Form (BNF)? Computer scientists describes the programming languages by a notation called Backus-Naur Form. This is a context free grammar notation with minor changes in format and some shorthand. 6. What are the closure properties of CFL? CFL are closed under union, concatenation and Kleene closure. CFL are closed under substitution, homomorphism. CFL are not closed under intersection, complementation. Closure properties of CFL s are used to prove that certain languages are not Context free. 7. State the pumping lemma for CFLs. Let L be any CFL. Then there is a constant n, depending only on L, such that if z is in L and z >=n, then z=uvwxy such that : (i) vx >=1 (ii) vwx <=n and (iii) for all i>=0 uviwxiy is in L. 8. What is the main application of pumping lemma in CFLs? The pumping lemma can be used to prove a variety of languages are not context free. Some examples are: L1 ={ ai c i i>=1} is not a CFL. L2= { aibjcidj i>=1 and J>=1 } is not a CFL 9. Define Chomsky normal form. A grammar in which all productions are the form ABC or A_ where A,B and C are variables and a is a terminal. 10. Define Grieback normal form? A grammar for which every productions is of the form Aa_ where A is a variable, a is a terminal and _ is a string of variables. A language L is said to be deterministic context free language, if and only if there exists a deterministic pushdown automata (dpda) M such that L = L (M)

9 UNIVERSITY QUESTIONS : Year: NOV / DEC 2010 Two marks 1. Show that the statements p v q v r v s and (( p q) r) -> s are equivalent. 2. List all the properties of an equivalence relation. 3. Define Finite Automata. 4. Define Kleene star of a Language. 5. Let L { 0,1}* be the language of all strings of even length.(since 0 is even ξl). Is L regular? If it is, what is a regular expression corresponding to it? 6. let L= {0,11}.Find L 0,L 2. 7. Let L be the set of all strings over {0,1} of length 6 or less. Find out the regular expression corresponding to it. 8. Draw the NFA for (a b)* 9. state The Pumping Lemma for Regular Languages, 10. Explain how membership is tested in a regular language. 11. Explain how two states of a DFA distinguished. 12. What is the central idea behind the minimization of DFA? 13. What are parse trees? 14. When is a CFG said to be right linear? 15. What is a yield of a tree? 16. When is grammar said to be ambiguous? 17. What are the conditions to be satisfied by grammer in CNF? 18. prove the following theorem: if L is a CFL,then so is L R. 19. What is GNF? 20. Eliminate Unit production from the following grammer I -> a b Ia Ib I0 I1 F->I (E) T->F T*F E->T E+T Year: APRIL / MAY 2011 21. List the application of automata theory. 22. Differentiate NFA and DFA. 23. Differentiate L* and L +. 24. Define ξ closure 25. state Arden s Theorem. 26. Construct a regular expression for the language over the set = (a,b) in which total number of a s are divisible by 3. 27. List the applications of regular expression. 28. Find out the language generated by the regular expression (0+1)* 29. What is the closure property of regular sets? 30. Mention the applications of pumping lemma 31. Is it true that the language accepted by any NFA is different from the regular language? Justify your answer. 32. Give a regular expression to describe an identifier and a positive integer. 33. When is a grammer said to be anbiduous? 34. Define instaneous description (ID) in PDA. 35. Specify the two types of moves in PDA. 36. Find L(G) where G= ({S},{0,1},{s->0S1,s->ξ},s) 37. State Chomsky Normal Forms. 38. Eliminate all unit productions:s->aa B;B->A bb;a->a bc B 39. What are the closure properties of CFL? 40. State the Pumping Lemma for CFLs.

10 Year: MAY / JUNE 2010 41. What is finite automata? 42. Give a DFA which accepts (a/b)*abb. 43. State the rules that define the regular expressions 44. give few algebraic laws that hold for arbitrary regular expressions r,s and t. 45. what does the statement that the regular languages are closed under complement mean? 46. Give formal statement of Pumping Lemma for a regular Language L. 47. Define Context-free grammer. 48. What is parsing? 49. state the properties of CFL. 50. Differentiate PDA from that of Finite State Machines. 5. Design a PDA to accept the set of all palindrome strings.trace it for the string aba. 6. Explian in detail Decision Properties of Regular Languages. 7. Explain in detail Closure Properties of CFL. 8. a) What is PDA?Write the steps ro convert a grammer to PDA b) Convert the following grammer to PDA I->a b Ia Ib I0 I E->I E*E E+E (E) 9. Construct an equivalent DFA for the following NFA Possible 8 Marks/12 Mark/18 Mark 1. Construct a minimized DFA for (a b)*abb 2. a) Design a CFG for the set {0 n 1 n n 1}. b) Construc the left most and right most derivation tress for the expression 0011 and 000111 3. Convert the following grammer to CNF S->AACD A->aAb ^ a->ac a D->aDa bdb ^ 4. Design a finite Automata accepting the following regular expressions a) (a+b)*(ab+bba) b) {0,1}*{10} 10. Construct the regular expression for the following DFA using Arden s method: M=(Q,,δ,q0,F) Where Q={q0,q1,q2}, ={0,1}, q0=q0,f=q2 δ 0 1 q0 q1 q1 q1 q2 q2 q2 q1 q1 11. a) Prove the equivalence of NFA and DFA. b)prove that if L is accepted bya DFA then L is denoted by a regular expression. 12. Construct a DFA equivalent to M = ({q0,q1,q2,q3},{a,b}, δ,q0,{q3}) Where δ (q0,a) = {q0,q1}; δ (q0,b) = {q0}; δ (q1,a) = {q2}; δ (q1,b) = {q1}; δ (q2,a) = {q3}; δ (q2,b) = {q3}; δ (q3,b) = {q2};

11 13. a) Show that the following grammer is ambiguous. S->aSbS bsas ξ b) Let G = { {S}, {a,b}, P, S} with P:{S->aSa;S->bSb;S->ξ} find the language generated by this grammer? 14. Convert the following CFG to GNF A1->A2A3; A2->A3A1 b; A3->A1A2 a 15. Obtain a PDA to accept the language L= (a n b 2n n>= 1} 16. obtain a CFG that generates the language accepted by PDA M = ( {q0,q1},{a,b},{a,z}, δ,q0,z,{q1}) with the transitions δ (q0,a,z) = {q0,az} δ (q0,b,a) = {q0,aa} δ (q0,a,a) = {q1,ε}