Atc QB
Atc QB
QUESTION BANK
Module 1 : Introduction to theory of computation and FSM
Objective:
Objective Upon the completion of this chapter you will be able to
• Define Finite automata,
• Basic principle of computation, formal languages
• Applications of finite automata i.e. DFA & NFA.
q0 a q1 λ q2
ii)
0 1
q0 0,1 q1 0,1 q2
1
q1 q3
0
Q0 0
0,1 1
0 0
b b a,b
Q0 b Q2
a
b) L = { anbm : n ≠ m }
c) L = { w ∈ { a , b }* : na(w) = nb(w) and
na(v) ≥ nb(v) where v is any prefix of w }
d) L = { a2nbm : n ≥ 0 m ≥ 0 }
23 Let G = ( V,T,S,P) be a CFG. Then prove that for every w ∈ L(G), there exists a derivation 8*
tree of G whose yield is w.
24 Prove that yield of any derivation tree is in L(G), where G is a CFG.. 8
25 If L is a regular language ,prove that the language { uv:U⊂L, v⊂LR Is also regular
26 Find DFA’s that accepts the following languages.
a) L(aa*+aba*b*)
b) L(ab(a+ab)*(a+aa))
c) L((abab)* + (aaa* +b)*)
d) L((a+b)*(a+b)*))
27 Construct parse tree for the following grammar S-> aAs|a
A->SbA|SS|ba
28 Let G=(V,T,P,S)be a CFG ,then S=>a if and only if there is a derivation tree in grammar G 8*
with yield a
30 Construct Leftmost and Right most derivation tree for the following grammar 8*
S=>aAS=>aSbAS=>aabAS=>aabbaS=>aabbaa
31 What are ambiguous grammar and inherently ambiguous grammarwith an example 10*
32 The grammar E->E+E|E*E|(E)|id generates the set of arithmetic expressions with 10
+,*,Parentheses and id.Construct an equivalent unambiguous grammar.
33 Show that every CFL without ∈ is generated by a CFG all of whose productions are of the 10*
form
A->a, A->aB and A->aBC
34 Show that every CFL without ∈ generated by a CFG all of whose productions are of the 10
form A->a and A->aab
35 Let G be the grammar 10
S->aB|bA, A->a|aS|bAA,B->b|bS|aBB for the string aaabbabbba find a leftmost
and right most derivation parse tree
36 Is the grammar given in q(42) is unambiguous if it is prove it 10
37 What are linear grammar show that if all productions of aCFG are of the form A->wB or A- 10
w then L(G) is a regulars et
38 Can every CFL without ∈ be generated by a CFG all of whose productions are of the forms 10
A->BCD and A->a
39 Construct a CFG for the set of all strings over the alphabet {a,b} with exactly twice as 10
many a’s and b’s.
40 Given the grammar G as follows S->aAS|a A->sbA|SS|ba find Leftmost derivation 10
rightmost derivation and parse tree
41 What are CFG’s Give a CFG for the Language L={an b2n|n>0} 10
42 Define a CFG Construct a CFG for the following Language with n>=0,m>=0 10
L={an bm ck :n+2m=k}
43 Define a CFG Construct a CFG for the following Language with n>=0,m>=0 10
L={an WWR bn : W∈ {a,b}*}
44 Show that family of CFL is closed under union, concatenation and star closure 10
45 Show that the language L= {anbncn | n≥1} is not a CFL 10
Pushdown Automata
1 Define the instantaneous description of a NPDA 5
2 Give the formal definition of DPDA and deterministic CFL. 5
3 Define Linear Context free grammar and write the Pumping lemma for Linear Languages. 5*
4 Distinguish between DPDA and NPDA 5*
5 What are the demerits of regular languages when compared to context free languages 5
6 What are the demerits of DFA (or NFA) when compared with PDA 5
δ(q0,a,z) ={ (q0,Az) }
δ(q0,a,A) ={ ( q0,A) }
δ(q0,b,A) ={ ( q1,λ ) }
δ(q1,λ,z) = { (q2,λ) }
31 Obtain a PDA to accept a string of balanced Parentheses. The parentheses to be considered 10
are(,),[,],{ and }
32 Show that following languages are not context free using pumping lemma 10
a) L = { anbncn : n ≥ 0 }
b) L = { ww : w ∈ { a,b }* }
c) L = { an! : n ≥ 0 }
d) L = { anbj : n = j2 }
Define linear CFL. State pumping lemma for Linear CFL.
33 Obtain a PDA to accept the Language L={w|w ∈ (a,b)* and na(w) > nb(w)} 10
Module-
Module-4 Properties of Context-
Context-Free Languages.
Objective:
Objective Upon Completion of this chapter you will be knowing about
• Different kinds of Normal forms for CFG’s that is CNF & GNF.
• How the CFL can be proved as not Context free(Pumping Lemma for CFG)
• Closure Properties of CFL’s i.e Closure Properties under
Union,Intersection,Complementation .
1 What is a normal form & why is it required? 4
2 Explain the method of Substitution with examples 4
3 What is Left Recursion? How it can be Eliminated 4
4 What is the need for simplifying a Grammar 4
5 Define CNF of a CFG. 6
6 Convert the following CFG into CNF 6