Escolar Documentos
Profissional Documentos
Cultura Documentos
ENGINEERING COLLEGE
RSM Nagar, Kavaraipettai – 601 206
2. Write regular expression for the language accepting the strings which are starting with 1and
ending with 0, over the set = {0,1}.
3. Find the LMD and Parse tree for the string w =aabbbb
S AB A aAA | aA | a B bBB | bB | b .
5. What are the different ways of language acceptances by a PDA and Define them.
5. Is it true that Non deterministic PDA is more powerful than that of Deterministic PDA. Justify.
5. What is the additional feature a PDA has when compared with NFA?Is PDA superior over NFA in the
sense of language acceptance? Justify your answer.
7. Is it possible that a Turing machine could be considered as a computer of functions from integers to
integers? If yes justify.
Part – B ( 5 x 13 = 65 Marks)
11.a. (i) Prove that all Natural numbers of the form 23n – 1 is divisible by 7 using Principle
of Induction. (6)
(ii) Give Deterministic finite automata accepting the following language over the
alphabet(0,1) (7)
1. Number of l's is a multiple of 3
2.Number of l's is not a multiple of 3
11.a. (i) Prove that the language ‘L’ is accepted by some DFA if and only if ‘L’ is accepted by some NFA.(6)
(ii) Convert the following NFA to DFA. (7)
q0 {q1} Φ Φ Φ Φ
q1 Φ { q1,q2} {q3} Φ Φ
q2 {q3} Φ Φ { q2 } { q2}
States 0 1
p {p,q} {p}
q {r} {r}
r {s} ф
*s {s} {s}
11.b. Find the regular expression for the set of all strings denoted by R 13 from the deterministic
finite automata given below: (13)
11.b. (i) Prove that if there is a Regular Expression R, then there is a NFA with ε transition M,
Such that L(M) = L(R). (7)
(ii)What is regular expression? Write a regular expression for the language L which
accepts all the strings which begin or end with either 00 or 11. (6)
11.b. (i)Consider the following finite Automata and find the equivalence and minimized state (7)
equivalent DFA.
Inputs
States 0 1
A B A
B A C
D B
C
D A
*D
D F
E
G E
F
F G
G
G D
(ii) Construct an NFA equivalent to the regular expression ((0+1)(0+1)(0+1))*. (6)
Inputs
States 0 1
A B E
B C F
D G
*C
E H
D
F I
E
G B
*F
H B
G
I C
H
A E
*I
(ii) Check whether the language L= {ap/ p is prime} is regular or not? Justify your answer. (6)
11.b. (i) Find the regular expression corresponding to the finite automaton given below. (8)
Inputs
States 0 1
12.a. (i) Let G be a grammar S0B/1A, A0/0S/1AA, B1/1S/0BB. For the string (8)
00110101 find its leftmost and rightmost derivation and also construct derivation tree.
(ii) Construct the context-free grammar representing the set of palindromes over (0+1) *. (5)
12.a. (i) Prove that if there is a parse tree for the grammar G that has ‘w’ as its yield of the parse tree, then
there exist a left most derivation for the same grammar G such that A ==> w. (8)
12.a. (i) The following grammar generates prefix expressions with operands x and y and binary (7)
operators +,- and * and the grammar is as follows, E +EE / *EE / -EE / x / y
(a) Find the leftmost and rightmost derivation and derivation tree for the string “+*-xyxy “
(b) Prove that this grammar is Unambiguous.
(ii) Construct a CFG for the language L= {wcw R / w is a string in (a+b)*}. (6)
12.a. (i) Derive the string b*(b+a11) using leftmost and rightmost derivation for the following (6)
production E I / E + E / E * E / ( E ) I a / b / Ia / Ib / I0 / I1
(ii) Define Ambiguous grammar. Check whether the following grammar is ambiguous or not. (7)
S aSbS / bSaS / ε
12.a. (i) Define ambiguity. Show that the grammar is ambiguous. S a / abSb /aAB AbS / aAAb. (8)
(ii) For the grammar G is defined by the productions E E + E / E * E / (E) / a.
Find the Parse tree for the Yield (a+a)*(a+a). (5)
12.b. Consider the following grammar and eliminate useless symbols, ε-productions,
unit production and find CNF. (13)
S0A0 / 1B1 / BB , A C , B S / A , CS / ε
12.b. (i) Find CNF for the following grammar, S aAD A aB / bAB B b D d (8)
(ii) Eliminate ε-production for the following grammar G, SCD CcCC / ε DdDD / ε (5)
12.b. Convert the following Grammar into Chomsky Normal Form (13)
S aAa / bBb / ε
AC / a
BC / b
CCDE / ε
DA / B /ab
13.a. (i) Prove that if there exists a PDA that accepts by empty stack than there exists an equivalent PDA
that accept by final state. (6)
(ii)Construct a PDA for the language L= { wwR / w is in (0 + 1)*}}.Find the instantaneous
description for the string “0110”. (7)
13.a. (i) Construct a PDA to accept the language L={anbn+mcm / m,n>0 } by empty stack. (7)
3n n
(ii) Construct a PDA to accept the language L={ a b / n≥0}by final state. (6)
13.a. Construct a PDA PN that accepts the language L={ anbma2(n+m) / m≥1,n≥0}by empty stack .Convert it into
PF accepting by final state and show the string “abaaaa” in accepted by PDA(PF). (13)
13.a. (i) Prove that if there exists a PDA that accepts by final state than there exists an equivalent PDA
that accept by empty stack. (6)
(ii) Explain Deterministic Pushdown Automaton with example. (7)
13.a. (i) Construct a PDA to accept the language L={ a3nbn / n≥0}by final state. (7)
(ii) Construct a PDA to accept the language L={anbman / m,n>0 } by empty stack. (6)
13.b. (i) If L is context free Language Prove that there exists a PDA M,such that L=N(M). (6)
(ii) Construct the PDA for the grammar S->aB /bA , B->b /bS /aBB , A->a /aS /bAA .
Find Instantaneous description for the string bbaabba . (7)
13.b. (i) Construct the PDA for the grammar S->aB /bA , B->b /bS /aBB ,A->a /aS /bAA
Find Instantaneous description for the string bbaabba . (7)
(ii) Show that L={anbncn /n≥1} is not context free language. (6)
13.b. Convert the PDA P=({q0, q1},{a,b},{Z0,Z1},δ, q0, Z0 ) to a CFG, if δ is given by, (13)
13.b. Convert the PDA P=({p, q},{0,1},{X,Z0},δ, q, Z0 ) to a CFG, if δ is given by, (13)
13.b. (i) Let M=(Q, ,,,q0,Z0) be a PDA .Then there is a context free grammar G such that L(G)=N(M). (7)
(ii) Construct the PDA for the grammar S->aB /bA , B->b /bS /aBB ,A->a /aS /bAA . (6)
14.a. (i)Design a Turing machine to accept the language L={0 n1n /n≥1}and simulate its action on
the input 00111. (9)
(ii) Construct a Turing machine that accept strings over{1} containing even number of 1's. (4)
14.a. (i)Design a Turing machine to accept the language L={a nbn cn /n≥1}and simulate its action on
the input aabbcc. (9)
(ii) Construct a Turing machine to compute the function f:NN such that f(x)=x+2. (4)
14.a. (i) Design a TM for the language L: The set of strings with an equal number of 0's and 1's.
Find Instantaneous description for the string w=1010. (9)
(ii) Construct a Turing machine that accept all strings contains a substring aba. (4)
14.b. Design a Turing machine M to implement the function "MULTIPLICATION" using the
subroutine copy. (13)
14.b. Write briefly about the programming techniques for TM. (13)
14.b. Design a Turing Machine M for f(x, y) = x * y where x, y are stored in the tape in
the form 0X10Y1. (13)
14.b. (i) State the halting Problems of Turing machine. Prove that the halting problem of
Turing machine over {0, 1}* as unsolvable. (7)
(ii) Explain briefly Chomskian hierarchy of languages. (6)
15.a. (i) Describe about Recursive languages and Recursive Enumerable languages with example (7)
(ii) Prove that "MPCP reduces to PCP". (6)
15.a. (i) What is Post Correspondence Problem? Explain with the help of example. (7)
(ii)Prove Ld is not a Recursive Enumerable Language. (6)
15.b. (i) Explain Universal Turing machine. Show that Lu is RE but not recursive. (6)
(ii) Briefly discuss the Tractable and Intractable problems with examples (7)
15.b. Explain the class P and NP complete problem with examples. (13)
15.b. (i) Define COOK’S Theorem and prove that the language CNF – Satisfiable (7)
is NP – Complete.
(ii)Show that the 3-sat Problem is NP- Complete . (6)
Part – C ( 1 x 15 = 15 Marks)
16.a. (i)Let G=(V,T,P,S) be a context free grammar then prove that if the recursive inference procedure
tells us that terminal string w is the language if variable A ,then there is a parse
tree with root A and yield w. (10)
(ii) Given the grammar G=(V,∑,R,E),where
V={E,D}
T={1,2,3,....,9, + , - , * , / , ( , ) } and R contains the following rules:
E D (E) E+E E-E E*E E/E
D 0 1 2 .....9
Find the parse tree for the string 1+2*3. (5)
16.a. (i) Construct the context free grammar for the language L= {a i b jck / i,j, k≥ 0, i=2j or j=2k} use (10)
the above CFG to create PDA by empty stack.
(ii) Show that L={ / i is an integer, i>=1} is not context free language. (5)
16.a. (i) Design the Turing machine to compute the partial function that reverse the string{a,b}*->{b,a}*.(10)
(ii) Construct a Turing machine to compute the function f:NN such that f(x)=x+2. (5)
16.a. (i) Obtain code for the following Turing Machine (8)
M=({q1, q2, q3},{0,1},{0,1,B},δ, q1,B,{ q2}) where δ is given as
δ(q1,1)= (q3,0,R)
δ(q3,0)= (q1,1,R)
δ(q3,1)= (q2,0,R)
δ(q3,B)= (q3,1,L)
(ii) Prove Ld is not a Recursive Enumerable Language. (7)
16.b. (i) Convert to Greibach Normal Form the grammar G= ({A1, A2, A3}, {a, b},P,A1 ) where P
consists of the following. A1A2 A3, A2 A3 A1 /b, A3A1 A2 /a. (11)
(ii) Explain how to eliminate ε-productions. (4)
16.b. Construct PDA to accept the language L= { wcwR / w is in (a + b)*}and use the transition
function of PDA to construct the CFG . (15)
16.b. (i) Consider a TM M=(q,{0,1},{0,1,B},,[q0,B],[q1,B]) that looks at the first input symbol,
records in the finite control and checks that the symbol does not appear elsewhere on its input. (9)
(ii) Prove that if there is a reduction from P1 to P2, then If P1 is undecidable,
then So is P2 (6)