Professional Documents
Culture Documents
Subject Code: CS-404 Subject Name: FLAT Prepared By: - Er. Sukhpreet Kaur Year/ Sem: 4th / 7th
28) For a given problem if a Turing machine halts, it signifies that the problem cannot be enumerated by a Push Down Automata. True/False 29) A grammar given by A aS | b | aSS | a is in GNF.. True/False. 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 32) Derivation languages must be Context sensitive languages. True/False 33) A set of palindromes over the set {a,b} is an example of Dyck Language. 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 , A aAB | a , B ABb | b. 36) Find the language generated by the following grammar S 0S1 | 0A1 , A 1A | 1. 37) Construct a C.F.G generating all integers ( with sign) 38) Cellular automaton can be made to work in any dimension of adjacency. True/False 39) A language that is accepted by a Push Down Automaton must always have a grammar to generate the same language set. True/False 40) LL(1) grammars are never ambiguous. True/False 41) C compiler is an example of one sided context sensitive grammar. 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. 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. 47) What are useless symbols in context of grammars? 48) What is 2- Push Down Automata? 49) Construct a nondeterministic finite automaton accepting {ab,ba}, and use it to find a deterministic automaton accepting the same set. 50) Consider a set L = {0, 1}. What is L* and L+? 51) What is the difference between NDFA and DFA? 52) Differentiate between PDA and 2PDA. 53) What are Rewriting Systems? What are the two operations in Rewriting Systems? 54) Give the R.E for the following language: a) which uses first character a or c followed by any string using b. b) which uses character a , b but have exactly one a. 55) Prove that the following grammar is ambiguous :S aB | ab , A aAB | a , B ABb | b. 56) Find the language generated by the following grammar S aA , A bS , S.
57)
Design a CFG for the language :L = { 0n 1n | n>=0} U { 1n 0n | n>=0} 58) State and prove Ardens Theorem. 59) Find the language generated by the following grammar S 0S1 | 0A | 0 | 1B | 1 , A 0A | 0 , B 1B 1. 60) Find the grammar for the following language : L = { an b2n cm | n,m>=0} 61) Consider the CFG SXX, X XXX | bX | Xb | a Find the parse tree for the string bbaaaab. 62) Differentiate between Homomorphism and Isomorphism. 63) Write the regular expression over alphabet (a,b,c) containing at least one a and at least one b. 64) Give the regular expression for the set of strings of 0s and 1s whose tenth symbol from the right end is 1. 65) Write a regular expression for the set of strings of 0s and 1s not containing 101 as a substring. 66) Differentiate between Derivation Trees and Derivation Graphs. 67) What are Derivation Languages? State the algebraic properties of derivation languages with suitable example. 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 as over the set = {a}. 69) Design the regular expression for the language accepting all combinations of as except the null string over ={a}. 70) Construct the regular expression for the language accepting all the strings which are ending with 00 over the set = {0,1}. 71) If L = { The Language starting and ending with a and having any combination of bs in between}, 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. 74) Describe the language denoted by following regular expression r.e = (b * (aaa) * b *)* 75) Show that (0*1*)* = ( 0 + 1)* 76) Construct CFG for the language containing atleast one occurrence of double a. 77) Construct CFG for the language containing all the strings of different first and last symbols over = {0,1}. 78) Design a FA which accepts the only input 101 over the input set Z = {0,1). 79) Why finite automata are less powerful than PDA? 80) Design a FA which checks whether the given binary number is even. 81) Design FA which accepts only those strings which start with 1 and ends with 0.
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. 18) Give the Deterministic Finite Automata accepting the set of all strings of 0s and 1s in which both the number of 0s and 1s are even. 19) Let L be the set of all strings given by 0i1i where i is an integer greater than 1 i.e. L = { 0i1i | i is an integer, i>=1} Prove that L is not a regular set. 20) Let G be a grammar given by (V,T,P,S) with V ={S}, T={a,b,c}, P ={ SaSa , SbSb , Sc} where generates the language {wcwR : w t {a,b}* and wR is reverse of string w}. Construct a PDA equivalent to the following grammar. 21) Given the CFG G = ( {S, A, B, C}, {a, b}, P, 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. Explain the statement with a suitable example. 23) Convert the grammar SAS | aa into GNF. 24) Write the definition of a non deterministic push down Automata (npda). Construct a pda A accepting L={ wcwT | w belongs to {a,b}* } by final state. 25) Convert the following grammar with productions SABa, Aaab, BAc to Chomsky Normal Form. 26) Show that L ={anbncn | n>=1} is not context free but context sensitive. 27) If X and Y are regular sets over , then X Y is also regular over . 28)Find the reduced grammar that is equivalent to CFG given below : S aAa , A Sb | bcc | DaA , C abb |DD , E aC , D aDA 29)Show that G1 = ( { S} , {a ,b}, P1 , S ) , where P1 = { S aSb | ab } is equivalent to G2 =( {S , A , B, C}, {a , b} , P2 , S ), where P2 = { S AC , C SB , S AB , Aa , Bb} 30) Convert the following grammar into CNF. S abSb | a | aAb A bS | aAAb. 31) Identify and remove the unit productions from following grammar S A | bb,
A B | b, B S | a. 32) Consider the following grammar G and remove the null productions : SABAC , A aA | , B bB | , C c. 33) Find the reduced grammar that is equivalent to the CFG given below: SaC | SB , AbSCa , BaSB | bBC, CaBC | ad. 34) For the = {a,b} i) Build an FA that accepts only those words that have more than four letters. ii) Build an FA that accepts only those words that have fewer than four letters. iii) Build an FA that accepts only those words with exactly four letters. iv) Build an FA that accepts only those words that do not with ba. v) Build an FA that accepts only those words that begin or end with a double letter. 35) Construct a finite automata for the regular expression r = (a + b)* abb. 36) Prove the following identity : ( a * ab + ba)*a* = (a+ab+ba)*. 37) Prove that language which contains set of strings of balanced parentheses is not regular. 38) Write a CFG which generates strings having equal number of as and bs. 39) Design a CFG, which can generate string, having any combination of as and bs except null string. 40) Let G be a CFG in Chomsky Normal Form. Give an algorithm to determine the number of distinct derivations of a string x. 41) Write out the steps using the pumping lemma for CFL's to prove that L = { aibici | i >= 1 } is not a CFL. 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,b} a. All strings that do not end in a double letter. b. All strings in which letter b never triples. c. All strings in which a is tripled or b is tripled. d. All strings that have an even number of as and an odd number of bs. e. All strings that have an odd number of as and an odd number of bs. 45) Build a Turing Machine that accepts the language of all words that contain the substring bbb. 46) a) Write regular expression to denote the language L over *, where = {a,b,c} in which every string will be such that any number of as is followed by any number of bs is followed by any number of cs. b) Write a regular expression to denote a language L over *, where = {a,b,c} such that every string will have atleast one a followed by atleast one followed by atleast one c. 47) Write a regular expression to denote a language L which accepts all the strinsg which begin or end with either 00 or 11.
48) a) Write a regular expression to denote a language L over *, where = {a,b} such that the third character from right end of the string is always a. b) Construct a regular expression for the language L which accepts all the strings with atleast two bs over the = {a,b}. c) Construct regular expression for the language which consists of exactly two bs over the set = {a,b}. d) Write a regular expression which contains L having strings which should have atleast one 0 and atleast one 1. e) Construct a regular expression which denotes a language L over the set = {0} having even length of string. 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 as. 54) Construct a grammar which consists of all the strings having atleast one occurrence of 000. 55)Construct CFG for the language in which there are no consecutive bs, the strings may or may not have consecutive as. 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 1s and any number of 0s. 58) Design FA which checks whether the given unary number is divisible by 3. 59) Compare push down automata with finite automata. 60) Construct PDA over = {0,1}.for the language consisting strings of twice as many as as bs. 61) Construct NFA for the regular expression b + ba* 62) Design a FA from given regular expression 10 + (0 + 11) 0*1.
{a,b}. 5) How can you say that Turing Machines are more capable than finite state machines. Explain. 6) Consider the grammar: S A , A BA | , BaB | b. Construct NFA and its equivalent DFA for LR(1) items of above grammar. 7) Write the machine description for a Turing machine, 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. n on the input is just n zeros followed by blank tape. (tape 000#b) 8) If L is a context free Language, then there exists a PDA M which accepts L. Prove. 9) Construct an NFA for the following regular expression: 10 + (0+11) 0 * 1. 10) L = { ww | w in Sigma star } is not a CFL. L is recognized by a Turing machine. 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. 12) Design a Turing Machines which generates a set of string with equal numbers of 0's and 1's. 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, then there exists a PDA M which accepts L. Prove. 15) Construct an NFA for the following regular expression: 10 + (0+11) 0*1. 16) Given two regular expressions, 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. 18) We can use Pumping Lemma to prove a language is not regular by contradiction. 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. Is there any nonregular language having this special property? 21) Discuss in brief Griebach Normal Form. Reduce the following grammar into GNF : S A0 , A 0B , B A0 , B 1. 22) Identify and remove the unit productions from following grammar S A | bb, A B | b, B S | a. 23) Consider the following grammar G and remove the null productions :
SABAC , A aA | , B bB | , C c. 24) Find the reduced grammar that is equivalent to the CFG given below: SaC | SB , AbSCa , BaSB | bBC, CaBC | ad. 25) Construct the DFA for the regular expression (0+1)*1 (0+1). 26) Build a Turing Machine that accepts the language ODD PALINDROME. 27) Are the following true or false? Support your answer by giving proofs or counterexamples. a) If L1 U L2 is regular and L1 is regular, then L2 is regular. b) If L1L2 is regular and L1 is regular, then L2 is regular. c) If L* is regular, then L is regular. 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). b) Show that a deterministic finite automaton with n states accepting a nonempty set accepts a string of length m, m < n. 29) What are the linear grammars? Explain its various types. Also prove the following: a) A right linear or left-linear grammar is equivalent to a regular grammar. b) A linear grammar is not necessarily equivalent to a regular grammar. 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, where u,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. 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. Deduce that every regular set is a deterministic context-free language. 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 number of rules, the total length of right-hand sides, the maximum length of right-hand side? 35) Are Context Free Languages closed under union, intersection, complement, concatenation? 36) The state diagram of a TM seems to be tricky. Are there any tips how to draw the diagram? 37) Let A,B,C be languages, and C = A concat B. If C and A are both regular, 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. 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, is there some algorithm to eliminate the ambiguity? 40) If two DFAs M1 and M2 have been transformed to their minimal forms, 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?
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, design a Deterministic Finite Automata, DFA. a) Draw the state transition diagram. b) Write the state transition table. c) Write a regular expression. Languages: 1) The set of strings over sigma={ 0, 1} ending in 11 2) The set of strings over sigma={ 0, 1} that contain three consecutive ones. 3) The set of strings over sigma={ a, b, 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, one b and one c. 44) Convert the NFA to an equivalent DFA | 0 | 1 F = { q2, q4 } ----+----------+---------q0 | {q0,q3} | {q0,q1} q1 | phi | {q2} q2 | {q2} | {q2} q3 | {q4} | phi q4 | {q4} | {q4} M = (Q, sigma, delta, q0, F) Q={?} F={?} q0 = ? sigma = { ? } delta = ? transition table ? 45) a) Design FA to check whether given decimal number is divisible by three. b) Design FA which checks whether a given binary number is divisible by three. 46) Construct the transition graph for a FA which accepts a language L over {0,1 } in which every string start with 0 and ends with 1. 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. 48) Design DFA for accepting the set of integers. 49) a) Construct a NFA in which double 1 is followed by double 0 over = {0,1}. b) Design NFA which accepts the string containing either 01 or 10 over = {0,1}.
50) Design push down automata which accepts only odd number of as over = {0,1}. 51) Design pda that checks the well formedness of parenthesis. Consider the parenthesis is as (, ) , [ , ], { , }. 52) Construct pda for accepting the strings of even-length parenthesis. 53) Construct a Turing Machine M for = {a,b} which will convert lower case letters to upper case. 54) Construct a Turing Machine which accepts the language of aba over = {a,b}. 55) Design a Turing Machine which recognizes the input language having a substring as 101 and replaces every occurrence of 101 by 110. 56) Construct Turing Machine for concatenation of the two strings of unary numbers. This TM is for a concatenate function. 57) Construct Turing Machine for obtaining twos complement of a given binary number. 58) a) Construct Turing Machine for reversing a binary string on the input tape. b) Construct Turing Machine for copying the input unary string on the tape. 59) Construct Turing Machine for performing logarithmic operation of given binary number i.e, compute log(n) function. 60) Build a multitrack Turing Machine for checking whether given number is prime or not?