Toc MQP
Toc MQP
USN
R.V.COLLEGE OF ENGINEERING
(Autonomous Institution Affiliated to VTU)
V Semester B.E
Model Question paper
THEORY OF COMPUTATION
Time: 03 Hours Maximum Marks: 100
Instructions to Candidate:
1. Answer all questions from PART-A. PART-A questions to be answered in first
three pages of the answer book.
2. Answer question 2 and any one question from 3 and 4, any one question from 5
and 6, any one question from 7 and 8 AND any one question from 9 and 10
PART-B.
PART-A
1.1 Consider the following automata. What is the set of reachable states for the 1
input string 0011?
1.2 The minimum state automaton equivalent to the below FA has how many number 1
of states
1.5 In each case, find a string of minimum length in ∑= {0, 1} not in the language 1
corresponding to the given regular expression.
i. (0*+1*)(0*+1*)(0*+1*)
ii.
0*(100*)*1*
1.6 Describe the decision algorithm to answer the following question. 1
Given two DFA’s M1 and M2, are there any strings that are accepted by neither?
1.7 Give CFG for the language “The set of odd length strings in {a, b}* with the middle 1
symbol a”.
b For the DFA below describe, either in words or by writing regular expressions, the 4
strings that cause the DFA to be in each state.
c Explain the algorithm to find an equivalent NFA from the given NFA- ϵ. Use this 4
algorithm to draw an NFA for the NFA- ϵ given below.
For the DFA shown below, use the minimization algorithm to find a minimum state
d DFA recognizing the same language. 4
3a State and prove pumping lemma for regular languages. Use pumping lemma to show 6
that the following languages are not regular.
a) L={ww | w ϵ{0,1}*}.
b) L={xy | x,y ϵ{0,1}* and y is either x or xr}.
b Describe decision algorithm to answer the following questions. 4
a) Given two DFA's M1 and M2, are there any strings that are accepted by
neither.
b) Given a regular expression r and an DFA M, are the corresponding languages
are same?
c Let M1, M2 and M3 are the DFA's pictured below recognizing languages L1, L2 and 6
L3 respectively.
OR
4 a Define CFG, Language generated by CFG, Left most derivation and Right most 4
derivation. Consider the grammar below SS+S | S-S | S*S | S/S | (S) | a.
i. Give two left most derivations for the string a+(a*a)/a-a.
ii. Give the derivation tree corresponds to each of the derivations in (i).
iii. How many distinct left most derivations of this string are there?
iv. How many derivation trees are there for the string a+a+a+a+a?
b In each case, given the context free grammar G, find an equivalent CFG with no 4
useless variables.
i. SABC | BaB, AaA | BaC | aaa, BbBb | a, CCA | AC
ii. SAB | AC, AaAb | bAa | a | є, BbbA | aaB | AB, CabCa |
aDb | є, DbD | aC
c Define GNF grammar. Given below a CFG G, find a CFG G1 in GNF generating 4
L(G) – { є }. ABC, BCA | b, CAB | a
d Draw the NFA accepting the language generated by the grammar with productions 4
S→abA|bB|aba, A→b|aB|bA, B→aB|aA
5 a Define PDA. Construct PDA for L={wwR | w є {a,b}*}. Show by IDs the string 6
abaaba is accepted.
b Let L be L(M1) for some PDA with empty stack M1=(Q,∑,Γ,δ,q0,Z0,ϕ), prove that
there exists an final state PDA M2 such that L=L(M2). Construct empty stack PDA 4
to accept L={w | w є {a,b}* and w is palindrome}. Convert it into equivalent final
state PDA.
c What are steps to be followed while finding an equivalent PDA by empty stack for 6
the given CFG. Find the equivalent PDA to the CFG with productions
S→aSb | bSa | abS | baS | Sab | Sba | є. Show that the string abaabb is generated by
the given CFG and it is accepted by its equivalent PDA.
OR
6a State and prove pumping lemma for context free languages. 6
Show that L={ww | w ∈{a,b}*} is not context free.
b Let L1={aibjck | i< j } and L2={ aibjck | i< k }. Show that L1 and L2 are context free 6
but L3=L1∩ L2 is not context free.
c Decide whether the following languages are CFL or not. 4
i. L={anbmambn| m,n≥0}.
ii. L={xayb| x,yϵ{a,b}* and |x|=|y|}.
7a Design Turing Machine to accept the language L={ w | ε {a, b}* and 6
Na(w)=Nb(w)}. Trace the machine for the string baabab.
b Let x and y are two positive integers represented using unary notation. Design 6
a Turing Machine that computes the function f(x,y), where x,y ϵ 1 +
f(x, y) = x - y if x > y
f(x, y) = y - x if y>x
f (x, y)=0 if x = y
c If L1 and L2 are recursively enumerable languages over ∑, then show that 4
L1 U L2 is also recursively enumerable languages.
OR
8a Design Turing Machine to perform the string reverse operation over ∑={a, 8
b, c}. Use Instantaneous Descriptions to show operation on w=abac.
b Write a note on 6
i. Multi tape Turing Machine
ii. Non deterministic Turing Machine
c Prove that every regular language is also a recursively enumerable language. 2
9a Construct the Linear Bounded Automata for the language 8
L={ wwR | w ε {a, b}*}. Trace the machine for the string aabbaa.
b Define Context Sensitive Grammar. 4
Give Context Sensitive Grammar to generate the language
L={ anbncndn | n ≥1}. Show that the string aabbccdd is generated by the grammar.
c Write a note on Chomsky hierarchy. 4
OR
10 a Define Unrestricted Grammar. Give Unrestricted Grammar to generate the 8
language L={ w | ε {a, b, c}* and Na(w)=Nb(w)=Nc(W)}.Show that the string
acabcb is generated by the grammar.
b Write a note on undecidability. 4
c If the given language L is Context Sensitive Language, then L is recursively 4
enumerable language. Prove this statement.
Q.P.Code
Course code: 21CS54 Course Title: Theory of Computation
PART-A
Q.No 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10
BT 1 2 3 1 2 3 2 1 1 2
COs 1 1 2 1 2 2 2 1 2 1
Q.No 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20
BT 3 4 4 4 1 3 3 2 1 4
COs 2 3 3 2 1 3 2 1 2 3
PART-B
Question No BT level COs Question No BT level COs
Addressed Addressed
a 2 1 a 3 2
2 b 3 2 3 b 2 2
c 4 3 c 4 3
d 4 3 d
a 3 3 a 3 3
4 b 4 3 5 b 2 2
c 4 4 c 2 3
d 3 4 d
a 2 2 a 4 4
6 b 3 3 7 b 4 4
c 3 4 c 3 2
d d
a 4 4 9 a 4 4
8 b 3 2 b 3 2
c 3 2 c 1 1
d 4 1 d
10 a 3 3 a
b 2 1 b
c 2 1 c
d d
Name: Name: