Sei sulla pagina 1di 11

HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.

DEPARTMENT OF COMPUTER SCIENCE AND ENGG


CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU

UNIT - I 4. Define - closure of a state.


The set of all states reachable from a given state q using
PART - A transitions only. We use -closure to denote the set of all
vertices p such that there is a path from q to p labeled .
1. Differentiate DFA with NFA.
A DFA is a deterministic Finite Automata where as
NFA is a nondeterministic finite automata. In DFA, for a given
state on a given input we reach to a deterministic and unique
state. On the other hand, in NFA we may lead to more than one
state for given input. The DFA is a subset of NFA.

2. Give the applications of Theory of computation & Finite


Automata.
Applications of Theory of computation - a. Compiler
Design, b. Robotics, c. Artificial Intelligence, d. Knowledge
Engineering.
Applications of Finite Automata - a. design of Lexical
analyzer, b. Compiler design, c. Pattern matching, d. File
Searching Program. 5. What is a regular expression? Give the regular
expression for the set of all strings ending in 00.
3. Define: (i) Finite Automaton(FA) (ii)Transition diagram. A regular expression is a string that describes the whole
Finite Automaton is denoted by a 5- tuple set of strings according to certain syntax rules. These
(Q,,,q0,F), where Q is the finite set of states , is a finite expressions are used by many text editors and utilities to search
input alphabet, q0 in Q is the initial state, F is the set of final bodies of text for certain patterns etc.
states and is the transition mapping function Q * to Q. Regular expression for the set of all strings ending in
Transition diagram is a directed graph in which the 00= (0+1)*00
vertices of the graph correspond to the states of FA. If there is a
transition from state q to state p on input a, then there is an arc
labeled a from q to p in the transition diagram.
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU
6. State the pumping lemma for regular languages and its
advantages.
If L is a regular language represented with a automaton
with the maximum of n states, then there is a word w such Transition Table for on/off switch
that |w|>=n. we can write w=xyz in such a way that States Input
|y|>=0 push
|xy|<=n off on
i
For all i>=0 xy z L *on off
The advantage of the pumping lemma is, that it can be
used to prove the language is not regular. 9. Define proof by induction principle.

7. When two states are equivalent and distinguishable? Induction Principle


We say that two states p and q are equivalent if for each If S(i) is true for n = i ,then it is to be proved that for all n > i , S(n)
input string x , (p,x) is an accepting state if (q,x) is an implies S(n+1) then S(n) is true for all n i..
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.

8. Construct a Finite Automata for on/off switch. 10. Construct a Finite Automata to accept the following
language. L=an where n mod 4 = 3.

Transition Diagram for on/off switch


HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU
UNIT - II aaba [Sa]
A derivation is said to be rightmost derivation if at each
PART - A step in a derivation the right most variable is replaced by its
productions.
1. Define context free grammar. Ex: SaAS | a
A context free grammar (CFG) is denoted as Aab
G= {V, T, P, S} SaAS
Where, aAa [Sa]
V- is finite set of non terminals or variables aaba [Aab]
T- is finite and disjoint from V, set of terminals
P- finite set of productions or substitution rules 4. What is Chomsky Normal form?
S- is start symbol where SV Chomsky Normal form:i)NT (NT)(NT) ii) NTT
All the productions in the form Ax where AV and Where, NT- Non terminal, T- terminal.
x (VUT)* Exampl e: 1.SAB 2.Aa 3. Bb

2. What is an ambiguous grammar? 5. What is Greiback Normal form?


Let G= (V, T, P, S) be a CFG. A grammar is ambiguous n
Greiback Normal form:i)NT T(NT) | n>=0
if and only if there exists at least one string wT* for which
Where, NT- Non terminal, T- terminal.
two or more different parse trees exist by applying either the Exampl e: 1.SaAB 2.AaB 3. Bb
left most derivation or right most derivation.

3. What are Left Most Derivation(LMD) and Right Most


6. What are the three ways to simplify given CFG?
Derivation(RMD)?
It is done through 3 steps,
A derivation is said to be leftmost derivation if at each
Eliminating null productions
step in a derivation the leftmost variable is replaced by its
Removing unit productions
production
Removing useless symbols and productions.
Ex: SaAS | a
Aab
SaAS
aabS [Aab]
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU
7. Eliminate the production from the CFG given below 10. List out the types of Grammar.
A0 B 1 | 1 B 1
B0 B | 1 B |

A0 B 1 | 1 B 1 | 01 |11
B0 B | 1 B | 0| 1

8. Write the CFG for


i)the language L={wwR | w (a+b)*}
SaSa | bSb | aa | bb | Production
ii)palindrome(using a's & b's) Grammar Languages Automaton rules
SaSa | bSb | a | b | (constraints)
(no
Recursively Turing
Type-0 restrictions)
9. Define derivation tree (or) parse tree. enumerable machine
A derivation tree is a graphical representation of a derivation Linear-
(LMD (or) RMD). bounded non-
Example: Context- A
Type-1 deterministic
If the given CFG is sensitive
Turing
S0S1S | 1S0S | and given string is 011100 then the machine
derivation tree is Non-
deterministic
Type-2 Context-free A
pushdown
automaton
Finite state A aB and A
Type-3 Regular
automaton a
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU
UNIT - III

PART - A
4.What are the different types of language acceptances
1. Mention the components of PDA by PDA and define them
A push down automaton is usually described as Two types:
consisting of four components 1. acceptance by final state
A control unit 2. acceptance by empty stack
A read unit
An input tape and 5.What is the informal definition of PDA?
A memory unit A PDA is a computational machine to recognize a
context free language. computational power of a PDA is
2. Write down the formal definition of PDA. between finite automaton and turing machines. The PDA has a
A push down automaton computational model is a 7 finite control and the memory is organized as a stack.
tuple (Q,, , ,q0,Z0,F) where,
Q- Finite set of states.q0Q is the initial state
-set of alphabet called input alphabet
-stack alphabet 6. Compare NFA and PDA.
- Mapping from Qx(U{})x to finite subsets of Qx NFA PDA
* The language accepted by NFA The language accepted by
q0- starting state is the regular language PDA is the context free
Z0- start symbol of a stack language
F- Set of final states where F is a subset of Q NFA has no memory PDA is essentially an NFA
with stack memory
3. Write down instantaneous description of PDA. It can store only limited It stores unbounded limit of
Let A= (Q, , , , q0, Z0, F) be a PDA. An instantaneous amount of information information
description is (q,x,) where qQ,x * and *. A language/string is accepted It accepts a language either
only by reaching the final state by empty stack or by
reaching a final state
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU

10. Construct a PDA for the context free grammar


7.Define Deterministic PDA S aSA | a
A PDA P= (Q,, , ,q0,Z0,F) is a deterministic if and only if the A bB
following two conditions are met: Bb
1. (q, a, X) has at most one member foe any q in Q, a in or a = (q0, , Z0) = (q1,SZ0)
, and X in . (q1, ,S)= {(q1, aSA), (q1, a)}
2. (q, a, X) is non empty, for some a in , then (q, , X) must (q1, ,A)={(q1, bB)}
be empty. (q1, ,B)={(q1,b)}
(q1, a,a)= {(q1, )}
8. Explain pumping lemma for CFL. (q1, b,b)= {(q1, )}
let L be any context free language then there is a
constant n which depends only upon L such that there exists a
string ZL and |Z| >=n where Z=uvwxy such that
1.|vx|>=1
2.|vwx|<=n and
3. For all i>=0 uviwxiy is in L

9. Define rules for the conversion of Grammars to PDA


Let G= (V, T, Q, S) be a CFG. Then PDA P that accepts L(G) by
empty statck as follows
P=({q}, T, V T, , q, S) where the transition function is
defined by
1. For each variable A, (q, , A)= {(q, ) | A is a production
of P}.
2. For each terminal a, (q, a, a)= {(q, )}.
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU

UNIT - IV
4. Define Halting Problem
PART - A The halting problem is the problem of determining, from a
description of an arbitrary computer program and an input,
1. What is a Turing machine?
whether the program will finish running or continue to run
Turing machine is a simple mathematical model of a
forever.
computer.TM has unlimited and unrestricted memory and is a
much more accurate model of a general purpose computer. The
5. Define Subroutines in Turing machine
TM is a FA with a R/W head .It has an infinite tape divided into
A Turing machine subroutine is a set of states that
cells, each cell holding one symbol
performs some useful process. This set of states includes a start
state and another state that temporarily has no moves, and that
2. List out different types of TMs.
serves at the return state to pass control to whatever other set of
Multi tape Turing machine, off-line Turing Machine ,
states called the subroutine
Multi track Turing machine & Universal TM .

6. What does Multitape turing machine contain?


3. Define Multitape Turing machine.
1. The input, a finite sequence of input symbols, is placed on the
A Multitape Turing machine has a finite control with some
first tape.
finite number of tapes. Each tape is divided into cells and each
2. All other cells of all the tapes hold the blank.
cell can hold any symbol of the finite tape alphabet. The set of
3. The final control is in initial state.
tape symbol includes a blank, and has a subset called the input
4. The head of the first tape is at the left end of input.
symbols, of which the blank is not a member.
5. All other tape heads are at some arbitrary cell.
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU

7. What are the required fields of an ID or configuration of a accepts L, and recursive if there is a TM that recognizes L,
TM. then it is called L- Turing acceptable(or) Turing Decidable
It requires languages. No, the language accepted by a non deterministic
i)the state of the TM. TM is same as the recursively enumerable language.
ii)the contents of the tape.
iii)the position of the tape head on the tape.
10.Define Rules of Context sensitive languages
8. Define Instantaneous description of turing machine The CSG may have more than one symbol on the left hand
ID of turing machine is represented as side of their production rules.
X1 X2......Xi-1 q Xi Xi+1.....Xn The number symbols on left side must not exceed the
i) where q is the state of turing machine. number of symbols on right side
ii) The tape head is scanning the ith symbol from left The rule of the form A is not allowed unless
iii) X1 X2....Xn is the portion of the tape between the A is a start symbol
leftmost and the rightmost non blank

9.When a recursively enumerable language is said to be


recursive? Is it true that the language accepted by a
non deterministic TM is different from recursively
enumerable language?
A language L is recursively enumerable if there is a TM that
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU
UNIT - V

PART - A
4. Define the classes P and NP.
1. What do you mean by Universal TM.
P consists of all those languages or problems accepted by
Universal TM is a type of TM which is capable of doing
some TM that runs in some polynomial amount of time, as a
anything that any other TM can do. That means universal TM is a
function of its input length.
TM that imitates any TM.
NP is the class of languages or problems that are accepted
by some nondeterministic TMs with a polynomial bound on time
2. When a problem is said to be decidable and give an
taken along any sequence of nondeterministic choices.
example of undecidable problem?
A problem whose language is recursive is said to be
5. Define NP complete problem.
decidable. Otherwise the problem is undecidable . i.e there is no
A language is NP-complete if the following statements are
algorithm that takes as input an instance of the problem and
true.(i)L is in NP (ii)For every language L in NP there is a
determines whether the answer to that instance is yes or no. Eg.
polynomial time reduction of L to L.
Halting problem

6. What are tractable problems?.


3. When a language is said to be recursively enumerable?
The problems which are solvable by polynomial time
A language is recursively enumerable if there exists a
algorithms are called tractable problems. For eg. The complexity
Turing machine that accepts every string belonging to that
of the Kruskals algorithm is o(e+m) where e , the no. of edges
language. And if the string does not belong to that language then
and m the Number of nodes.
it can cause the turing machine to enter ia an infinite loop
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU

7. Define intractable problems


if for some i1, i2, ik, where 1 ij n, the condition
A problem that cannot be solved by a polynomial-time
algorithm. The lower bound is exponential. Examples of xi1.xik = yi1....yik satisfies.
intractable problems (ones that have been proven to have no
polynomial-time algorithm) 9. State two languages, which are not recursively enumerable.
Towers of Hanoi: we can prove that any algorithm that Diagonalization language is not recursively enumerable
solves this problem must have a worst-case running time The partially decidable language or undecidable languages
that is at least 2n 1.
are not recursively enumerable.
List all permutations (all possible orderings) of n
numbers.
10. Define Primitive Recursive function
8. Define posts correspondence problem.
The set PR of primitive recursive function is defined as follows.
1. All initial functions are elements of PR
The Post Correspondence Problem (PCP), introduced by Emil Post in 1946, is an undecidable
2. For every k >= 0 and m>= 0, if f : N k --> N and
decision problem. The PCP problem over an alphabet is stated as follows
g1, g2, .... gk : Nm --> N are elements of PR, then the
Given the following two lists, M and N of non-empty strings over
function f(g1, g2,...gk) obtained from f and
M= (x1, x2, x3,, xn) g1, g2,...gkby composition is an element of PR.
3. For every n >= 0, every function : g : N n --> N in PR,
N= (y1, y2, y3,, yn)
and every function h : Nn+1 --> N obtained from g and h
We can say that there is a Post Correspondence Solution, by primitive recursion is in PR.
HINDUSTHAN COLLEGE OF ENGG & TECH, CBE -32.
DEPARTMENT OF COMPUTER SCIENCE AND ENGG
CS6503 THEORY OF COMPUTATION (REGULATION 2013) SMART MATERIAL
STAFF IN CHARGE: DR.P.EZHILARASU

Potrebbero piacerti anche