Download component based technology - SNS College of engineering

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Computability theory wikipedia , lookup

Junction Grammar wikipedia , lookup

Halting problem wikipedia , lookup

Kolmogorov complexity wikipedia , lookup

Algorithm characterizations wikipedia , lookup

Turing's proof wikipedia , lookup

Transcript
SNS COLLEGE OF TECHNOLOGY
COIMBATORE - 35
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING (UG & PG)
Third Year Computer Science and Engineering, 5th Semester
Subject Code & Name: THEORY OF COMPUTATION
Prepared by: S.VAISHNAVI
UNIT-I
1. Define hypothesis.
The formal proof can be using deductive proof and inductive proof. The
deductive proof consists of sequence of statements given with logical reasoning in
order to prove the first or initial statement. The initial statement is called hypothesis.
2. Define inductive proof.
It is a recursive kind of proof which consists of sequence of parameterized
statements that use the statement itself with lower values of its parameter.
3. Define Set, Infinite and Finite Set.
Set is Collection of various objects. These objects are called the elements of
the set.
Eg : A = { a, e, i, o, u }
Infinite Set is a collection of all elements which are infinite in number.
Eg: A = { a | a is always even number }
Finite Set is a collection of finite number of elements.
Eg : A = { a, e, i, o, u }
4. Give some examples for additional forms of proof.
1. Proofs about sets
2. Proofs by contradiction
3. Proofs by counter examples.
4. Proofs by contradicition
5. Prove 1+2+3+………………+n= n(n+1)/2 using induction method.
Consider the two step approach for a proof by method of induction
1. Basis of induction :
Let n = 1 then LHS = 1 and RHS = 1 + 1 / 2 = 1 Hence LHS = RHS.
2. Induction hypothesis :
To prove 1 + 2 + 3 …… + n = n ( n + 1 ) / 2 + ( n + 1 )
Consider n = n + 1
then 1 + 2 + 3 ……+ n + ( n + 1 ) = n ( n + 1 ) / 2 + ( n + 1 )
= n2 + 3n + 2 / 2
=(n+1)(n+2)/2
Thus it is proved that 1 + 2 + 3 …… + n = n ( n + 1 ) / 2
6. Write down the operations on set.
i ) A U B is Union Operation
If A = { 1, 2, 3 } B = { 1, 2, 4 } then
A U B = { 1, 2, 3, 4 }
i.e. combination of both the sets.
ii) A ∩ B is Intersection operation
If A = { 1, 2, 3 } B = { 1, 2, 4 } then
A U B = { 2, 3 }
i.e. Collection of common elements from both the sets.
iii) A – B is the difference operation
If A = { 1, 2, 3 } B = { 1, 2, 4 } then
AUB={1}
i.e. elements which are there in set A but not in set B.
7. Define Graph, Directed graph and give example.
Graph is consists of finite set of Vertices (Node) V and set of Edges E, edges
are nothing but pair of vertices.
It denoted G = ( V, E )
V1
Eg. :
V4
V2
V3
E1 is a edge connecting the vertices V1 and V2.
Directed Graph is consists of finite set of Vertices ( Node) V and set of
Edges E, edges are nothing but pair of vertices.
It denoted G = ( V, E )
V1
Eg.
V4
V2
V3
The edge E1 shows the direction to V2 from V1.
8. Write any three applications of Automata Theory.
1. It is base for the formal languages and these formal languages are useful of the
programming languages.
2. It plays an important role in complier design.
3. To prove the correctness of the program automata theory is used.
4. In switching theory and design and analysis of digital circuits automata theory
is applied.
5. It deals with the design finite state machines.
9. Define Finite Automaton.
FA consists of a finite set of states and a set of transitions from state to state
that
Occur on input symbols chosen from an alphabet ∑.
A finite automata is a collection of 5 tuples (Q, Σ. δ, q0, F)
where Q is a finite set of states, which is non empty.
Σ is a input alphabet, indicates input set.
δ is a transition function or a function defined for going to next state.
q0 is an initial state (q0 in Q)
F is a set of final states.
Two types:
Deterministic Finite Automation (DFA)
Non-Deterministic Finite Automation. (NFA)
0
1
S1
S0
1
1
0
S2
0
10. Define Deterministic Finite Automation.
- The finite automata is called DFA if there is only one path for a specific
input from current state to next state.
- A finite automata is a collection of 5 tuples (Q, Σ. δ, q0, F )
where Q is a finite set of states, which is non empty.
Σ is a input alphabet, indicates input set.
δ is a transition function or a function defined for going to next state.
q0 is an initial state (q0 in Q)
F is a set of final states.
0
1
S1
S0
1
1
0
S2
0
11. Define Non-Deterministic Finite Automation.
The finite automaton is called NFA when there exists many paths for a
specific input from current state to next state.
A finite automata is a collection of 5 tuples (Q, Σ. δ, q0, F)
where Q is a finite set of states, which is non empty.
Σ is a input alphabet, indicates input set.
δ is a transition function or a function defined for going to next state.
q0 is an initial state (q0 in Q)
F is a set of final states.
12. Define NFA with  transition.
The  is a character used to indicate null string.
i.e the string which is used simply for transition from one state
to other state without any input.
A Non Deterministic finite automata is a collection of 5 tuples (Q, Σ. δ, q0, F )
where Q is a finite set of states, which is non empty.
Σ is a input alphabet, indicates input set.
δ is a transition function or a function defined for going to next state.
q0 is an initial state (q0 in Q)
F is a set of final states.
1
1
0


q0
q1
q2
13. Design FA which accepts odd number of 1’s and any number of 0’s.
0
1
S1
S0
1
1
0
S2
0
14. Design FA to check whether given unary number is divisible by three.
1
1
1
q1
q1
1
15. Design FA to check whether given binary number is divisible by three.
q0
0
0
S1
S0
1
1
0
1
1
S3
S2
0
q2
16. Design FA to accept the string that always ends with 00.
1
0
0
0
q0
q1
q2
1
1
17. Obtain the DFA equivalent to the following NFA.
0, 1
0
1
q0
q1
q2
Solution :
The transition table for given NFA can be drawn as follows
Input
States
{q0}
{q1}
{q2}
0
{q0}{q1}
-
1
{q0}
{q2}
-
To construct equivalent DFA
δ(q0, 0) = {q0, q1 } a new state - A
δ{q0, 1} = {q0}
δ{q1, 0} = δ{q1, 1} = q2}
δ{q2, 0} = δ{q2, 1} = δ{{qo,q1},0} = {q0,q1}
δ{{qo,q1},1} = {q0,q2} a new state -B
δ{{qo,q2},0} = {q0,q1}
δ{{qo,q2},0} = {q0}
The transition table for DFA
Input
States
{q0}
{q1}
{q2}
{q0, q1}
{q0, q2}
The transition diagram for DFA
1
0
0
1
B
A
q
0
0
1
0
{q0, q1}
{q0, q1}
{q0, q1}
1
{q0}
{q2}
{q0, q2}
{q0}
18. Obtain the NFA without  transition to the following NFA with  transition.
0
1
2

q

q
0
q
1
2
Solution:
Remove  transition from q0 to q1
0,1
2

q2
q1
Now remove transition from q0 to q2. As q0 to q2 is transition q0 will
become start and final state both.
0, 1, 2
Start
q0
19. Obtain the  closure of states q0 and q1 in the following NFA with  transition.
a
b
c


q0

q1
Solution:
 - CLOSURE {q0} = {q0, q1,q2} 
 - CLOSURE {q1} = {q1,q2} 
20. Obtain  closure of each state in the following NFA with  move.
2
0
1

q

q2
0

q1
q2
Solution:
 - CLOSURE {q0} = {q0, q1,q2} 
 - CLOSURE {q1} = {q1,q2} 
 - CLOSURE {q2} = {q2} 
21. Explain a transition diagram.
It is a 5-tuple graph used state and edges represent the transitions from one
state to other state.
Eg.:
1
0
1
1
q0
0
q1
q2
22. Explain a transition diagram.
It is the tabular representation of the DFA. For a transition table the transition
function is used.
Eg.:
Input
States
0
1
{q0}
{q1}
{q0}
{q1}
{q2}
{q2}
23. Explain the transition function.
The mapping function or transition function denoted by δ. Two parameters are
passed to this transition function : (i) current state and (ii) input symbol. The
transition function returns a state which can be called as next state.
Eg.:
δ ( q0, a ) = q1
24. Differentiate DFA and NFA?
SI.NO
DFA
NFA
1.
DFA is Deterministic Finite Automata
NFA is Non-Deterministic
Automata
2.
For given state, on a given input, we For given state, on a given input, we
reach to deterministic and unique state
reach to more than one state.
3.
DFA is a subset of NFA
Finite
Need to convert NFA to DFA in the
design of complier
25. Write short notes on Minimization of DFA?
- Reducing the number of states from given FA
- First find out which two states are equivalent we than replace those two
states by one representative state.
- For finding the equivalent states we will apply the following rule
- The two states S1 & S2 are equivalent if and only if both the
states are final or non-final states.
26. What is automata theory?
It is the study of abstract computing devices or machines.
25. Why to study automata theory?
Finite automata model is used in
 Software for designing and checking the behavior of digital circuits
 Lexical analyzer
 Software for scanning large bodies of text
 Protocols for secure exchange of information.
26. What is the structural representation?
 Grammars
 Regular expressions
27. What are the additional forms of proof
.
 Proofs about sets
 Proof by contrapositive
 Proofs by contradicition
 Proofs by counterexample
28. Define alphabet.
An alphabet is a finite, non-empty set of symbols, denoted by ∑.
Eg. ∑= {0, 1}, the binary alphabet
29. What do you mean by string?
A finite sequence of symbols chosen from some alphabet is called string.
Eg. 01101 is a string from the binary alphabet ∑= {0, 1}
30. What is a empty string?
The empty string is the string with zero occurrences of symbols. It is denoted by ε.
31. Define length of a string
Length of the string is “the number of symbols” in the string. |w|
E.g.; |101|=3, | ε|=0
32. Define language.
The language can be defined as a collection of strings or words over certain
input set ∑*
33. Define set.
A set is a collection of objects.
E.g.: The collection of the four letters.
S= { a,b,c,d}
34. Define function.
A function is a rule that assigns to elements of one set a unique element of
Another set
35. Define relation.
A relation is a set of pairs. The first component of each pair is chosen from a set
called the domain and second component of each pair is chosen from a set called the
range.
36. Define Abstract machines with e.g.
The computer which performs computation are not actual computers they are abstract
machine
E.g.: Finite Automata, Push down automata and Turing machine.
37. Give the examples/applications designed as finite state system
Text editors and lexical analyzers are designed as finite state systems. A lexical
analyzer scans the symbols of a program to locate strings corresponding to
identifiers,constants etc, and it has to remember limited amount of information.
38. Define Finite State Systems
The finite automaton is a mathematical model of a system, with discrete inputs and
outputs and a finite number of memory configuration called states.
39.What are the types of Finite automata?
Deterministic finite automata (DFA)
Non deterministic finite automata (NFA)
40.Define DFA.
A DFA consists of A=( Q,∑,δ,q0,F)
Where
Q is the finite set of states,
∑ is a finite input alphabet,
q0 in Q is the initial state,
F is the set of final states and δ is the transition mapping function
Q * Σ to Q.
41. Define NFA
A NFA consists of A=( Q,∑,δ,q0,F)
where
Q is the finite set of states ,
∑ is a finite input alphabet,
q0 in Q is the initial state,
F is the set of final states and δ is the transition mapping function
δ: Q x (∑U{ ε}) = 2Q
42.What are the notations for DFA/NFA?
Transition diagram
Transition table
43. Define Transition diagram
Transition diagram is a directed graph in which the vertices of the graph
Correspond to the states of FA. If there is a transition from state q to state p on input,
then there is an arc labeled ‘ a ‘ from q to p in the transition diagram.
Q0
a
Q1
44. Define transition table.
It is a conventional tabular representation of a function. The rows of the table
correspond to the states and the columns correspond to the inputs.
45. What are the applications of automata theory?
 In compiler construction.
 In switching theory and design of digital circuits.
 To verify the correctness of a program.
 Design and analysis of complex software and hardware systems.
 To design finite state machines such as Moore and mealy machines.
46. What are the components of Finite automaton model?
The components of FA model are Input tape, Read control and finite control.
(a)The input tape is divided into number of cells. Each cell can hold one i/p symbol.
(b)The read head reads one symbol at a time and moves ahead.
(c)Finite control acts like a CPU. Depending on the current state and input symbol
read from the input tape it changes state.
47. Define extended transition function for DFA and NFA
DFA: If δ is the transition function then the extended transition function is δ’.
It takes a state q and a string w and returns a state p.
i.e δ’(q,w)= δ(δ’(q,x),a)
NFA: If δ is the transition function then the extended transition function is δ’.
It takes a state q and a string w and returns a set of states.
k
i.e U δ(pi ,a)={r1,r2,r3…..}
i=1
48. Define language of DFA and NFA.
The language of a DFA A= (Q, ∑, δ,q0,F). This language is denoted by L (A)
And defined as L (A) = {w/ δ’ (q0,w) is in F}
The language of a NFA A=(Q, ∑, δ,q0,F). This language is denoted by L(A)
And defined as L(A) = {w/ δ’(q0,w) n F≠Φ}
49. What is ε -closure of a state q0?
ε -closure (q0) denotes a set of all vertices p such that there is a path from q0 to
Labeled ε.
50. What is a Regular Language?
The language accepted by M is L(M) is the set {x | δ(q0,x) is in F}. A language
Is regular if it is accepted by some finite automaton.
51. Define star closure and positive closure.
Star closure –zero or more Occurrence
Positive closure – one or more occurrence
(eg) a* = { ε,a,aa,….}
a+ = {a,aa,….}
L+ = L* - {ε}
52. Define NFA with ε-transition. Is the NFA’s with ε-transitions are more powerful than
the NFA’s without ε -transition?
The NFA with €- moves defined by 5tuple or quintuple as similarly as NFA,
Except δ (Q,∑, δ,qo,F) with all components as before and
δ: Qx(∑U{ ε}) = 2Q
No, NFA with ε-transition and NFA without ε-transition have the same power.
53. Is it true the language accepted by NFA is different from the regular language? Justify.
Your answer.
No, it is false. For every regular expression r there exists a NFA with ε-transition that
accepts L(r).
54. Differentiate NFA and DFA.
NFA or Non Deterministic Finite Automaton is the one in which there exists
many paths for a specific input from current state to next state. NFA can be used in
theory of computation because they are more flexible and easier to use than DFA.
Deterministic Finite Automaton is a FA in which there is only one path for a
specific input from current state to next state. There is a unique transition on each
input symbol
UNIT - II
1. State regular expression.
Let Σ be an alphabet. The regular expressions over Σ and the sets that
they denote are defined recursively as follows
a. Ø is a regular expression and denotes the empty set.
b.  is a regular expression and denotes the set {}
c. For each ‘a’ Σ, ‘a’ is a regular expression and denotes the set {a}.
d. If ‘r’ and ‘s’ are regular expressions denoting the languages L1 and L2
respectively then
r + s is equivalent to L1 U L2 i.e. union
rs is equivalent to L1L2
i.e. concatenation
*
*
r is equivalent to L1
i.e. closure
2. How the kleen’s closure or closure of L can be
denoted? n
L* = U Li (e.g. a* ={,a,aa,aaa,……})
i=0
3. How do you represent positive closure of
L? n
+
L = U Li (e.g. a+ ={a,aa,aaa,……})
i=1
4. Write the regular expression for the language accepting all combinations of a’s
over the set  = {a}.
L = { a,aa,aaa,………………….}
R= a*
(i.e. kleen closure)
5. Write regular expression for the language accepting the strings which are
starting with 1 and ending with 0, over the set  = {0,1}.
L = { 10,1100,1010,100010………………….}
R= 1(0+1)*0
6. Show that (0*1*)* = (0+1)*.
LHS : (0*1*)* = { , 0,1,00,11,0011,011,0011110……………….}
RHS : (0+1)* = { , 0,1,00,11,0011,011,0011110……………….}
Hence
LHS = RHS is proved
7. Show that (r+s)*  r* + s*.
LHS : (r+s)* = { , r,s,rs,rr,ss,rrrsssr,……………….}
RHS : r* + s* = { , r,rr,rrr………….}U { , s,ss,sss,………….}
= { , r,rr,rrr,s,ss,ssss……………..}
Hence
LHS ≠ RHS is proved
8. What do you mean by homomorphism?
A string homomorphism is a function on strings that works by
substring a particular sting for each symbol.
Eg.
h(0) = ab
h(1) =  is a homomorphism, where replace all 0’s by ab and
replace all 1’s by .
Let w =
0011
h(w)
=
abab
9. Explain the application of the pumping lemma.
Pumping Lemma is used to prove the language is not regular.
10. Describe the following by regular expression
a. L1 = the set of all strings of 0’s and 1’s ending in 00.
b. L2 = the set of all strings of 0’s and 1’s beginning with 0 and ending
with 1. r1 = (0+1)*00
r2 = 0(0+1)*1
11. Show that (r*)* = r* for a regular expression r.
LHS = r*
= { ε, r,rr,rrr, …………….)
(r*)* = { ε, r,rr,rrr, …………….)*
(r*)* = { ε, r,rr,rrr, …………….) = r*
LHS = RHS
12. Write down the closure properties of regular language.
The regular languages are closed under
1. Union
2. Intersection
3. Complement
4. Difference
5. Reversal
6. Closure
7. Concatenation
8. Homomorphism
9. Inverse Homomorphism
13. Write down the relationship between FA and regular expression.
DFA
NFA with ε moves
NFA without ε moves
14. What is pumping lemma?
Let L be a regular language. Then there exists a constant n such that
for every string w in L such that |w| ≥ n, w = xyz such that
i)
y≠ε
ii)
|xy| ≤ n
iii)
For all i ≥ 0, xyiz ∑ L
15. If L = { The language starting and ending with ‘a’ and having any
combinations of b’s in between, that what is r?
r1 = a b*a
16. Give regular expression for
L= L1  L2 over alphabet
{a,b} where L1 = all strings of
even length
L2 = all strings starting with ‘b’.
Solution :
r = r1 + r2
r = anbn + b (a+b)*
17. State Arden’s theorem.
Let P and Q be two regular expression over alphabet ∑. If P does not
contain null string ε, then
R=
Q + RP It
has the
solution
R = QP*
18. What is dead state?
All the non final states which transmit to itselt for all input symbols in ∑, are
called Dead state.
a,b
q – non final state, also the dead state.
q
19. What is a regular expression?
A regular expression is a string that describes the whole set of strings
according to certain syntax rules. These expressions are used by many text
editors and utilities to search bodies of text for certain patterns etc.
Definition is: Let Σ be an alphabet. The regular expression over Σ and the sets
they
Denote are:
i. Φ is a r.e and denotes empty set.
ii. Є is a r.e and denotes the set {Є}
iii. For each ‘a’ in Σ, a+ is an r.e and denotes the set {a}.
iv. If ‘r’ and‘s’ are r.e denoting the languages R and S respectively then (r+s),
(rs) And (r*) are r.e that denote the sets RUS, RS and R* respectively
20. Let ∑ = {0,1} and ∑1 = {0,1,2} with h(0) = 01 and h(1) = 112. Find
h(010) and homomorphic image of L = { 00, 010 }.
Solution :
∑ = {0,1} and ∑1 = {0,1,2}
h is defined as :
h(0) = 01 and h(1) = 112
h(010) = 0111201
The homomorphic image of L = { 00, 010 }is h(L) = {0101, 0111201}.
21. List out the operator of regular expression.
1. Union of two Languages
2. Concatenation of two Languages
3. Closure ( or star ,or kleene closure )of a Language
22. Write a r.e to denote a language L which accepts all the strings which begin or
End with either 00 or 11.
The r.e consists of two parts:
L1= (00+11) (any no of 0’s and 1’s)
= (00+11) (0+1)*
L2= (any no of 0’s and 1’s) (00+11)
= (0+1)*(00+11)
Hence r.e R=L1+L2
= [(00+11)(0+1)*] + [(0+1)* (00+11)]
23. Construct a r.e for the language which accepts all strings with atleast two c’s
over
The set Σ={c,b}
(b+c)* c (b+c)* c (b+c)*
24. Construct a r.e for the language over the set Σ= {a,b} in which total number of
a’s are divisible by 3
( b* a b* a b* a b*)*
25. What is: (i) (0+1)* (ii)(01)* (iii)(0+1) (iv)(0+1)+
(0+1)*= {Є , 0 , 1 , 01 , 10 ,001 ,101 ,101001,…………………}
Any combinations of 0’s and 1’s.
(01)*= {Є , 01 ,0101 ,010101 ,…………………………………..}
All combinations with the pattern 01.
(0+1) = 0 or 1, No other possibilities.
(0+1)+ = {0, 1, 01,10,1000,0101,………………………………….}
26. Reg exp denoting a language over Σ = {1} having (i) even length of string
(ii) Odd length of a string
(i) Even length of string R=(11)*
(ii) Odd length of the string R=1(11)*
27. . Reg exp for:
(i)All strings over {0,1} with the substring ‘0101’
(ii)All strings beginning with ’11 ‘and ending with ‘ab’
(iii)Set of all strings over {a,b}with 3 consecutive b’s.
(iv)Set of all strings that end with ‘1’and has no substring ‘00’
(i)(0+1)* 0101(0+1)*
(ii)11(1+a+b)* ab
(iii)(a+b)* bbb (a+b)*
(iv)(1+01)* (10+11)* 1
28. Reg exp for the language that accepts all strings in which ‘a’ appears tripled
over
the set Σ ={a}
reg exp=(aaa)*
29. What is the closure property of regular sets?
The regular sets are closed under union, concatenation and Kleene closure.
r1Ur2= r1 +r2
r1.r2= r1r2
(r)*=r*
The class of regular sets is closed under complementation, substitution,
Homomorphism and inverse homomorphism.
30. Write the exp for the language starting with and has no consecutive b’s
reg exp=(a+ab)*
31. What is the order of precedence of operators used in regular expression?
i.
* Operator is having the highest precedence.
ii.
Next the concatenation or dot operator (.).
iii. + Operator is having the lowest precedence.
32. Describe the algebra of regular expression.
Regular expressions obey many laws of arithmetic.
1. Union and Concatenation are associative.
2. Union is commutative.
3. Union is idempotent.
33. Write the formula for convert DFA to RE (Regular expression).
Rij (k) = Rij(k-1)+Rik(k-1) ( Rkk(k-1))*Rkj(k-1)
34. What is Arden’s Theorem?
Arden’s theorem helps in checking the equivalence of two regular expressions.
Let P and Q be the two regular expressions over the input alphabet Σ. The
regular expression R is given as :R=Q+RP Which has a unique solution as
R=QP*.
35. List the application of regular expression.
a. Regular expression in UNIX
b. Lexical Analysis.
c. Finding Patterns in a Text
36. What are the applications of Regular expressions?
Lexical analyzers and Text editors are two applications.
Lexical analyzers: The tokens of the programming language can be expressed
using
regular expressions. The lexical analyzer scans the input program and separates the
tokens. For eg identifier can be expressed as a regular expression as:
(letter)(letter+digit)*
If anything in the source language matches with this reg exp then it is
recognized as an identifier.
The letter is{A,B,C,………..Z,a,b,c….z} and digit is
{0,1,…9}.Thus reg exp identifies token in a language.
Text editors: These are programs used for processing the text. For example
UNIX text editors uses the reg exp for substituting the strings such as:
S/bbb*/b/
37. Define pumping lemma for regular languages.
Let L be a regular language. Then there exists a constant n such that for every
string w in L such that |w|≥n. w = xyz such that
a. y ≠ Є.
b. |xy| ≤ n.
c. For all i≥0, xyiz Є L.
38. What are the applications of pumping lemma?
Pumping lemma is used to check if a language is regular or not.
(i) Assume that the language (L) is regular.
(ii) Select a constant ‘n’.
(iii) Select a string (z) in L, such that |z|>n.
(iv) Split the word z into u,v and w such that |uv|<=n and |v|>=1.
(v) You achieve a contradiction to pumping lemma that there exists an
39. How do you test the emptiness of regular language?
The emptiness is defined by checking whether there is a path from the
start sate to some accepting state. If there is a path available the languages
non-empty. If the accepting states are separated from the start state then
the language is empty.
40. What are the closure properties of regular languages?
i. Union
ii. Intersection
iii. Complement
iv. Difference
v. Reversal
vi. Closure.
vii. Concatenation.
viii. Homomorphism
ix. Inverse Homomorphism.
41. Define Homomorphisms.
A string homomorphism is a function on string that works by substituting a
particular string for each symbol.
42. Define Inverse Homomorphisms
Homomorphisms may also be applied “backwards” and this mode they also
preserve regular language.
43. What do you mean by equivalence and minimization of DFA?
For each DFA it is possible to find an equivalent DFA which contains as few s
states
as any DFA accepting the same language.
UNIT - III
1. Let G = ( {S,C}, {a,b}, P,S} where P consists of S  aCa, C aCa, Find L(G))?
Solution:

S
aCa

aaCaa
C aCa
.
.
.
anCan
anban
Cb
L (G) = { anban ; n >0}
2. Consider G whose productions are S aAS/ a ,ASbA / SS / ba, show that 
aabbaa and construct aderivation tree.
Solution:
S
S
aAs

ASbA
aSbAs
a
A
S




aabAS
aabbaS
aabbaa
S a
Aba
S a
a
S
a








b
A
b

3. Find L(G) where G = ({S},{0,1}, {S 0S1, s ε },S)
Solution:

S
0S1

00S11 
.
.
.
n n

0 S1 
L (G) = { 0n1n ; n >0}
4. Define a derivation tree for CFG.
A derivation tree for a CFG G=(V,T,P,S) is a tree satisfying the
following
 Every vertex has a label, which is a symbol of V U T U ε 
 The label of the root is S. 
 If a vertex is interior and has a label A, then A must be in V. 


If n has a label A and vertices n1, n2,……nk are sons of
the vertex n, in x1,x2,……xk must be a production in P. 
If vertex n has label ε, then n is a leaf and is the only son of its
father. 

5. Construct CFG L= { anbn ; n≥1}.
Solution:
The Production are
S  aSb / ε, where G= ({S}, {a,b,ε}, P, S)
a
6. Find a LM derivation for aaabbabbba with the
productions. P : S  aB / bA, A  a /S / bAA, B 
b / bS / aBB
Solution:

S  aB  aaBB
aaaBBBaaabBB
aaaabbBaaabbaBBaaabbabB  aaabbabbS  aaabbabbbA
S  aaabbabbba
7. Find L(G), S  aSb, S  ab.
Solution:

S
aSb

aaSbb
C aSb
.
.
anSbn

anbn
C  ab
L (G) = { anbn ; n ≥1}
8. Show that id* id can be generated by two distinct leftmost derivation in the
grammar E E+E / E*E / (E) / id
Solution:
(i) E  E +E
(ii)
E  E *E


id+E
E +E*E


id+E*E
E+E*id


id+id*E
E+id*id


id+id*id
id+id*id
We showed that id+id*id can be generated by two distinct
LMD.
9. Define pushdown automaton.
A Pushdown Automata is a finite automation with extra resource
called stack. It consists of 7 tuples.
P = (Q, ∑, , ,
q0, Z0, F) Where
Q – Finite set of states
∑ - Finite set of input symbols
 - Finite set of stack symbols 
 - Transition function 
q0 – Start State
Z0 – Start symbol of the stack
F – Final State.
10. What are the different ways of language acceptances by a PDA and define
them.
i)
Acceptance by final state
L (M) = { w | (q0, w, z0) |--*(p, ε,  ) for some P in F and  in |-*}
ii)
Acceptance by empty stack
N (M) = { w | (q0, w, z0) |--*(p, ε, ε ) for some P in Q}
11. Write a CFG for the set of strings which does not produce any palindromes.
Here the grammar should be designed in such a way that w ≠ wR
S  aSa / 
bSb / C C
aAb
/ bAa
A aA / bA /
ε
12. Find the language for the CFG
S > aSa / aAb
A bAa / b a
Solution:
S  aSb  aaSbb  …..  anSbn  anaAbbn
anabAabbn  anabnaabbn anbmambn
L = { anbmambn ; m,n ≥ 1}
13. Find the derivation tree for the grammar
G = ( {S, A, B}, {a,b}, P, S}
Where P is given by
S  Aa / bB
A ab
B aBb / a
Solution:
S
S
b
b
A
a
(or)
B
a
b
B
b
14. Construct a PDA that accepts the language generated by the grammar
S aSbb / aab
Solution:
The PDA A = ({q}, {a,b},
{S,a,b},, q,S} Where  :
i)
 (q, z0, S) = {(q, aSbb), (q, abb)}
ii)
(q, a, a ) = {(q, ε)}
iii)
(q, b, b ) = {(q, ε)}
15. Construct a PDA that accepts the language generated by the
grammar S  aABB , A  aB / a , B  bA / b
Solution:
The PDA A = ({q}, {a,b}, {S,A,B,Z,a,b},, q,S}
Where  :
i)
 (q, z, S) = {(q, aABB)}
(q, z, A = {(q, aB,
ii)
(q,a)}
)
(q, z, B = {(q, bA,
iii)
)
(q,b)}
(q, a, a
iv)
= {(q, ε)}
)
v)
(q, b, b ) = {(q, ε)}
16. Define parse tree.
b
A data structure to represent the source program in a complier is
called parse tree. Parse tree can have nodes and edges.
17. How do you convert CFG to a PDA.
Let G = (V, T, P, S) be a CFG. Then construct a PDA P that accepts
L(G) by empty stack as follows :
P = ({q}, T, V
U T, , q, S)
Where  is
given by
1) For each variable A,
(q,ε,A) = {(q,β) |Aβ is a production of P}
2) For each terminal a,
(q,a,a) = {(q,ε)}
18. Define Deterministic PDA.
A PDA P = (Q, ∑, , , q0, Z0, F) to be deterministic iff
1) (q,a,X) has at most one member for any q in Q, a in ∑ or a = ε and
X in |--.
2) If (q,a,X) is not empty, for some a in ∑, then (q,ε,X) must be
empty.
19. Is it true that NDPA is more powerful than that od DPDA? Justify your
answer.
No, NPDA is not powerful than DPDA. Because NPDA may
produce ambiguous grammar by reaching its final state or by emptying
its stack. But DPDA produces only unambiguous grammar.
20. What is the additional feature PDA has when compared with NFA? Is PDA
superior over NFA in the sense L acceptance? Justify your answer.

PDA is superior NFA by having the following additional features.
 Stack which is used to store the necessary tape symbols and use
the state to remember the conditions. 
 Two ways of L acceptances, one by reaching its final state
and another by emptying its stack. 
21. Define a context free grammar
A context free grammar (CFG) is denoted as G= (V, T, P, S) where V and T
are
finite set of variables and terminals respectively. V and T are disjoint. P is a
finite set of productions each is of the form A-> α where A is a variable and α is a string
of symbols from (V U T)*.
22. What are the uses of Context free grammars?
 Construction of compilers.
 Simplified the definition of programming languages.
 Describes the arithmetic expressions with arbitrary nesting
of balanced parenthesis { (, ) }.
 Describes block structure in programming languages.
 Model neural nets.
*
23. The language generated by G ( L(G) ) is {w | w is in T* and S =w .That is a
G
String is in L(G) if:
(1) The string consists solely of terminals.
(2) The string can be derived from S.
24. What is left most derivation
In each step if the leftmost variable is replaced by one of its production bodies then it is
called as leftmost derivation. It is denoted as
=> one step derivation
lm
*
=> many step derivation
lm
25. What is right most derivation
In each step if the right most variable is replaced by one of its production bodies then it is
called as right most derivation. It is denoted as
=> one step derivation
rm
*
=> many step derivation
rm
26. What is (a) CFL (b) Sentential Form?
L is a context free language (CFL) if it is L(G) for some CFG G.
If the derivations from the start symbol produce strings then it is called as sentential form
i.e.,
*
S => α, where S is the start symbol of the grammar.
27. What is the language generated by the grammar G=(V,T,P,S) where
P={S->aSb, S->ab}?
S=> aSb=>aaSbb=>…………………………..=>anbn
Thus the language L(G)={ anbn| n>=1}.The language has strings with equal
number of a’s and b’s.
28. If S->aSb | aAb , A->bAa , A->ba .Find out the CFL
soln. S->aAb=>abab
S->aSb=>a aAb b =>a a ba b b(sub S->aAb)
S->aSb =>a aSb b =>a a aAb b b=>a a a ba b bb
Thus L={an bm am bn, where n,m>=1}
29. Define Parse trees.
The tree representation for a derivation is called parse tree. also known as derivation
tree or s-tree
30. What is the yield of a parse tree?
If the leaves of any parse tree is concatenated from left, we get a string called the yield of
the tree.
i)the yield is a terminal string.
ii) the root is labeled by the start symbol
31. Application of CFG.
Parsers,YACC parser Generator,Markup languages,XML & DTD
32. What is an ambiguous grammar?
A grammar is said to be ambiguous if it has more than one derivation trees for a
sentence or in other words if it has more than one leftmost derivation or more than
one rightmost derivation.
33. Give the context free grammar for generating the language
L={anb2n;n≥1}
S→Sbb
S→abb_
34. Consider G whose productions are S→aAS_a, A→SbA_SS→ba. Show that
S=>aabbaa
S=>Aas
=>aSbAS
=>aabAS
=>aabbaS
=>aabbaa
35. Find the language generated by a CFG. G=({S},{0,1},{S→0|1| ε , S→0S0|1S1|S)
S =>0S0
S =>1S1
=>01S10
=>10S01
=>0I0I0
=>10001
L= { w;w is a palindrome}
36. Differentiate sentences Vs sentential forms
A sentence is a string of terminal symbols.
A sentential form is a string containing a mix of variables and terminal symbols
or all variables. This is an intermediate form in doing a derivation.
37. Define Pushdown Automata.
A pushdown Automata M is a system (Q, Σ, Ѓ , δ ,q0, Z0,F) where
Q is a finite set of states.
Σ is an alphabet called the input alphabet.
Ѓ is an alphabet called stack alphabet.
q0 in Q is called initial state.
Zo in Ѓ is start symbol in stack.
F is the set of final states.
Σ is a mapping from Q X (Σ U { ε } ) X Ѓ to finite subsets of Q X Ѓ *.
38. Compare NFA and PDA.
NFA
1. The language accepted by NFA is the
regular language.
2. NFA has no memory.
3. It can store only limited amount of
information
4. A language/string is accepted only
by reaching the final state.
PDA
1.The language accepted by PDA is
Context free language.
2. PDA is essentially an NFA with
a stack(memory).
3 It stores unbounded limit
of information.
4. It accepts a language either by empty
Stack or by reaching a final state.
39. What are the different types of language acceptances by PDA and define them,
Two types
1. Acceptance by final state
2. Acceptance by empty stack
40. Is it true that the language accepted by a PDA by empty stack and final states are
different languages.
No, because the languages accepted by PDA ‘s by final state are exactly the
languages accepted by PDA’s by empty stack.
41. What is the additional feature of PDA has when compared with NFA? Is PDA
superior over NFA? Is PDA superior over NFA in the sense of language
acceptance?
Justify your answer:
Additional features of PDA:
a) PDA is eventually a FA with a stack.
b) PDA can accept context free languages.
c) PDA can recognize the context free languages which are not regular.
Yes, PDA is superior over NFA in the sense of languages.
42. Is it true the nondeterministic PDA is more powerful than that of deterministic
PDA?
Justify your answer.
Yes, wwR is accepted by NPDA but not any DPDA in the sense of language
Acceptance.
43. Regular Language:A Language can be described by DFA or NFA.
Context free language cannot be described by DFA (or) NFA – since there is no
Memory.
Pushdown Automata has a memory, which can be used to count the number.
Pushdown Automata can accept context free languages. It is essentially an NFA
with a stack.
44. A pushdown automata G=(Q, Σ, Ѓ, δ,q0,z,F) is said to be deterministic if
1. δ (q,a,X)contains atmost one element.
2. If δ (q,l,b) is not empty, then δ (q,e,b) must be empty .
The first condition says that for any given input symbol and any stack top, at
most one move can be made.
The second condition says that when a l move is possible for some configuration,
no input consuming alternative is available
45. What are the properties of the CFL generated by a CFG?
Each variable and each terminal of G appears in the derivation of
some word in L
There are no productions of the form A->B where A and B are
variables.
46. Give examples of languages handled by PDA.
(1) L={ anbn | n>=0 },here n is unbounded , hence counting cannot be done by finite
memory. So we require a PDA ,a machine that can count without limit.
(2) L= { wwR | w €{a,b}* } , to handle this language we need unlimited counting
capability .
47. Is NPDA (Nondeterministic PDA) and DPDA (Deterministic PDA) equivalent?
The languages accepted by NPDA and DPDA are not equivalent.
For example: wwR is accepted by NPDA and not by any DPDA.
48. State the equivalence of acceptance by final state and empty stack.
If L = L(M2) for some PDA M2 , then L = N(M1) for some PDA M1.
If L = N(M1) for some PDA M1 ,then L = L(M2) for some PDA M2.
where L(M) = language accepted by PDA by reaching a final state.
N(M) = language accepted by PDA by empty stack.
49. State the equivalence of PDA and CFL.
If L is a context free language, then there exists a PDA M such that
L=N(M). If L is N(M) for some PDA m, then L is a context free language.
50. Define Deterministic PDA.
A PDA M =( Q, Σ, Ѓ , δ ,q0, Z0 ,F ) is deterministic if:
For each q in Q and Z in Ѓ , whenever δ (q, ε ,Z) is nonempty ,then
δ (q,a,Z) is empty for all a in Σ.
For no q in Q , Z in Ѓ , and a in Σ U { ε} does δ (q,a,Z) contains more
than one element.
(Eg): The PDA accepting {wcwR | w in ( 0+1 ) * }.
51. What is the informal definition of PDA?
A PDA is a computational machine to recognize a Context free language.
Computational power of PDA is between Finite automaton and Turing machines. The
PDA has a finite control, and the memory is organized as a stack.
52. Give an example of Nondeterministic CFL
The language L= { wwR : w € {a,b}+ } is a nondeterministic CFL.
UNIT – IV
1. What are the two major normal forms for context-free grammar?
The two Normal forms are
i. Chomsky Normal Form (CNF)
ii. Greibach Normal Form (GNF)



2. What is a useless symbol?
A symbol x is useful if there is a derivation
S* α x β * w for some α, β, w ∑ T* or else , it is useful.
3. How do you simplify the context-free grammar?
 First eliminate useless symbols, where the variable or
terminals that do not appear in any derivation of a terminal
string from the start symbol. 
 Next eliminate ε- productions which is of the form A ε for some
variable A. 
 Eliminate unit productions, which are of the form A  B for
variables A, B. 
 Finally use any of the normal forms to get the simplified CFG. 
4. Define Nullable Variable?
Nullable variable in a CFG G =(V,T,P,S) can be defined as follows.
 Any variable A for which P contains the production A A, is
nullable. 
 If P contains the production A B1,B2, ……. Bn and B1, B2,
….Bn are nullable variables, then A is nullable. 
 No other variables in V are nullable. 
5. Define generating symbol?
Let G = (V,T,P,S) is generating,if X * w for some
terminal
string w. e.g. A aAB / ε
B b
Then A is a generating symbol since A  *ab
6. Let G = (V, T, P,S) with the productions given by
S  aSbS/ B / ε
B abB
Eliminate the useless production.
Solution:
Remove B is useless production because of Variable is
not reachable. S  aSbS / ε
7. What is substitution Rule?
A production Ax1Bx2 can be eliminated from a grammar if B is replaced
by all strings derived by B in one step, provided A and B are variables.
8. What is a useful production?
Let G = (V,T,P,S) be a CFG. A variable A ∑ V is said to be useful iff
there is atleast one w∑L(G) such that
S * xAy * w
with x,y in (VUT)*.
9. Determine whether the grammar G has a useless production?
S

A
A

a
A
/
ε
B  bA
The variable B is useless, since it is used by the start variable or
by the variable in the start production.
B bA is a useless production.
10. Write a procedure to eliminate ε production.
i)
For all productions Aε, put A into V
ii)
Repeat the following steps until no new variable
are added. a. For all productions
B A1A2A3……………An, where
A1A2A3……………An are in V
b. Put B into V


11. Write the procedure to eliminate the unit productions.
i)
Find all variables B, for each A such that
A* B
ii)
The new grammar G is obtained by letting into P all non-unit
productions of P.
iii)
For all A and B satisfying A * B, add to p
A y1 / y2 / y3 /………/ yn , where B  y1 / y2 / y3
/………/ yn is the set
of productions in P.
12. Define CNF.
A CFG without any ε–production is generated by a grammar in which
the
productions are of the form.
A  BC
or A a, where A,B ∑ V and a ∑ T.
13. What is GNF?
Every CFL L without ε cab be generated by a grammar for
which every production is of the form A aα, where A∑V, a∑T, is a
string of variables.
14. What is a Turning Machine?
A finite state machine with storage is called a Turing Machine.
15. Define a Turing Machine.
The Turing Machine is
denoted by M = (Q, ∑, , ,
q0, B, F)
Where
Q – Finite set of states
∑ - Finite set of input symbols
 - Finite set of stack symbols 
 - Transition function - Q x |--  Q x |-- x {L,R}, Where
L,R – Directions. q0 – Start State 
B – a Start symbol of the |-, a blank F – Final State. 
16. What are the required fields of an instantaneous description or configuration
of a TM.
It requires


 The state of the TM 
 The contents of the tape. 
 The position of the tape head on the tape. 
17. What is multiple tracks Turing machine?
A Turing machine in which the input tape is divided into multiple
tracks where each track is having different inputs is called multiple tracks
Turing machine.
18. What is multidimensional Turing Machine?
The Turing Machine which has the useful finite control, but the tape
consist of a k-dimensional array of cells infinite in all 2K directions for some
fixed K. Depending on the state and symbol scanned, the device changes state,
prints a new symbol and moves its tape head in one of 2K directions, along
one of the K axes.
19. When is a function f said to be Turing computable?
A Turing Machine defines a function y = f(x) for strings x,y *, if
q0 x |--* qfy
A function f is ‘Turing Computable’ if there exists a Turing
Machine that performs a specific function.
20. What is off-line Turing Machine?
An Off-line Turing Machine is a multitape TM whose input tape is
read only. The Turing Machine is not allowed to move the input tape head off
the region between left and right end markers.
21. What is a formal language?
Language is a set of valid strings from some alphabet. The set may be empty,
finite or infinite. L(M) is the language defined by machine M and L( G) is the language
defined by Context free grammar. The two notations for specifying formal languages are:
Grammar or regular expression (Generative approach)
Automaton (Recognition approach)
22. What are the three ways to simplify a context free grammar?
By removing the useless symbols from the set of productions.
By eliminating the empty productions.
By eliminating the unit productions.
23. What are the properties of the CFL generated by a CFG?
Each variable and each terminal of G appears in the derivation of
Some word in L
There are no productions of the form A->B where A and B are
Variables.
24. Define Grieback normal form
A grammar for which every productions is of the form A->aα where A is a
variable, a is a terminal and α is a string of variables.
25. Define Chomsky normal form.
A grammar in which all productions are the form A->BC or A->α where A,B
and
C are variables and a is a terminal.
26. What is Backus-Naur Form (BNF)?
Computer scientists describes the programming languages by a notation called
Backus- Naur Form. This is a context free grammar notation with minor
changes in format and some shorthand.
27. State the pumping lemma for CFLs.
Let L be any CFL. Then there is a constant n, depending only on L, such that if z
is in L and |z| >=n, then z=uvwxy such that :
(i) |vx| >=1
(ii) |vwx| <=n and
(iii) for all i>=0 uviwxiy is in L.
28. What is the main application of pumping lemma in CFLs?
The pumping lemma can be used to prove a variety of languages are not context
free . Some examples are:
L1 ={ aici | i>=1} is not a CFL.
L2= { aibjcidj | i>=1 and J>=1 } is not a CFL
29.
(a) CFL are not closed under intersection and complementation –True.
(b)A regular grammar generates an empty string –True.
(c) A regular language is also context free but not reverse–True.
(d)A regular language can be generated by two or more different grammar True.
(e) Finite State machine (FSM) can recognize only regular grammar-True.
30. What are the closure properties of CFL?
CFL are closed under union, concatenation and Kleene closure.
CFL are closed under substitution, homomorphism.
CFL are not closed under intersection, complementation.
Closure properties of CFL’s are used to prove that certain languages are not
Context free.
31. What are the properties of CFL?
Let G=(V,T,P,S) be a CFG
The fanout of G , Ф(G) is largest number of symbols on the RHS of
any rule in R.
The height of the parse tree is the length of the longest path from the
root to some leaf.
32. Define turing machine
A TM is described by:
1. A finite set of states (Q, typically).
2. An input alphabet (Σ, typically).
3. A tape alphabet (Γ, typically; contains Σ).
4. A transition function (δ, typically).
5. A start state (q0, in Q, typically).
6. A blank symbol (B, in Γ- Σ, typically).All tape except for the input is
blank initially.
7. A set of final states (F ⊆ Q, typically).
33. What is instantaneous description for turing machine?
An ID is a string q, where  is the tape between the leftmost and
rightmost nonblanks (inclusive).
The state q is immediately to the left of the tape symbol scanned.
If q is at the right end, it is scanning B.
w If q is scanning a B at the left end, then consecutive B’s at and to the
right of q are part of .
34. Define the language of a turing machine.
A TM defines a language by final state, as usual.
L(M) = {w | q0w⊦*I, where I is an ID with a final state}.
Or, a TM can accept a language by halting.
H(M) = {w | q0w⊦*I, and there is no move possible from ID I}.
35. Give the transition function for turing machine
Takes two arguments:
1. A state, in Q.
2. A tape symbol in Γ.
δ(q, Z) is either undefined or a triple of the form (p, Y, D).
3. p is a state.
4. Y is the new tape symbol.
5. D is a direction, L or R.
36. list out the different types of turing machine
Nondeterministic tm
Turing machine with two dimensional tapes
Turing machine with multiple tapes
Turing machine with multiple heads
Turing machine with infinite tape
UNIT – V
1. What is the weak-form of Turing thesis?
A Turing Machine can compute anything that can be computed by a
general purpose digital computer.
2. What is the strong-form of Turing thesis?
A Turing Machine can compute anything that can be computed.
This is the strong form of Turing thesis.
3. When a language is said to be recursively enumerable?
A language is recursively enumerable if there exists a Turing
Machine that accepts every string of the language and does not accept
strings that are not in the language.
4. When a language is said to be recursive?
A language L is said to be recursive if there exists a Turing machine
M that accepts L, and goes to halt state or else M rejects L.
5. What is diagonalization language?
The language Ld. Which consists of all those strings w such that the
Turing machine represented by w does not accept the input w.
Ld = { wi | wi  L(Mi)}
6. Define decidability (or) decidable problems?
A problem is said to be decidable if there exists a Turing machine
which gives one ‘yes’ or ‘no’ answer for every input in the language.
(or)
A problem is said to be decidable if it is a recursive language.
7. Define Undecidable problem?
If a problem is not a recursive language, then it is called undecidable
problem.
8. Define Universal language?
A Universal Turing Machine Mu is an automation, that given as input
the description of any Turing Machine M and a string w, can simulate the
computation of M on w.
9. What are the reasons for a TM not accepting its input?
i)
The TM may halt in a non final state.
ii)
The TM may enter into an indefinite loop.
10. Define trivial property?
A property is trivial if it is either empty of is all RE languages.
11. Define rice Theorem?
Every non-trivial property of the RE languages is undecidable.
12. Define post’s correspondence problem?
An instance of PCP consists of
two lists, A = w1, w2,
w3, . . . . . . . wk
B = x1, x2, x3, . . . . .. . . . .xk of strings over some ∑. This
instance of PCP has a solution if there is any sequence of integers i1,
i2,, ………….im with m≥1.
Such that
wi1, w i2, w i3 ………………………..w im = x i1, x i2, x
i3,………….x im
The sequence of i 1,i 2,……………..i m is a solution to this instance of
PCP.
13. Let A and B be lists of three strings each, as defined in the following table?
A
B
1
w
1
x
111
2
10111
10
3
10
0
Find the instance of post correspondence Problem.
Solution :
Apply wi1, w i2, w i3 ………………………..w im = x i1, x i2, x
i3,………….x im to this problem.
Take M = 4
w 2 w 1 w 1 wi3 = x 2 x 1 x 1 xi3
111 111
10 111 111 0 =10
0
Instance =
2,1,1,3.
14. Define modified post’s correspondence problem?
Given lists A and B, of K strings each
from ∑*, say A = w1, w2, w3, . . .
. . . . wk
B = x1, x2, x3, . . . . .. . . . .xk
Does there exist a sequence of integers i 1,i 2,……………..i r such that
wi1, w i2, w i3 ………………………..w im = x i1, x i2, x i3,………….x ir
The sequence of i 1,i 2,……………..i m is a solution to this instance of
PCP.
15. Define problem solvable in polynomial Time?
A Turing Machine M is said to be of time complexity T(n) if
whenever m given an input w of length n, m halts after making atmost T(n)
moves, regardless of whether or not m accepts.
16. Define the classes P and NP?
P consists of all those languages or problems accepted by some
Turing Machine that runs in some polynomial amount of time, as a
function of its input length.
NP is the class of languages or problems that are accepted by
Nondeterministic TM’s with a polynomial bound on the time taken
along any sequence of non – deterministic choices.
17. Define NP – Complete Problem?
A language L is NP – complete if the following statements are true.
a. L is in NP
b. For every language L1 in NP there is a polynomial time
reduction of L1 to L
18. What are tractable problems?
The problems which are solvable by polynomial time algorithms are
called tractable problems.
19. What are the properties of recursive enumerable sets Which are undecidable?
i)
Emptiness
ii)
Finiteness
iii)
Regularity
iv)
Context – freedom
20. What are the properties of recursive and Recursively Enumerable Language?
1. The complement of a Recursive language is Recursive.
2. The union of two recursive languages are recursive. The
union of two RE languages
are RE.
3. If a language L and complement L are both RE, then L is recursive.
21. What are the possible outcomes of executing a turing machine
Halt & accept the input
Halt & reject the input
Or never halt
22. Define recursive language
A language is recursive if there exists a turing machine that accepts every
string of the language and rejects every string that is not in the language
23. Define recursively enumerable language.
A language is Recursively enumerable if there exists a turing machine that
accepts every string of the language and does not accept strings that are not in the
language.
i.e it never halts,by entering in to a infinite loop.
24. What is a universal language?
Lu, the universal language to be the set of binary strings that encode a pair
(M,w), where M is a TM with binary input alphabet, and w is a string in (0+1)*,such
that w is in L(M).Lu is the set of strings representing a TM and an input accepted by
that TM.
25. Define rice’s theorem
Every nontrivial property of the RE languages is undecidable. Let P be a nontrivial
property of the RE language. Assume that Φ , the empty language is not in P.
26. Define post correspondence problem.
An instance of Post’s correspondence problem consists of two lists of strings
over some alphabet E. The two lists must be of equal length.A=w1,w2,….wk &
B=x1,x2,….xk for some integer k. For each i, the pair (wi,xi) is said to be a
corresponding pair.
The instance of PCP has a solution, if the sequence is interpreted ,yield the same
string.
27. Define intractable problem.
Techniques for showing problems not to be solvable in polynomial time .
28. What is Class P & NP?
The class P problems solvable in polynomial time by deterministic TM
The class NP problems solvable in polynomial time by Nondeterministic TM
29. What is the weak-form of Turing thesis?
A Turing Machine can compute anything that can be computed by a general
purpose digital computer.
30. What is the strong-form of Turing thesis?
A Turing Machine can compute anything that can be computed. This is the
strong form of Turing thesis.
31. When a language is said to be recursively enumerable?
A language is recursively enumerable if there exists a Turing
Machine that accepts every string of the language and does not accept strings
that are not in the language.
32. When a language is said to be recursive?
A language L is said to be recursive if there exists a Turing machine
M that accepts L, and goes to halt state or else M rejects L.
33. What is diagonalization language?
The language Ld. Which consists of all those strings w such that the
Turing machine represented by w does not accept the input w.
Ld = { wi | wi  L(Mi)}
34. Define decidability (or) decidable problems?
A problem is said to be decidable if there exists a Turing machine
which gives one ‘yes’ or ‘no’ answer for every input in the language.
(or)
A problem is said to be decidable if it is a recursive language.
35. Define Undecidable problem?
If a problem is not a recursive language, then it is called undecidable problem.
36. Define Universal language?
A Universal Turing Machine Mu is an automation, that given as input
the description of any Turing Machine M and a string w, can simulate the
computation of M on w.
37. What are the reasons for a TM not accepting its input?
i)
The TM may halt in a non final state.
ii)
The TM may enter into an indefinite loop.
38. Define trivial property?
A property is trivial if it is either empty of is all RE languages.
39. Define rice Theorem?
Every non-trivial property of the RE languages is undecidable.