P. 1

|Views: 570|Likes:

See more
See less

01/30/2014

pdf

text

original

# SHAHEED UDHAM SINGH COLLEGE OF ENGINEERING AND TECHNOLOGY , TANGORI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

Subject Code: CS-404 Subject Name: FLAT Prepared By: - Er. Sukhpreet Kaur Year/ Sem: 4th / 7th

1) 2) 3) 4) 5) 6) 7) What is the difference between Kleene’s closure and Positive closure of a set? What is a Finite Automaton? The Regular Sets are closed under Homomorphism. Explain. Explain Homomorphism and Inverse Homomorphism. What are Ambiguous Grammars? Is Push Down Automata a Deterministic Device? Explain. What is the difference between Regular Grammar and Context Free Grammars? 8) If F1 and F2 be two Finite Automata accepting languages L1 and L2 respectively, when can F1 and F2 be termed as equivalent? 9) Can the language {anbncn : n>=0 } be accepted by a Turing Machine. 10) State any two properties of LR(k) grammars. 11) What do you mean by reduced grammars? Give example. 12) Every non-empty CFL is generated by a CFG with no useless symbols. Justify the statement. 13) Give the leftmost order of derivation of a string id + id * id. Also draw the derivation tree with the grammar E  E+E | E*E | id. 14) What do you understand by Recursively Enumerable Language? 15) State about Dyck Language. 16) Define Regular Expressions. 17) What do you understand by Canonical Derivations? 18) Differentiate between Context Free and Context Sensitive Grammars. 19) The conversion from a grammar to Chomsky normal form can square the number of productions in a grammar. Justify the statement. 20) Write the definition of a Language and give an example. 21) Give the difference between Type 1 grammars and Type 2 grammars. 22) Write the One Sided Context Sensitive Grammar. Give the mathematical definition of Finite Automata. Write the Kuroda Normal Form. Explain in detail the properties of LL(k) grammars. Give the transition table of a Turing Machine. Write algebraic properties of Universality.

23) 24) 25) 26) 27)

36) Find the language generated by the following grammar S  0S1 | 0A1 . and use it to find a deterministic automaton accepting the same set. . True/False 32) Derivation languages must be Context sensitive languages….G generating all integers ( with sign) 38) Cellular automaton can be made to work in any dimension of adjacency….28) For a given problem if a Turing machine halts.Push Down Automata? 49) Construct a nondeterministic finite automaton accepting {ab. A  aAB | a . 55) Prove that the following grammar is ambiguous :S  aB | ab . A  bS . 44) What is Idempotence Law of Union? 45) What is meant by Yield of a Parse Tree ? 46) Give formal notation for Push Down Automata. SΛ. A  aAB | a .E for the following language: a) which uses first character ‘a’ or ‘c’ followed by any string using ‘b’. A  1A | 1. b) which uses character a . 1}. 53) What are Rewriting Systems? What are the two operations in Rewriting Systems? 54) Give the R.F. B  ABb | b. B  ABb | b.b} is an example of Dyck Language…. 56) Find the language generated by the following grammar S  aA .ba}. True/False 41) C compiler is an example of one sided context sensitive grammar…. True/False 29) A grammar given by A aS | b | aSS | a is in GNF. True/False 33) A set of palindromes over the set {a. 30) Finite Automata can have a single bit memory to remember a past state in which it has been at earlier time… True/False 31) Homomorphism is property of regular languages but not of context free languages…. True/False 42) What is ε –closure of state? 43) Write regular expression for the language which consists of set of strings of 0's and 1's with atmost one pair of consecutive 1's. True/False 34) What are Rewriting Systems? What are the two operations in Rewriting Systems? 35) Prove that the following grammar is ambiguous :S  aB | ab . it signifies that the problem cannot be enumerated by a Push Down Automata…. True/False. True/False 39) A language that is accepted by a Push Down Automaton must always have a grammar to generate the same language set…. 50) Consider a set L = {0. True/False 40) LL(1) grammars are never ambiguous…. 37) Construct a C. b but have exactly one ’a’. 47) What are useless symbols in context of grammars? 48) What is 2. What is L* and L+? 51) What is the difference between NDFA and DFA? 52) Differentiate between PDA and 2PDA..

1}. 66) Differentiate between Derivation Trees and Derivation Graphs. 78) Design a FA which accepts the only input 101 over the input set Z = {0. 62) Differentiate between Homomorphism and Isomorphism.1). then what is r? 72) Describe in simple English the language represented by the following regular expression r = (a +ab)* 73) Write a regular expression which denotes a language L over the set Σ = {1} having odd length of strings.c) containing at least one a and at least one b.e = (b * (aaa) * b *)* 75) Show that (0*1*)* = ( 0 + 1)* 76) Construct CFG for the language containing atleast one occurrence of double a. B 1B 1. 59) Find the language generated by the following grammar S 0S1 | 0A | 0 | 1B | 1 .Design a CFG for the language :L = { 0n 1n | n>=0} U { 1n 0n | n>=0} 58) State and prove Arden’s Theorem. A  0A | 0 . 60) Find the grammar for the following language : L = { an b2n cm | n. 67) Define Parse Trees ? What is meant by a yield of a parse tree? 68) Write the regular expression for the language accepting all combinations of a’s over the set Σ = {a}.1}.m>=0} 61) Consider the CFG SXX. X XXX | bX | Xb | a Find the parse tree for the string bbaaaab. 81) Design FA which accepts only those strings which start with 1 and ends with 0. 57) . 77) Construct CFG for the language containing all the strings of different first and last symbols over Σ = {0. 74) Describe the language denoted by following regular expression r. 67) What are Derivation Languages? State the algebraic properties of derivation languages with suitable example. 79) Why finite automata are less powerful than PDA? 80) Design a FA which checks whether the given binary number is even. 70) Construct the regular expression for the language accepting all the strings which are ending with 00 over the set Σ = {0. 71) If L = { The Language starting and ending with a and having any combination of b’s in between}.b. 63) Write the regular expression over alphabet (a. 65) Write a regular expression for the set of strings of 0’s and 1’s not containing 101 as a substring. 64) Give the regular expression for the set of strings of 0’s and 1’s whose tenth symbol from the right end is 1. 69) Design the regular expression for the language accepting all combinations of a’s except the null string over Σ ={a}.

5) a) State differences between a push down automata and a 2 push down automata. b}. 7) Discuss the working of cellular automata with a suitable example. {e. 6) Why is it necessary to have unambiguous grammar? Consider the grammar given by SaS | aSbS | ε. Prove that this grammar is unambiguous. Z ) = { ( q. where P1 = { S  aSb | ab } is equivalent to G2 =( {S . Aa . e. 11) List and explain various formal language aspects in detail. S  1A | 0B . A  bSCa. S  as/aSbS/ ε.i}. ε ) } Convert this PDA to an equivalent grammar.ZZ)} δ ( q . A . S ) . B  aSB | bBC. P1 . A}. {a . B  ab . {a.Long Answer/Comprehensive Type Questions 1) Find the reduced grammar that is equivalent to CFG given below S  aAa . q . . 2) Show that G1 = ( { S} . P. C  aBC | ad. C SB . Z ) = { ( q. S AB .δ . A  1AA | 0S | 0 . {a . 10) Construct the Finite Automata for accepting all possible strings of zeros and one’s which does not contain 011 as substring. Bb} 3) Convert the following grammar into CNF. 15) Draw a parse tree for the following grammar which derives the string 00011 S  A1B A  0A/ ε B  oB/1B/ε 16) Consider the following ambiguous grammar. 12) List the properties of context free grammars/languages. {Z}. S ). C}. C aB.b}. 8) Construct a NPDA equivalent to the following grammar: G = ( {S. b} . Z) where δ is defined by : δ ( q . i . P2 . B. where P2 = { S AC . 14) Prove that {0"/n is a power of 2} is not a regular language. A  bBB . S ) Productions S -> a A A A -> a S | b S | a 9) Find the reduced grammar that is equivalent to CFG given below : S  aC | SB. 13) Explain Translation Lemmas in complexity theory. B  0BB | 1S | 1 4) Prove that the language of a set of strings of 0’s and 1’s whose length is a perfect square is not regular. b) Consider the following Push Down Automata P = ({q}.

Show that the string ‘aab’ has two : (i) Parse Trees (ii) Left Most Derivation (iii) Right Most Derivations 17) Write a brief note about Universality and Complexity in cellular automata.S) with V ={S}. 24) Write the definition of a non deterministic push down Automata (npda).b. . S ) . Aaab. T={a. C}. S abSb | a | aAb A  bS | aAAb. i>=1} Prove that L is not a regular set. {a. Explain the statement with a suitable example. B. S ). b}. where P1 = { S  aSb | ab } is equivalent to G2 =( {S . 31) Identify and remove the unit productions from following grammar S A | bb. A.e. 25) Convert the following grammar with productions SABa. P. Construct a PDA equivalent to the following grammar. A . then X ∩ Y is also regular over ∑. D  aDA 29)Show that G1 = ( { S} . {a . 18) Give the Deterministic Finite Automata accepting the set of all strings of 0’s and 1’s in which both the number of 0’s and 1’s are even. C  abb |DD .P. 26) Show that L ={anbncn | n>=1} is not context free but context sensitive. 19) Let L be the set of all strings given by 0i1i where i is an integer greater than 1 i. {a . B. Sc} where generates the language {wcwR : w t {a.b}* } by final state. Aa . 27) If X and Y are regular sets over ∑. C}. P ={ SaSa . S) with Productions S -> AB | BC A -> BA | a B -> CC | b C -> AB | a Determine if these strings are in the language: a) aaaaa b) aaaaaa c) baabab 22) Some languages which are not accepted either by a Finite Automaton or by a Push Down Automaton are accepted by a Turing Machine.b}.b}* and wR is reverse of string w}. SbSb . BAc to Chomsky Normal Form. Construct a pda A accepting L={ wcwT | w belongs to {a. A  Sb | bcc | DaA . where P2 = { S AC . 21) Given the CFG G = ( {S. Bb} 30) Convert the following grammar into CNF. P2 . L = { 0i1i | i is an integer. E  aC .c}. 28)Find the reduced grammar that is equivalent to CFG given below : S  aAa . C SB . 20) Let G be a grammar given by (V. b} .T. 23) Convert the grammar SAS | aa into GNF. P1 . S AB .

iii) Build an FA that accepts only those words with exactly four letters. C  c. CaBC | ad. A aA | Λ . All strings in which a is tripled or b is tripled. All strings that have an odd number of a’s and an odd number of b’s. All strings that have an even number of a’s and an odd number of b’s. 40) Let G be a CFG in Chomsky Normal Form. 42) How do we eliminate empty moves from any NDFA? 43) What are the various identities for the regular expressions? 44) Construct a regular expression defining each of the following language over the alphabet ∑ = { a.c} in which every string will be such that any number of a’s is followed by any number of b’s is followed by any number of c’s. d. ii) Build an FA that accepts only those words that have fewer than four letters. BaSB | bBC. b) Write a regular expression to denote a language L over Σ*. 47) Write a regular expression to denote a language L which accepts all the strinsg which begin or end with either 00 or 11. B  S | a. 35) Construct a finite automata for the regular expression r = (a + b)* abb. 37) Prove that language which contains set of strings of balanced parentheses is not regular.b} i) Build an FA that accepts only those words that have more than four letters. Give an algorithm to determine the number of distinct derivations of a string x. 36) Prove the following identity : ( a * ab + ba)*a* = (a+ab+ba)*. v) Build an FA that accepts only those words that begin or end with a double letter. having any combination of a’s and b’s except null string.A  B | b. 33) Find the reduced grammar that is equivalent to the CFG given below: SaC | SB .c} such that every string will have atleast one a followed by atleast one followed by atleast one c. 32) Consider the following grammar G and remove the null productions : SABAC . 45) Build a Turing Machine that accepts the language of all words that contain the substring bbb. 38) Write a CFG which generates strings having equal number of a’s and b’s. 46) a) Write regular expression to denote the language L over Σ*. e. B bB | Λ . b. iv) Build an FA that accepts only those words that do not with ba. All strings in which letter b never triples. AbSCa .b. where Σ = {a. where Σ = {a. All strings that do not end in a double letter.b. which can generate string. . 41) Write out the steps using the pumping lemma for CFL's to prove that L = { aibici | i >= 1 } is not a CFL. c.b} a. 34) For the ∑ = {a. 39) Design a CFG.

56) Recognize the context free language for the given CFG S  aB | bA A  a | aS | bAA B  b | bS | aBB 57) Design FA which accepts odd number of 1’s and any number of 0’s. c) Construct regular expression for the language which consists of exactly two b’s over the set Σ = {a. 61) Construct NFA for the regular expression b + ba* 62) Design a FA from given regular expression 10 + (0 + 11) 0*1. then prove that there is context free grammar G with L(G) = L 3) What is the significance of converting a grammar to GNF? Convert the following grammar to GNF S ASB | ε A aAS | a B  SbS | A | bb 4) a) Turing machines are simplified representation of a general computer. 59) Compare push down automata with finite automata. e) Construct a regular expression which denotes a language L over the set Σ = {0} having even length of string. 54) Construct a grammar which consists of all the strings having atleast one occurrence of 000.for the language consisting strings of twice as many a’s as b’s. d) Write a regular expression which contains L having strings which should have atleast one 0 and atleast one 1.b}. Very Long Answer/Application Based Questions 1) Prove that how all the languages classified by the Chomsky are closed under union.48) a) Write a regular expression to denote a language L over Σ*.1}. 49) Show that ( ab )* is not equal to (a*b*) 50) Show that (r+s)* is not equal to r* + s* 51) Prove that r(s+t) = rs + rt 52) Find whether (a*ab + ba)*a* = (a+ab+ba)* 53) Construct a grammar for the language containing strings of at least two a’s. where Σ = {a. 55)Construct CFG for the language in which there are no consecutive b’s. Explain b) Design a Turing Machine to accept the language L of palindromes over . the strings may or may not have consecutive a’s. 2) Let M be a push down automata accepting a language L by empty stack. b) Construct a regular expression for the language L which accepts all the strings with atleast two b’s over the Σ = {a.b} such that the third character from right end of the string is always a.b}. concatenation and transpose. 60) Construct PDA over Σ = {0. 58) Design FA which checks whether the given unary number is divisible by 3.

Are there cases when we cannot find a string that cannot be pumped to prove a language is not regular? 19) How do the three constraints of "special form GNFA" definition make sense in the procedure converting DFA to regular expression? 20) The pumping lemma states that all regular languages have a special property. 10) L = { ww | w in Sigma star } is not a CFL. What essential feature does a Turing machine have that a NPDA did not have to be able to recognize L ? 11) Prove that for any CFG G there is a CFG G1 in Chomsky Normal Form such that L(Gl) = L(G) where L is the language accepted by the grammar. how to prove that they are equal. or in other words they match exactly the same language? 17) Prove that if L is regular then LT is also regular. 6) Consider the grammar: S A . 13) Convert the following regular expression to NFA : ( i ) ( 0 + 1 )1 ( 0 + 1 ) (ii) 00 (0 + 1) (iii) 01* (iv) (0 + 1) 01 14) If L is a context free language. Explain. including delta transition table for the specific machine that starts with a number n on the tape and finishes with n squared on the tape. 7) Write the machine description for a Turing machine. A  BA | ε . A  0B . Is there any nonregular language having this special property? 21) Discuss in brief Griebach Normal Form. Prove. 12) Design a Turing Machines which generates a set of string with equal numbers of 0's and 1's. B  S | a. 16) Given two regular expressions. 23) Consider the following grammar G and remove the null productions : . 5) How can you say that Turing Machines are more capable than finite state machines. B  A0 . 18) We can use Pumping Lemma to prove a language is not regular by contradiction. Reduce the following grammar into GNF : S  A0 . n on the input is just n zeros followed by blank tape.{a. (tape 000#b) 8) If L is a context free Language. 15) Construct an NFA for the following regular expression: 10 + (0+11) 0*1. then there exists a PDA M which accepts L. L is recognized by a Turing machine. Prove. 22) Identify and remove the unit productions from following grammar S A | bb. B  1. 9) Construct an NFA for the following regular expression: 10 + (0+11) 0 * 1. Construct NFA and its equivalent DFA for LR(1) items of above grammar. A  B | b. BaB | b.b}. then there exists a PDA M which accepts L.

whether B is regular? Or under which circumstance would the conclusion be true? 38) We can construct a CFG for a regular language by constructing a DFA for that language. the number of rules. 29) What are the linear grammars? Explain its various types.v belongs to terminal set and they are not empty/ Show that a context-free language is regular iff it is generated by a nonselfembedding grammar. 28) a) Construct a regular grammar which can generate the set of all strings starting with a letter ( A to Z) followed by a string of letters or digits ( 0 to 9). Also prove the following: a) A right – linear or left-linear grammar is equivalent to a regular grammar. then L2 is regular.SABAC . m < n. If C and A are both regular. intersection. Are there any tips how to draw the diagram? 37) Let A. What kind of CFG can be constructed this way? Do these CFGs have some attributes? Is there a clear way to know whether the language is regular by only the context-free grammars? 39) If we already know some CFG is ambiguous. AbSCa . how can we easily check whether these two minimal DFAs are isomorphic? 41) Why do Turing recognizable/decidable languages not have a pumping lemma? Is it because they have not enough structure information like CFL and regular language? . 24) Find the reduced grammar that is equivalent to the CFG given below: SaC | SB . 26) Build a Turing Machine that accepts the language ODD PALINDROME. C  c. b) Show that a deterministic finite automaton with n states accepting a nonempty set accepts a string of length m.C be languages. then L2 is regular. c) If L* is regular. b) A linear grammar is not necessarily equivalent to a regular grammar. is there some algorithm to eliminate the ambiguity? 40) If two DFAs M1 and M2 have been transformed to their minimal forms. and C = A concat B. concatenation? 36) The state diagram of a TM seems to be tricky. 32) Why are all regular languages context-free? How can we prove it? 33) What's the difference between the language recognized by deterministic and nondeterministic ones? Can we make a pushdown automaton deterministic? 34) What do you want to minimize. the total length of right-hand sides. 27) Are the following true or false? Support your answer by giving proofs or counterexamples. 30) A context free grammar G is said to be self-embedding if there exists some useful variable A such that A can derive uAv. 25) Construct the DFA for the regular expression (0+1)*1 (0+1). 31) Show that a regular set accepted by a deterministic finite automaton with n states is accepted to final state by a deterministic pda with n states and one pushdown symbol. the maximum length of right-hand side? 35) Are Context Free Languages closed under union. CaBC | ad. B bB | Λ . A aA | Λ . Deduce that every regular set is a deterministic context-free language. a) If L1 U L2 is regular and L1 is regular. complement.B. BaSB | bBC. where u. then L is regular. b) If L1L2 is regular and L1 is regular.

q1} q1 | phi | {q2} q2 | {q2} | {q2} q3 | {q4} | phi q4 | {q4} | {q4} M = (Q. 1} ending in 11 2) The set of strings over sigma={ 0. design a Deterministic Finite Automata.42) Which of the following grammars generates the string \$\$ X  \$ | X\$\$ | \$\$X X \$ | \$\$X | XX\$ X  \$ | \$\$\$ | XX X \$ | \$\$X | X\$X X  \$ | \$X\$ | \$\$X 43) For each language below. 47) Design a FA that reads strings made up of letters in the word CHARIOT and recognize those strings that contain the word ‘CAT’ as a substring. c} that contains the empty string and strings that have a length that is a multiple of three with every block of three containing one a. 46) Construct the transition graph for a FA which accepts a language L over Σ {0. 49) a) Construct a NFA in which double ‘1’ is followed by double ‘0’ over Σ = {0. F) Q={?} F={?} q0 = ? sigma = { ? } delta = ? transition table ? 45) a) Design FA to check whether given decimal number is divisible by three.q3} | {q0. . Languages: 1) The set of strings over sigma={ 0. b) Write the state transition table. q4 } ----+----------+---------q0 | {q0. 1} that contain three consecutive ones.1}.1 } in which every string start with 0 and ends with 1. a) Draw the state transition diagram. b) Design FA which checks whether a given binary number is divisible by three. one b and one c. b. b) Design NFA which accepts the string containing either ‘01’ or ‘10’ over Σ = {0. c) Write a regular expression. 48) Design DFA for accepting the set of integers. delta.1}. 3) The set of strings over sigma={ a. DFA. q0. 44) Convert the NFA to an equivalent DFA | 0 | 1 F = { q2. sigma.

) .b}. compute log(n) function. Design a Turing Machine which recognizes the input language having a substring as 101 and replaces every occurrence of 101 by 110. ]. Construct Turing Machine for performing logarithmic operation of given binary number i.b} which will convert lower case letters to upper case.50) 51) 52) 53) 54) 55) 56) 57) 58) 59) 60) Design push down automata which accepts only odd number of a’s over Σ = {0. }. b) Construct Turing Machine for copying the input unary string on the tape. Consider the parenthesis is as (. [ . a) Construct Turing Machine for reversing a binary string on the input tape.e. Construct a Turing Machine which accepts the language of aba over Σ = {a. Construct Turing Machine for concatenation of the two strings of unary numbers. Construct pda for accepting the strings of even-length parenthesis. Build a multitrack Turing Machine for checking whether given number is prime or not? . { . Construct Turing Machine for obtaining two’s complement of a given binary number. Construct a Turing Machine M for Σ = {a. Design pda that checks the well formedness of parenthesis. This TM is for a concatenate function.1}.

scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->