III Year V Sem Cs6503 Theory of Computation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

JEPPIAAR ENGINEERING COLLEGE

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CS6503
THEORY OF COMPUTATION

Question Bank

III YEAR A & B / BATCH : 2016 -20


 
Vision of Institution
To build Jeppiaar Engineering College as an Institution of Academic Excellence in Technical
education and Management education and to become a World Class University.
Mission of Institution
M1 To excel in teaching and ​learning, research and innovation by promoting the
principles of scientific analysis and creative thinking

M2 To participate in the production, ​development and dissemination of knowledge and


interact with ​national and international communities

M3 To equip students with ​values, ethics and life skills needed to enrich their lives and
enable them to meaningfully contribute to the ​progress of society

M4 To prepare students ​for higher studies and lifelong learning​, enrich them with the
practical and entrepreneurial skills necessary to excel as future professionals and
contribute to ​Nation’s economy

Program Outcomes (POs)


Engineering knowledge​: Apply the knowledge of mathematics, science, engineering
PO1 fundamentals, and an engineering specialization to the solution of complex engineering
problems.
Problem analysis​: Identify, formulate, review research literature, and analyze complex
PO2 engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
Design/development of solutions​: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with
PO3
appropriate consideration for the public health and safety, and the cultural, societal, and
environmental considerations
Conduct investigations of complex problems​: Use research-based knowledge and
PO4 research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
Modern tool usage​: Create, select, and apply appropriate techniques, resources, and
PO5 modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
The engineer and society​: Apply reasoning informed by the contextual knowledge to
PO6 assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
Environment and sustainability​: Understand the impact of the professional engineering
PO7 solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
Ethics​: Apply ethical principles and commit to professional ethics and responsibilities
PO8
and norms of the engineering practice.
Individual and team work​: Function effectively as an individual, and as a member or
PO9
leader in diverse teams, and in multidisciplinary settings.
Communication​: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
PO10
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
Project management and finance​: Demonstrate knowledge and understanding of the
PO11 engineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
Life-long learning​: Recognize the need for, and have the preparation and ability to
PO12 engage in independent and life-long learning in the broadest context of technological
change.

Vision of Department
To emerge as a globally prominent department, developing ethical computer professionals,
innovators and entrepreneurs with academic excellence through quality education and research​.
Mission of Department

M1 To create ​computer professionals w


​ ith an ability to identify and ​formulate the
engineering problems and also to provide ​innovative solutions through ​effective
teaching learning process.

M2 To ​strengthen the core-competence ​in computer science and engineering and to create
an ability to ​interact ​effectively with industries.
M3 To produce engineers with good professional skills, ​ethical values and life skills for the
betterment of the society.
M4 To encourage students towards ​continuous and higher level learning​ on technological
advancements and provide a platform for ​employment and self-employment.

Program Educational Objectives (PEOs)


PEO1 To address the real time complex engineering problems using innovative approach
with strong core computing skills.

PEO2 To apply core-analytical knowledge and appropriate techniques and provide


solutions to real time challenges of national and global society

PEO3 Apply ethical knowledge for professional excellence and leadership for the
betterment of the society.
PEO4 Develop life-long learning skills needed for better employment and
entrepreneurship

Program Specific Outcomes (PSOs)

Students will be able to

An ability to understand the core concepts of computer science and engineering and to
enrich problem solving skills to analyze, design and implement software and hardware
PSO1 based systems of varying complexity.

To interpret real-time problems with analytical skills and to arrive at cost effective and
PSO2 optimal solution using advanced tools and techniques.

An understanding of social awareness and professional ethics with practical proficiency in


the broad area of programming concepts by lifelong learning to inculcate employment and
entrepreneurship skills.
PSO3

BLOOM TAXANOMY LEVELS(BTL)

BTL6: Creating.,
BTL 5: Evaluating.,
BTL 4: Analyzing.,
BTL 3: Applying.,
BTL 2: Understanding.,
BTL 1: Remembering
SYLLABUS

THEORY OF COMPUTATION – CS6503 (V SEMESTER)


UNIT I FINITE AUTOMATA

9
Introduction- Basic Mathematical Notation and techniques- Finite State systems – Basic
Definitions –Finite Automaton – DFA & NDFA – Finite Automaton with €- moves – Regular
Languages- Regular Expression – Equivalence of NFA and DFA – Equivalence of NDFA’s with
and without €-moves –Equivalence of finite Automaton and regular expressions –Minimization
of DFA- - Pumping Lemma for Regular sets – Problems based on Pumping Lemma.
UNIT II GRAMMARS

9
Grammar Introduction– Types of Grammar - Context Free Grammars and Languages–
Derivations and Languages – Ambiguity- Relationship between derivation and derivation trees –
Simplification of CFG – Elimination of Useless symbols - Unit productions - Null productions –
Greiback Normal form – Chomsky normal form – Problems related to CNF and GNF.
UNIT III PUSHDOWN AUTOMATA

9
Pushdown Automata- Definitions – Moves – Instantaneous descriptions – Deterministic
pushdown automata – Equivalence of Pushdown automata and CFL - pumping lemma for CFL –
problems based on pumping Lemma.
UNIT IV TURING MACHINES

9
Definitions of Turing machines – Models – Computable languages and functions –Techniques
for Turing machine construction – Multi head and Multi tape Turing Machines - The Halting
problem –Partial Solvability – Problems about Turing machine- Chomskian hierarchy of
languages.
UNIT V UNSOLVABLE PROBLEMS AND COMPUTABLE FUNCTIONS

Unsolvable Problems and Computable Functions – Primitive recursive functions – Recursive


and recursively enumerable languages – Universal Turing machine. MEASURING AND
CLASSIFYING COMPLEXITY: Tractable and Intractable problems- Tractable and possibly
intractable problems - P and NP completeness - Polynomial time reductions.

Total= 45 Periods

TEXT BOOKS:

1. Hopcroft J.E., Motwani R. and Ullman J.D, “Introduction to Automata


Theory, Languages and Computations”, Second Edition, Pearson Education,
2008. (UNIT 1,2,3)
2. John C Martin, “Introduction to Languages and the Theory of Computation”,
Third Edition, Tata McGraw Hill Publishing Company, New Delhi, 2007.
(UNIT 4,5)

REFERENCES:

1. Mishra K L P and Chandrasekaran N, “Theory of Computer Science -


Automata, Languages and Computation”, Third Edition, Prentice Hall of
India, 2004.

2. Harry R Lewis and Christos H Papadimitriou, “Elements of the Theory of


Computation”, Second Edition, Prentice Hall of India, Pearson Education,
New Delhi, 2003.

3. Peter Linz, “An Introduction to Formal Language and Automata”, Third


Edition, Narosa Publishers, New Delhi, 2002.

4. Kamala Krithivasan and Rama. R, “Introduction to Formal Languages,


Automata Theory and Computation”, Pearson Education 2009
NOTE :REFER NOTES FOR PART B PROBLEMS

Course Outcomes (COs)

C504.1 n Finite State Automata and Regular Expression for any language

C504.2 ate the design of Context Free Grammar for any language set

C504.3 nstrate the push down automaton model for the given language

C504.4 use of Turing machine concept to solve the simple problems

C504.5 n decidability or undesirability of various problems

INDEX

Unit # Ref. Book


Hopcroft J.E., Motwani R. and Ullman J.D, “Introduction to Automata

Unit 1 Theory, Languages and Computations”, Second Edition, Pearson


Education, 2008. (UNIT 1,2,3)
Mishra K L P and Chandrasekaran N, “Theory of Computer Science -
Automata, Languages and Computation”, Third Edition, Prentice Hall of
India, 2004.
Hopcroft J.E., Motwani R. and Ullman J.D, “Introduction to Automata

Unit 2 Theory, Languages and Computations”, Second Edition, Pearson


Education, 2008. (UNIT 1,2,3)
Mishra K L P and Chandrasekaran N, “Theory of Computer Science -
Automata, Languages and Computation”, Third Edition, Prentice Hall of
India, 2004.
Hopcroft J.E., Motwani R. and Ullman J.D, “Introduction to Automata

Unit 3 Theory, Languages and Computations”, Second Edition, Pearson


Education, 2008. (UNIT 1,2,3)
Mishra K L P and Chandrasekaran N, “Theory of Computer Science -
Automata, Languages and Computation”, Third Edition, Prentice Hall of
India, 2004.
John C Martin, “Introduction to Languages and the Theory of

Unit 4 Computation”, Third Edition, Tata McGraw Hill Publishing Company,


New Delhi, 2007. (UNIT 4,5)

John C Martin, “Introduction to Languages and the Theory of

Unit 5 Computation”, Third Edition, Tata McGraw Hill Publishing Company,


New Delhi, 2007. (UNIT 4,5)
UNIT I FINITE AUTOMATA

9
Introduction- Basic Mathematical Notation and techniques- Finite State systems – Basic
Definitions –Finite Automaton – DFA & NDFA – Finite Automaton with €- moves – Regular
Languages- Regular Expression – Equivalence of NFA and DFA – Equivalence of NDFA’s with
and without €-moves –Equivalence of finite Automaton and regular expressions –Minimization
of DFA- - Pumping Lemma for Regular sets – Problems based on Pumping Lemma.

S. Question Course Outcome Blooms


No. Taxanomy
Level
e
(a) Finite Automata (FA)
C504.1 BTL 1
(b) Transition Diagram
NOV/DEC 2012
1 Automata is a 5 tuples denoted by

Q, ∑, δ, q​0​, F) where

● Q is a finite set of states


● ∑ is the finite set of input symbols
● δ is a transition function (Q X ∑ ​→​ Q )
● q0 is the start state or initial state
● F is a set of final or accepting states

2 the Principle of induction.


NOV/DEC 2012
C504.1 BTL 1
Refer notes

is proof by contradiction? MAY/JUNE


3
2012 ​Refer notes
C504.1 BTL 1
e ε-closure(q) with an example.
4 MAY/JUNE 2012
C504.1 BTL 1
Refer notes

entiate between proof by contradiction and proof


by contrapositive. ​APR/MAY 2011
C504.1 BTL 1
hen C will be proved by assuming ~H and then proving
5 falsehood of falsehood of C. This is proof by
contadiction. Proof by contrapositive is proved by
assuming ~H and proving ~C.

ruct a DFA for the language over {0, 1}* such that
it contains “000” as a substring.​ ​APR/MAY 2011
C504.1 BTL 1
1
0,1
6
0 0
0

is structural induction?
NOV/DEC 2011
C504.1 BTL 1
(X) be a statement about the structures X that are
defined by some particular recursive definition.
7
1. As a basis, Prove S(X) for the basis structure(s)
X.
2. For inductive step, take a structure X that the
recursive definition says is formed from Y​1​,
Y​2​,....Y​k​. Assume the statements S(Y​1​),...,S(Y​k​)
and use these to prove S(X).

he difference between NFA and DFA.


NOV/DEC 2011
C504.1 BTL 1
must emit one and only one vertex/line/edge for each
element of the alphabet. NFA do not have to obey
8 this and can have multiple edges labeled with the
same letter (repetition) and /or edges labeled with the
empty string.

DFA and NFA recognize the same languages – the


regular languages.

1. Construct deterministic finite automata to


recognize odd number of 1’s and even
C504.1 BTL 1
number of 0’s?
PR/MAY 2010
1
9
1

0 0 0 0

the relations among regular expression, deterministic


finite automata, non deterministic finite automaton
C504.1 BTL 1
and finite automaton with epsilon transition.
10
APR/MAY 2010

Every Regular language defined by a regular


expression ia also defined by the finite automata. If a
Regular language ‘L’ is accepted by a NFA then
there exists a DFA that accepts ‘L’.
is inductive proof?
NOV/DEC 2010
C504.1 BTL 1
11 ment P(n) follows from

(a) P(0) and


(b) P(n-1) implies P(n) for n>=1
tion (a) is an inductive proof is the basis and Condition
(b) is called the inductive step.

he set of strings accepted by the finite automata​.


NOV/DEC 2010
C504.1 BTL 1
0, 1

12

(0+1)* or L={ε, 0, 1, 00, 01, 10, 11,............}

is meant by DFA
MAY/JUNE 2013
C504.1 BTL 1
—also known as ​deterministic finite state machine​—is a
13
finite state machine that accepts/rejects finite strings of
symbols and only produces a unique computation (or run)
of the automaton for each input string.

e the term Epsilon transition


MAY/JUNE 2013
C504.1 BTL 1
14 In the ​automata theory​, a ​nondeterministic finite
automaton with ​ε​-moves (NFA-ε)​(also known as ​NFA-​λ​)
is an extension of ​nondeterministic finite
automaton​(NFA), which allows a transformation to a new
state without consuming any input symbols
the transition diagram for an identifier
NOV/DEC 2013
C504.1 BTL 1
15 letter letter,digit

is non deterministic finite automata?


NOV/DEC 2013
C504.1 BTL 1
mata theory​, a ​nondeterministic finite automaton (NFA),
16 or nondeterministic finite state machine, is a ​finite state
machine that ​(1) does not require input symbols for state
transitions and ​(2) is capable of transitioning to zero or
two or more states for a given start state and input symbol

17 Deductive Proof.
NOV/DEC 2014
ductive proof consists of a sequence of statements C504.1 BTL 1
whose truth leads us from some initial statement,
called the ‘hypothesis’ to a ‘conclusion’ statement.
“if H then C”

Ex:​ ​if x >= 4 then 2​x​ >= x​2

1. Design DFA to accept strings over ∑ = (0,1) with


two consecutive 0’s.​NOV/DEC 2014
C504.1 BTL 1
1
0,1

18
0 0

is a finite automaton?
NOV/DEC 2015
C504.1 BTL 1
te automaton (FA) is a simple idealized machine used
to recognize patterns within input taken from some
character set (or alphabet) C. The job of an FA is to
accept or reject an input depending on whether the
pattern defined by the FA occurs in the input.

19 Automata is a 5 tuples denoted by

Q, ∑, δ, q​0​, F) where

● Q is a finite set of states


● ∑ is the finite set of input symbols
● δ is a transition function (Q X ∑ ​→​ Q )
● q0 is the start state or initial state
● F is a set of final or accepting states

Regular Expression for the set of strings over {0.1}


20 that have atleast one.​ NOV/DEC 2015
C504.1 BTL 1
Regualr Expression = (0+1)*1
a Non-deterministic finite automata to accept strings
containing the substring 0101. ​MAY/JUNE 2016
21 C504.1 BTL 1
Refer Notes

the pumping lemma for regular languages.


22
MAY/JUNE 2016​Refer Notes
C504.1 BTL 1
e the languages described by DFA and NFA.
A) = { w / δ​‟​(q0,w) is in F}.It is the set of strings w
C504.1 BTL 1
that take the start state q0 to one of the accepting
23 states.

A)= { w / δ​‟​(q0,w)∩F≠}.It is the set of strings w


such that δ​‟​(q0,w)contains at least one accepting
state.

e extended transition function for a DFA.


e extended transition function δ​‟​: Qε∑ * εQ is defined
C504.1 BTL 1
as follows.
24
δ’(q, ε ) = q (ε - Empty)

)Suppose w is a string of form xa(w= xa), wε∑*and


qQ , then δ’(q, w)= δ( δ’(q, x),a)

a regular expression for the set of all strings having odd


25 number of 1’s
C504.1 BTL 1
RE= 1(0+11)*

he regular expression for the set of all strings ending in


26 00.
C504.1 BTL 1
Regular expression = (0+1)*00

two states are equivalent and distinguishable?


ay that two states p and q are equivalent iff for each
C504.1 BTL 1
input string x , δ(p,x) is an accepting state iff δ(q,x) is
27
an accepting state. p is distinguishable from q if there
exists an x such that δ(p,x) is in F and v is not in F or
vice versa.

are the applications of regular expression?


28
C504.1 BTL 1
ar expression in UNIX, Lexical analysis, Pattern
searching

regular expressions for the following.

ary numbers that are multiple of 2. (0/1)*. C504.1 BTL 1

29 rings of a​‟​s and b​‟​s with no consecutive a​‟​s .b*


(abb*)(a / ε) (iii) Strings of a​‟​s and b​‟​s containing
consecutive a​‟​s. (a/b)*aa(a/b)*

State Arden’s theorem.


30 Let P and Q be two regular expressions over ∑. If P C504.1 BTL 1
does not contain null string ε over ∑ then R=Q+RP,
it has the solution R=QP*

PART B
1 in the different forms of proof with examples.
(8) ​NOV/DEC 2012
C504.1 BTL 1
2 that, if L is accepted by an NFA with ε-transitions,
then L is accepted by an NFA without
C504.1 BTL 1
ε-transitions. (8) ​NOV/DEC 2012, NOV/DEC
2013

3 that if n is a positive integer such that n mod 4 is 2


or 3 then n is not a perfect square.
C504.1 BTL 1
(6) ​NOV/DEC 2012

4 ruct a DFA that accepts the following


(i) L={ x € {a,b}:|x|​a​ = odd and |x|​b​ = even}.
C504.1 BTL 1
(10) ​NOV/DEC 2012
(ii) Binary strings such that the third symbol
from the right end is 1. (10) ​MAY/JUNE
2012
(iii) All strings w over {0,1} such that the
number of 1’s in w is 3 mod 4.
(8) ​NOV/DEC 2011
(iv) Set of all strings with three consecutive
0’s.(10) ​NOV/DEC 2010
5

by induction on n that C504.1 BTL 1


(6) ​MAY/JUNE 2012

6 ruct an NFA without ε-transitions for the NFA give


below. (8) ​MAY/JUNE 2012
C504.1 BTL 1
0 1

ruct an NFA accepting binary strings with two


7 consecutive 0’s. (8) ​MAY/JUNE 2012

8` that a connected graph G with n vertices and n-1


edges (n>2) has at least one leaf.
(6) ​APR/MAY 2011
● G has n vertices & (n-1) edges.
● Therefore ∑ deg(V) = 2(n-1) which is impossible
● Therefore deg(V) = 1 for at least one vertex and
this vertex is a leaf.

9 that there exists a DFA for every ε-NFA.


(8) ​APR/MAY 2011 ​Refer Notes

10 guish NFA and DFA with examples.


MAY/JUNE 2013
UNIT II GRAMMARS

9
Grammar Introduction– Types of Grammar - Context Free Grammars and Languages–
Derivations and Languages – Ambiguity- Relationship between derivation and derivation trees –
Simplification of CFG – Elimination of Useless symbols - Unit productions - Null productions –
Greiback Normal form – Chomsky normal form – Problems related to CNF and GNF.

S. Question Course Outcome Blooms


No. Taxanomy
Level
regular expressions for the following
t of all strings of 0 and 1 ending in 00
C504.2 BTL 1
t of all strings of 0 and 1 beginning with 0 and
1 ending with 1. ​NOV/DEC 2012

RE1=(0+1)​+ ​00

RE2=0(0+1)​+​1
2 entiate regular expression and regular language.
NOV/DEC 2012
C504.2 BTL 1
Refer notes

ruct NFA for the regular expression a*b*.


3
MAY/JUNE 2012 Refer notes
C504.2 BTL 1
ular set is closed under complementation?Justify.
MAY/JUNE 2012
C504.2 BTL 1
re under complement

● If L is a regular language, over alphabet ∑


Complement of L=∑* - L

4
● Let L = L(A) for DFA A = (Q, ∑, δ, q0, F)
● Complement of L = L(B) where DFA B = (Q, ∑,
δ, q0, Q-F)
● B is similar to A except accepting states of A
have become non-accepting states of B and
vice-versa.
A string w is in L(B) iff δ’ (q0,w) is in Q-F which
occurs iff w is not in L(A).

that the complement of a regular language is also


regular.​APR/MAY 2011
5 C504.2 BTL 1
lement of ​L​1 is
​ constructed from L​1 by reversing the
states and the arrows in automata.

by pumping lemma, that the language 0​n​1​n is not


6
regular.​APR/MAY 2011
C504.2 BTL 1
ruct a DFA for the following:
(a) All strings that contain exactly 4 zeros.
C504.2 BTL 1
(b) All strings that don’t contain the
substring 110. NOV/DEC 2011
1 1 1 1
7
1

0 0 0 0

0
0,1

1
0,1

1 1 0

set of strings over the alphabet {0} of the form 0n


where n is not a prime is regular? Prove or
C504.2 BTL 1
disprove.
NOV/DEC 2011
rove this language is not regular, examine the
complement because the set of regular languages is
closed under complement.

8 me that the set is regular. Let p be the pumping length


of the language. Then, according to the pumping
lemma, break the string s=0​p into s=xyz where y has
positive length.

s=xy​i​z=0​p+(i-1)|y| must also be in the set for any i. In


particular let i=p+1.Then xy​p+1​z=0​p+p|y| must be in the
set so p+p|y| = p(1+|y|) must be prime.

we have a contradiction and the set cannot be regular.

= {w:w ε {0,1}* w does not contain 00 and is not


9 empty}. Construct a regular expression that
C504.2 BTL 1
generates L.
APR/MAY 2010
ar Expression = (0+1)(1+10)*(101+1)*

or disprove that the regular languages are closed


10 under concatenation and complement.
C504.2 BTL 1
APR/MAY 2010
re under concatenation
● Since L and M are regular languages,they have
regular expressions
L=L(R) and M=L(S)

● Then L.M = L(R.S), by definition of regular


expression
osure under complement

● If L is a regular language, over alphabet ∑


Complement of L=∑* - L

● Let L = L(A) for DFA A = (Q, ∑, δ, q0, F)


● Complement of L = L(B) where DFA B = (Q, ∑,
δ, q0, Q-F)
● B is similar to A except accepting states of A
have become non-accepting states of B and
vice-versa.
● A string w is in L(B) iff δ’ (q0,w) is in Q-F which
occurs iff w is not in L(A).

the regular expression for set of all strings ending in


11 00.​NOV/DEC 2010
C504.2 BTL 1
(0+1)*00

pumping lemma for regular set. ​NOV/DEC 2010,


NOV/DEC 2013,NOV/DEC 2014
C504.2 BTL 1
be a regular set. Then there is a constant n such that if
12
Z is a string in L and |Z| >=n, Z can be written as
Z=UVW such that |V|>=1 and |UV|<=n and for all
i>=0 UV​i​W is in L.

is a regular expression ?
MAY/JUNE 2013
C504.2 BTL 1
ular expression (abbreviated ​regex or ​regexp​) is a
13 sequence of ​characters that forms a search pattern,
mainly for use in ​pattern matching with ​strings​, or
string matching​, i.e. "find and replace"-like
operations

any four closure properties of regular languages


14 MAY/JUNE 2013
C504.2 BTL 1
ion, intersection, complement, difference
ruct NFA equivalent to the regular expression
15 (0+1)01 ​NOV/DEC 2013
C504.2 BTL 1
Refer notes

or disprove that (r+s)* = r* + s*


16
NOV/DEC 2014 Refer notes
C504.2 BTL 1
be the grammar with
S​→​aB|bA
C504.2 BTL 1
17
A​→​a|aS|bAA

B​→​b|bS|aBB

do you mean by null production and unit production?


18 Give an example. ​MAY / JUNE 2016
C504.2 BTL 1
Refer notes

ruct a CFG for set of strings that contain equal number


of a’s and b’s over ∑ = {a,b}.​ MAY / JUNE 2016
C504.2 BTL 1
S->A|B
19
A​→​aA|€

B​→​bB|€

What is unambiguity?
20
Refer notes
C504.2 BTL 1
Mention the application of CFG.
21
Refer notes
C504.2 BTL 1
ruct the Context free grammar representing the set
22 of palindromes over (0+1)* ​NOV/DEC 2015
C504.2 BTL 1
S->0S0|1S1| ε

is meant by Context Free Grammar (CFG)?


23
NOV/DEC 2016
C504.2 BTL 1
Chomsky normal form theorem. ​NOV/DEC 2016
24
C504.2 BTL 1
25
Define Regular Expression.
Refer Notes
C504.2 BTL 1
26 What is null and unit production?
Refer Notes C504.2 BTL 1

PART B
1 Prove that there exists an NFA with ε-transitions
that accepts the regular expression γ.
C504.2 BTL 1
(10) ​MAY/JUNE 2012, NOV/DEC
2010

2 Which of the following languages is regular?


Justify.(Using Pumping Lemma)
C504.2 BTL 1
n​ m​
(i) L={a​ b​ | n,m>=1}

(ii) L={a​n​b​n​ | n>=1}


(8) ​MAY/JUNE 2012

(iii) L={a​m​b​n​ | m>n}


(10) ​NOV/DEC 2012

(iv) L={a​n​b​n​ | n>=1}


(6) ​NOV/DEC 2010

(v) L={0​n2​| n is an integer, n>=1}


(6)​ NOV/DEC 2014

3 Obtain the regular expression for the finite


automata. (8) ​MAY/JUNE 2012
C504.2 BTL 1
a a

4 Prove any two closure properties of regular


languages.(8)​NOV/DEC 2012, NOV/DEC 2011,
C504.2 BTL 1
APRIL/MAY 2010

5 ruct a minimized DFA from the regular expression


(i) (b/a)*baa
C504.2 BTL 1
(10) ​MAY/JUNE 2012
(ii) 0*(01)(0/111)*
(16) ​NOV/DEC 2012
(iii) (x+y)x(x+y)*. Trace for a string w=xxyx.
(16) ​NOV/DEC 2011
(iv) (a+b)(a+b)* and trace for a string baaaab.
(16) ​APR/MAY 2010
(v) (b/a)*baa
(16) ​NOV/DEC 2010
(vi) 10+(0+11)0*1
(16) ​NOV/DEC 2014

6 Construct a regular expression for the following


DFA using kleene’s theorem. (10) ​APR/MAY 2011
C504.2 BTL 1
0 1

→​*A A B

B C B

A B

7 Construct a ε-NFA for the following regular


expression. (6) ​APR/MAY 2011
C504.2 BTL 1
(i) (0+1)*(00+11)(0+1)*

8 (i) What is the purpose of normalization?


Construct the CNF and GNF for the following
C504.2 BTL 1
grammar and explain the steps. (10)
MAY/JUNE 2016

S​→​aAa | bBb |€

A​→​C|a

B​→​C|b

C​→​CDE | €

D​→​A|B|ab

(ii) Constuct a CFG for the regular expression


(011+1)(01). (6) ​MAY/JUNE 2016
UNIT III PUSHDOWN AUTOMATA

9
Pushdown Automata- Definitions – Moves – Instantaneous descriptions – Deterministic
pushdown automata – Equivalence of Pushdown automata and CFL - pumping lemma for CFL –
problems based on pumping Lemma.

S. Question Course Outcome Blooms


No. Taxanomy
Level
is ambiguous grammar? NOV/DEC
1 2012, MAY/JUNE 2013
C504.3 BTL 1
Refer notes

are the diiferent types of language accepted by a


PDA and define them?​ NOV/DEC 2012
2 C504.3 BTL 1
● Accepted by null state
● Accepted by final state

fy the use of context free grammar.


3 MAY/JUNE 2012
C504.3 BTL 1
Refer notes
e parse tree with an example.
4 MAY/JUNE 2012
C504.3 BTL 1
Refer notes

ruct a CFG over {a,b} generating a language


consisting of equal number of a’s and b’s.
5 C504.3 BTL 1
APR/MAY 2011
S​→​ aSbS | bSaS | SS

e language of Deterministic PDA and Non –


deterministic PDA same? ​APR/MAY 2011
6 C504.3 BTL 1
anguage is not same. This language of NPDA is a
superset of the language of DPDA.

grammar below ambiguous S​→ SS | (S) | S(S)S |


E?​NOV/DEC 2011
C504.3 BTL 1
7 ● It is ambiguous
● The sentence such as E(E)E can have more than
one LMD (or) RMD (or) Parse tree.

ert the following grammar into an equivalent one


with no unit productions and no useless symbols
C504.3 BTL 1
8 S​→​ABA A​→​aAA|aBC|bB B​→ A|bB|Cb
C​→​CC|Cc ​NOV 2011
Refer notes

der the following grammar G with productions


APR/MAY 2010
C504.3 BTL 1
S​→​ ABC | BaB

A​→​aA|BaC|aaa

B​→​bBb|a

9 C​→​CA|AC

a CFG with no useless variables that generates the


same language.

ol C is non-generative, after removing productions


with C we have,

S​→​ BaB
A​→​ aA|aaa

B​→​bBb|a

CFG with no usless variables

BaB A​→​ aA|aaa B​→​bBb|a}

the definition of Pushdown automata.


APR/MAY 2010
C504.3 BTL 1
hdown automaton consists of 7 tuples

P = (Q, ∑, ​Г, δ, q0, Z0, F)


e Q – A finite non empty set of states

∑ - A finite set of input symbols

Г – A finite non empty set of stack symbols

δ - The transition function is given by

δ:Q X (∑ U {ε}) X Г ​→​ Q X Г*


10
q0 – q0 in Q is the start state

Z0 - Initial start symbol of the stack

F - F in Q, set of accepting states or final


states.

down the context free grammar for the language L


11 = { a​n​b​n​ |n>=1} ​NOV/DEC 2010, NOV/DEC 2013
C504.3 BTL 1
S​→​ aSb |ab

grammar E​→​E+E|id is ambigupus ? Justify.


NOV/DEC 2010
C504.3 BTL 1
12 ● It is ambiguous, The sentence such as
id+id+id can have more than one
LMD (or) RMD (or) Parse tree.

is a CFG ? MAY/JUNE 2013


ntext-free grammar (​CFG​) is a ​formal grammar in
13 which every ​production rule is of the form ​V → ​w
C504.3 BTL 1

where ​V is a ​single ​nonterminal symbol, and ​w is a


string of ​terminals and/or nonterminals (​w can be
empty). A formal grammar is considered "context
free" when its production rules can be applied
regardless of the context of a nonterminal. No matter
which symbols surround it, the single nonterminal on
the left hand side can always be replaced by the right
hand side.

are the different ways of language acceptances by a


PDA and define them?​ NOV/DEC 2015
14 C504.3 BTL 1
● Language accepted by a Empty store
● Language accepted by a Final state.

Define pushdown Automaton MAY/JUNE


2016
C504.3 BTL 1
A pushdown Automaton is a ​ε​•-​ NFA with
stack data structure where it can push strings
into and pop strings out of stack.
It consists of 7-tuples P = ( Q,​Σ​,​Γ​,​δ​,q​0, ​z​0
15
, ​F),Where Q is a finite set of states,​Σ​•i​ s a finite
set of input symbols,​Γ​is a finite set of
nonempty stack alphabets, ​δ​•i​ s a transition
function,q​0 ​is an initial state​, ​Z 0​ ​is the initial
start symbol of the stack ,​ ​F is the set of
accepting states.​δ​•i​ s defined
as ​δ​:Q​×​(​Σ∪{ε}​)​×Γ​•→ ​ ​▪​Q​×Γ​*
What are the different ways of language
acceptances by a PDA and ​define t​hem C504.3 BTL 1
16 There are two ways of language acceptances,
1)Acceptance by final state .L(M)= ​{​w |
(q​0,​w,Z​0​) ​Γ​•​*​(q, ​ε​,​γ​) for some q in F
and ​γ​•i​ n ​Γ​•*​ ​}
are NFA and PDA​NOV/DEC 2013
17
Refer notes
C504.3 BTL 1
he general forms of CNF. ​NOV/DEC 2014
18 A​→​BC
C504.3 BTL 1
A​→​a

that CFLs are closed under substitutions


19
NOV/DEC 2014 Refer notes
C504.3 BTL 1
ert the following CFG to a PDA.​NOV/DEC 2015
20
S​→​aAA, A​→​aS|bS|a
C504.3 BTL 1
Does a Push down Automata have memory? Justify.
21
MAY/JUNE 2016 Refer Notes
C504.3 BTL 1

22
When is Push Down Automata (PDA) said to C504.3 BTL 1
be deterministic? ​NOV/DEC 2016

23 What are the conventional notations of Push C504.3 BTL 1


Down Automata? ​NOV/DEC 2016

he main application of pumping Lemma in


24
CFL’s C504.3 BTL 1

Compare Deterministic and Non deterministic PD


25
it true that non deterministic PDA is more power C504.3 BTL 1
that of deterministic PDA? Justify your answer.
26 Design the equivalence of PDA and CFG
C504.3 BTL 1
PART – B
Consider the following grammar for list
structures:
C504.3 BTL 1
S​→​a|^|(T) T​→​T,S|S
1 Find left most derivation, rightmost derivation
and parse tree for (((a,a),^(a)),a)(10) ​NOV/DEC
2012

Construct the PDA accepting the language

1. L={(ab)​n​|n>=1} by empty stack.(6) C504.3 BTL 1


NOV/DEC 2012

2. L={a​2n​b​n​|n>=1} Trace your PDA for the input


2 with n=3. (10) ​NOV/DEC 2012

3. L={ww​R​|w is in (a+b)*} (10)​MAY/JUNE 2012


4. L={0​n​1​2n​} by empty stack(8)​APR/MAY 2011

5. L={ww​R​w|w is in {0+1}*}(10)​NOV/DEC 2010

Find the PDA equivalent to the given CFG with


the following productions
C504.3 BTL 1
1. S​→​A, A​→​BC, B​→​ba, C​→​ac (6) ​NOV/DEC
2012
3
2. S​→​aSb|A, A​→​bSa|S|​ ε (10) ​NOV/DEC 2011

Is the following grammar is ambiguous? Justify


your answer.
C504.3 BTL 1
4 1. E​→​ E+E |E*E | id (6) ​MAY/JUNE 2012

2. E​→​ E+E|E*E|(E)|a (4) ​APRIL/MAY 2011

Find the context free languages for the following


5 grammars.
C504.3 BTL 1
1. S​→​aSbS|bSaS|​ ε (10)
MAY/JUNE 2012

2. S​→​aSb|ab

3. S​→​aSb|aAb, A​→​bAa, A​→​ba (6)


NOV/DEC 2011

6 that if there exists a PDA that accepts by final state


then there exists an equivalent PDA that accepts
C504.3 BTL 1
by Null state. (8) ​APRIL/MAY 2011

7 Is NPDA (Nondeterministic PDA) and DPDA


(Deterministic PDA) equivalent? Illustrate with
C504.3 BTL 1
an example. (8) ​NOV/DEC 2011

8 What are the different types of language


acceptances by a PDA and define them. Is it true
C504.3 BTL 1
that the language accepted by a PDA by these
different types provides different languages?
(8) ​NOV/DEC 2011

9 Construct PDA for the language

C504.3 BTL 1
L = {ww​R​ | W in (a+b)*)} MAY/JUNE
2013,NOV/DEC 2013, MAY/JUNE 2016

UNIT IV TURING MACHINES

9
Definitions of Turing machines – Models – Computable languages and functions –Techniques
for Turing machine construction – Multi head and Multi tape Turing Machines - The Halting
problem –Partial Solvability – Problems about Turing machine- Chomskian hierarchy of
languages.

S. Question Course Outcome Blooms


No. Taxanomy
Level
the pumping lemma for CFLs.
1
NOV/DEC 2012 Refer notes
C504.4 BTL 1
are the applications of Turing Machine?
2 NOV/DEC 2012 Refer notes
C504.4 BTL 1

pumping lemma for CFL.


3
MAY/JUNE 2012 Refer notes
C504.4 BTL 1
is chomsky normal form?
4
MAY/JUNE 2012 Refer notes
C504.4 BTL 1
is the height of the parse tree to represent a string
5 of length ‘n’ using Chomsky normal form?
APR/MAY 2011 C504.4 BTL 1
n+1
ruct a Turing machine to compute ‘n mod 2’ where
n is represented in the tape in unary form
consisting of only 0’s. APR/MAY C504.4 BTL 1
2011
0 B
6 q0 (q1,B,R) (q2,B,R)
q1 (q0,B,R) (q3,B,R)
q2 - - representing
even no
q3 - -
representing odd no

n a TM that accepts the language of odd integers


written in binary. NOV/DEC 2011
C504.4 BTL 1
cept odd valued binary strings, we only have to look at
7
the last bit. The TM moves right until it reads a
blank, moves left one space and acepts if and only if
there is a 1 on the tape.

the two normal forms and give an example.


NOV/DEC 2011
8 C504.4 BTL 1
1. Chomsky normal form A​→​BC |a
2. Greibach normal form X​→​bYXZ|a

ert the following grammar G in greibach normal


form.​APR/MAY 2010
C504.4 BTL 1
S​→​ABb|a A​→​aaA|B B​→​bAb

● No ​ε production in the given grammar


9
● Eliminating unit production A​→​B we have
S​→​ABb|a A​→​aaA|bAb B​→​bAb

● Eliminating useless variables A & B (non generating)

S​→​a

n a Turing machine with no more than three states


that accepts the language a(a+b)*. Assume ∑ =
C504.4 BTL 1
{a,b} APR/MAY 2010
=(​Q, ∑, Г, δ, q0, B,{q2})

Q – {q0,q1,q2}

∑ - {a,b}
10 Г – (a,b,B}

q0 – Initial state

q2 - Final state

δ - Transition function given as follows

δ(q0,a) = (q1,a,R)

δ(q1,a) = (q1,a,R)

δ(q1,b) = (q1,b,R)

δ(q1,B) = (q2,B,R)

is Turing machine? NOV/DEC 2010


denoted by
C504.4 BTL 1
M​=(​Q, ∑, Г, δ, q0, B,F)

Q – A finite non empty set of states

∑ - A finite set of input symbols


11
Г – A finite non empty set of tape symbols

δ - The transition function is given by

δ:Q X Г ​→​ Q X Г X {L,R,S}

q0 – Initial state

B ε Г – Blank Symbols

F - Final state

are the required fields of an instantaneous description


12
of a Turing machine? ​NOV/DEC 2016
C504.4 BTL 1
he primary objectives of Turing Machine. NOV/DEC
13
2016
C504.4 BTL 1
he language L={a​n​b​n​c​n | n>=1} is context
free?Justify.​NOV/DEC 2010
14 C504.4 BTL 1

is meant by Greibach Normal Form ?


MAY/JUNE 2013
C504.4 BTL 1
ext-free grammar is in ​Greibach normal form (GNF) if the
right-hand sides of all ​production rules start with a
15
terminal symbol​, optionally followed by some variables. A
non-strict form allows one exception to this format
restriction for allowing the ​empty word (epsilon, ε) to
be a member of the described language

he closure properties of Context Free Languages


MAY/JUNE 2013, NOV/DEC 2013
16 C504.4 BTL 1
, intersection, kleene closure, substitution,
homomorphism

out the different techniques for turing machine


17 construction.​NOV/DEC 2013
C504.4 BTL 1
Refer notes

G be the grammar S​→​aB|bA A​→​a|aS|bAA


B​→​b|bS|aBB. For the string aaabbabbba, Find (a)
18 C504.4 BTL 1
LMD (b) RMD NOV/DEC 2014
Refer Notes

e Diagonalization (Ld) Language.


19 NOV/DEC 2014
C504.4 BTL 1
Ld={wi | wi ∑ L(Mi)}

e a Turing Machine. OV/DEC 2015


20
Refer notes C504.4 BTL 1

is a multitape turing machine?


21
NOV/DEC 2015​Refer notes
C504.4 BTL 1
are the differences between a Finite automata and a
22
Turing machine? ​MAY/JUNE 2016
C504.4 BTL 1
is Turing Machine?​ MAY/JUNE 2016
23
C504.4 BTL 1
is multitape Turing machine? Explain in one move.
24
What are the actions take place in TM?
C504.4 BTL 1
are the applications of Turing Machine?
25
C504.4 BTL 1
are the techniques for TM construction?
26
C504.4 BTL 1
PART – B
Convert the following grammar into CNF

S​→​cBA, S​→​A, A​→​cB, A​→​AbbS, B​→​aaa C504.4 BTL 1


(6) ​NOV/DEC 2012
1 S​→​a|AAB, A​→​ab|aB| ε, B​→​aba| ε
(8) ​APR/MAY 2011

S​→​A|CB, A​→​C|D, B​→​1B|1, C​→​0C|0, D​→​2D|2


(16)​ APR/MAY 2010

S​→​aAD A​→​aB|bAB B​→​ b D​→​ d


(6) ​NOV/DEC 2014

State and prove the pumping lemma for CFL.


2 What is its main application? Give two examples.
C504.4 BTL 1
(10)

NOV/DEC 2012, NOV/DEC 2011, ​MAY/JUNE

Design a Turing machine for the following

Reverses the given string {abb}. (8) ​NOV/DEC C504.4 BTL 1


2012
3 L={1​n​0​n​1​n​|n>=1} (10) ​MAY/JUNE 2012

L={a​n​b​n​c​n​} (8) ​APR/MAY 2011


To perform proper subtraction (8) ​APR/MAY
2011

To move an input string over the alphabet A ={a}


to the right one cell. Assume that the tape head
starts somewhere on a blank cell to the left of the
input string. All other cells are blank, labeled by
^. The machine must move the entire string to the
right one cell, leaving all remaining cells blank.
(10) ​APR/MAY 2010
n​ n​
L={1​ 0​ |n>=1} (8) ​NOV/DEC 2010

L={ww​R​| w is in (0+1)*} (8) ​NOV/DEC 2010

mplement the function “MULTIPLICATION”


using the subroutine “COPY”.
(12) ​NOV/DEC 2014

L={0​n​1​n​|n>=1} (10) ​NOV/DEC 2015

Write briefly about the programming techniques


for TM. (8) ​NOV/DEC 2012,MAY/JUNE
C504.4 BTL 1
2013, NOV/DEC 2015
4
Find Greibach normal form for the following
5 grammar
C504.4 BTL 1
(i) S​→​AA | 1, A​→​SS |0
(10) ​MAY/JUNE 2012

(ii) S​→​a|AB, A​→​a|BC, B​→​b, C​→​b


(4) ​APR/MAY 2011

(iii) S​→​AA|0, A​→​SS|1


(8) ​NOV/DEC 2010

(iv) A​1​→​A​2​A​3​, A​2​→​A​3​A​1​|b, A​3​→​A​1​A​2​|a


(10) ​NOV/DEC 2014

6 Explain the different models of Turing machines.


(10)​ NOV/DEC 2011
C504.4 BTL 1
7 Discuss the various techniques for Turing
Machine Construction (16) ​NOV/DEC 2016
C504.4 BTL 1
8 (i) Write about Multi tape Turing Machines. (10)
NOV/DEC 2016
C504.4 BTL 1
(ii) Explain highlight the implications of halting
problems (6) ​NOV/DEC 2016
9 Describe the Chomsky hierarchy of languages.
NOV/DEC 2015
C504.4 BTL 1
UNIT V UNSOLVABLE PROBLEMS AND COMPUTABLE FUNCTIONS

Unsolvable Problems and Computable Functions – Primitive recursive functions –


Recursive and recursively enumerable languages – Universal Turing machine. MEASURING
AND CLASSIFYING COMPLEXITY: Tractable and Intractable problems- Tractable and
possibly intractable problems - P and NP completeness - Polynomial time reductions.

PART - A
S. Question Course Outcome Blooms
No. Taxanomy
Level
we say a problem is decidable? Give an example of
1 undecidable problem. NOV/DEC 2012
C504.5 BTL 1
Refer notes

is recursively enumerable language? ​NOV/DEC


2012, MAY/JUNE 2012, NOV/DEC 2010,
2 C504.5 BTL 1
MAY/JUNE 2013, NOV/DEC 2013
s the language accepted by a Turing Machine.

on the difference between P and NP problems.


3 MAY/JUNE 2012 Refer
C504.5 BTL 1
notes
to prove that the Post Correspondence problem is
Undecidable. ​NOV/DEC 2011
uce a modified PCP and reduce the same to the C504.5 BTL 1
4
original PCP.
reduce L​u​ to the modified PCP.
hain of reduction infers if original L​u is known to be
undecidable then conclude that PCP is undecidable.
that any PSPACE-hard language is also NP-hard.
NOV/DEC 2011
we must show that the language is not in NP. This is C504.5 BTL 1
5 trivial since NP is a subset of PSPACE and therefore,
anything outside of PSPACE is also outside of NP.
we must show that any problem in NP can be reduced
to any PSPACE-hard language. Thus, any
PSPACE-hard problem is also NP-hard.
Rice’s theorem. APR/MAY 2010
non-trivial property of the RE language is
6 undecidable. C504.5 BTL 1
perty is trivial if it is either empty such that it is
satisfied by no language or is all RE languages, or
else it is non-trivial.
that the collection of all Turing machines is
countable.​APR/MAY 2010
● If for a set there is an enumerator, then the set is C504.5 BTL 1
countable.
● Any Turing Machine can be encoded with a
binary string of 0’s and 1’s.
● An enumeration procedure for the set of Turing
7
Machine strings:
Repeat
● Generate the next binary string of 0’s and
1’s in proper order
● Check if the string describes a Turing
Machine
If Yes: Print string on output tape
If No: Ignore string
on the difference between decidable and
undecidable problems. ​NOV/DEC 2010
8 C504.5 BTL 1
● Decidable Problem – Existence of an
algorithm
● Undecidable Problem – No algorithm
for solving it.
is universal turing machine​NOV/DEC 2013
9 rsal Turing machine (​UTM​) is a ​Turing machine that
can simulate an arbitrary Turing machine on arbitrary C504.5 BTL 1
input. The universal machine essentially achieves this
by reading both the description of the machine to be
simulated as well as the input thereof from its own
tape
e multiple turing machine.
NOV/DEC 2014
10 tended TM model has more number of tapes. A move C504.5 BTL 1
is based on the state and on the vector of symbols
scanned by the hand on each of the tapes.

example for NP-complete problems.


11
NOV/DEC 2014
Traveling Salesman Problem C504.5 BTL 1
when a problem is said to be decidable and give an
12
example of an undecidable problem.
NOV/DEC 2015 C504.5 BTL 1
is a universal Language L​u​?
13
NOV/DEC 2015 Refer notes
C504.5 BTL 1
is a Recursively Enumerable language said to be
14
Recursive? ​MAY/JUNE 2016
C504.5 BTL 1
fy whether “Tower of Hanoi” problem is tractable or
15
intractable. Justify your answer. ​MAY/JUNE 2016
C504.5 BTL 1
e Universal Turing Machine ​NOV/DEC 2016
16
C504.5 BTL 1
e NP-hard and NP-complete problems. ​NOV/DEC
17
2016
C504.5 BTL 1
a recursively enumerable language is said to be
18
recursive.
C504.5 BTL 1
are and Contrast recursive and recursively enumerable
19
languages.
C504.5 BTL 1
when a problem is said to be decidable and give an
20
example of an undecidable problem
C504.5 BTL 1
rue that the language accepted by a non deterministic
21 Turing Machine is different from recursively
enumerable language? C504.5 BTL 1

wo properties of recursively enumerable sets which are


22
undecidable.
C504.5 BTL 1
23 e the classes of P and NP
C504.5 BTL 1
a language is said to be recursively enumerable?
24
C504.5 BTL 1
e Time and Space Complexity of TM.
25
C504.5 BTL 1
guish between PCP and MPCP. What are the concepts
26
used in UTMs?
C504.5 BTL 1
PART – B
If L​1​ and L​2 ​are recursive language then L​1​UL​2​ is a
1 recursive language.(6)​NOV/DEC 2012
C504.5 BTL 1
Prove that the halting problem is undecidable.(10)
2 NOV/DEC 2012, NOV/DEC 2010
C504.5 BTL 1
State and prove the Post’s correspondence
3 problem. (10)​NOV/DEC 2012,
C504.5 BTL 1
NOV/DEC 2010

Write a note on NP problems.


4 (6) ​NOV/DEC 2012
C504.5 BTL 1
Explain undecidability with respect to post
5 correspondence problem. (8) ​MAY/JUNE2012
C504.5 BTL 1
6 and prove Post Correspondence Problem and Give
​ OV/DEC 2014
example. (16) N
C504.5 BTL 1
7 is Post Correspondence problem (PCP)? Explain
with the help of an example. (16) ​MAY/JUNE
2016 C504.5 BTL 1
8 What are tractable problems? Compare it with
intractable problems. (10) ​NOV/DEC 2016
) Outline the concept of polynomial time reductions. C504.5 BTL 1
(6) ​NOV/DEC 2016
9 Prove that for two recursive languages L​1 and L​2
their union and intersection is recursive.
C504.5 BTL 1
NOV/DEC 2013

10 State and explain RICE theorem​.

Prove that “MPCP reduces to PCP”. C504.5 BTL 1

You might also like