Anda di halaman 1dari 45

AUTOMATA LANGUAGE AND COMPUTATION 2 marks

UNIT –I
1) What is meant by finite automata?
Finite automaton is a mathematical model of a system with discrete inputs and outputs. The system can be
in any one of the finite number of states. The state of the system summaries the information concerning past
inputs that is needed to determine the behavior of the systems on subsequent inputs. A finite automaton
consists of a finite set of states and set of transitions from state to state that occur on input symbols chosen
from an alphabet ∑.

2) 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)

3) What are the functions of head pointer and finite control?

Head pointer:

The head examines only one square at a time and can move one square either to the left or to the right but
we restrict the movement of the reading head pointer only to the right-side.

Finite control:

The finite control contains the routines that instruct the reading head pointer to move from one state to the
next state by recognizing each symbol or alphabet.

4) What are the two main types of finite automata?


There are two types of finite automata,
i. Deterministic Finite Automata (DFA).
ii. Non deterministic Finite Automata (NFA).

DFA

For each and every state and for each and every input symbol there exist atmost one transition. The
transition mapping for DFA is Q×∑→Q.

NFA

For each and every state and for each and every input symbol there exist more than one transition. The
transition mapping for NFA is Q × (∑ U { }) → .

MVIT/DEPT. OF CSE Page 1


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

5) What are the two ways of representing an automaton?

The two ways of representation of finite automata are ,

i. Transition Diagram.
ii. Transition Table.

Transition Diagram:

The transition diagram consists of finite set of states, symbols, initial state and final state. It is a
directed graph which shows the transition from one state to another.

Transition Table:

The transition table is the tabular representation of the transition function “delta (∂)” with the rows
denoting states and columns denoting input symbol.

6) Define a language.
An alphabet is a finite set of symbols. A language is a set of strings of symbols from someone alphabet.
e.g.
If ∑ = {0,1},then ∑* }.

7) What is meant by transition?


Transition is the process of moving from one state to another state on reading an input symbol. It can be
represented as ∂ (q , a).
e.g.:

a
Q1
Q0

8) What is regular expression and regular language?


The language accepted by finite automata is described by a simple expression called as regular expression.
The language accepted by regular expression is called as regular language.

9) What are two- way finite automata?


The deterministic finite automata as a control unit that reads a tape moving one square right at each
moved. We needed non-determinism to the model which allowed many “copies” of the control unit to exist
and scan the tape simultaneously .Next we added €- transitions, which allowed change of state without
reading the input symbol or moving the tape head. Next interesting extension is to allow the tape head with
the ability to move left as well as right, such a finite automaton is called two way finite automata.

MVIT/DEPT. OF CSE Page 2


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

10) What is meant by -closure?

The “ ” is a character used to indicate the null string (i.e) the string which is used simply for transition
from one state to the other without any input. The NFA with € transition function can be extended to ∂‟ as
∂‟=Q×∑*→

The -closure is represented as

11) State the equivalence theorem of NFA and DFA.


Let L be a language accepted by non-deterministic finite automata then there exist a deterministic finite
automata that accepts the same language “L”. It can also be said that the language accepted by NFA is equal
to the language accepted by DFA.
(i.e.) L(M)=L(M‟)
Where,
M is the NFA and M‟ is the DFA.

12) Define the language accepted by NFA with epsilon moves.


The language accepted by NFA with epsilon transition is represented as,
M= (Q,∑,∂,q0,F)
Where,
M is the NFA with moves.
Q is the finite set of non-empty states.
∑ is the finite set of non-empty symbols.
∂ is the finite set of transitions.
q0 is the initial state.
F is the final state.

13) Define regular expression theorem.

Let „r‟ be the regular expression then there exists a NFA with -transition that accepts L(r)

(i.e.) L(M)=L(r).

Where the regular expression “r” belonging to a language “L” can be accepted by automata with
.

14) Write down the rules for defining regular expression.


The rules that define the regular expression over alphabet ∑ are as follows,
 ø is a regular expression that denotes the empty set .
 is the regular expression that denotes the set
 For each „a‟ in ∑, then the regular expression of a is denoted as {a}.
 If r and s are regular expression denoting language R and S respectively then (r+s), rs and (r*) are
regular expression that denote the set RUS, RS, R* respectively.

MVIT/DEPT. OF CSE Page 3


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

15) What are the difference between NFA and DFA?

DFA NFA
i. For each and every state and i. For each and every state and for
for each and every input each and every input symbol
symbol there exist atmost one there exist more than one
transition. transition.
ii. The transition mapping for ii. The transition mapping for NFA
DFA is Q×∑→Q. is Q × (∑ U { }) → .
iii. The language accepted by iii. The language accepted by NFA is
DFA is denoted as L(M). denoted by L(M‟).
iv. Epsilon transition is not iv. Epsilon transition is possible.
possible.

16) Write down the operations of the regular expression.

There are main operations that are closed under regular expression,

i. Union.
ii. Concatenation.
iii. Kleene Closure.

Union :

Let r1 and r2 be the regular expressions and the union of these two regular expressions are denoted as
r1 U r2 or r1+r2 the general form of representation of union operation is given by,

M==(Q1UQ2 U{q0,f0},∑1U∑2,∂,q0,{f0}).

Concatenation:

Let r1 and r2 be the regular expressions and the union of these two regular expressions are denoted as
r1. r2 or r1r2 the general form of representation of concatenation operation is given by,

M==(Q1UQ2 ,∑1U∑2,∂,q0,{f0})

Kleene Closure :

Let r1 be the regular expressions and the union of these two regular expressions are denoted as r 1* or
the general form of representation of kleene closure is given by,

M==(Q1U{q0,f0},∑,∂,q0,{f0})

MVIT/DEPT. OF CSE Page 4


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

17) State some applications of regular expression.

Some of the basic applications of regular expression are ,

 Lexical Analysis.
 Pattern searching.

18) State Arden’s theorem.


According to Arden‟s theorem if the expression is of the form R=Q+RP, then we can write it as the form
R=QP*.
Where, P and Q are the regular expression.
Arden‟s theorem is mainly used for checking the equivalence of two regular expression as well as in
conversion of DFA to regular expression.
19) What are the two types of finite automata with output?
There are two types of finite automata,
 Mealy machine.
 Moore machine.

An automaton in which the output depends on the states of the states of the machine is called
Moore machine. An automaton in which
the output depends on the state as well as on the input at any instant of time is called a Mealy machine.

20) State the difference between Mealy and Moore machine.

MEALY MACHINE MOORE MACHINE


i. For each and every transition there i. For each and every state there will be
will be a output. a output.
ii. An automaton in which the output ii. An automaton in which the output
depends on the state as well as on the depends on the states of the states of
input at any instant of time is called a the machine is called Moore machine.
Mealy machine. iii. The transition mapping is given by,
iii. The transition mapping is given by, λ:Q→Δ
λ:Q×∑→Δ

21)State some applications of finite automata.


There are varieties of software design problems that are simplified by automatic conversion of regular
expression notation to an efficient computer implementation to the corresponding finite automaton. Two
such applications are
 Lexical analyser.
 Text Editor.

MVIT/DEPT. OF CSE Page 5


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

22) Construct a DFA with for all the set of strings with {0, 1} that has even number of 0’s and 1’s.

1
q0 1 q1

0 1 0 0

1
q4 q3
1

23)Construct DFA for set of all strings {0,1} with 011 as substring.

0 0 1
q3
q0 q1 q2
1
1 0 1/0

24)Draw the block diagram of a finite automata?

¢ a b a $

FC

25) Explain the six tuples in a mealy and a moore machines ?


The moore and a mealy machine is being represented by M. Both the machine consists of 6-tuples.
M = (Q, , , , ,q0)
Where,
Q- set of finite states.
- set of input alphabets.
- set of output alphabets.
- set of input transition.
- set of output transition.
q0- initial states.

MVIT/DEPT. OF CSE Page 6


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

26) Construct a NFA with -moves when a regular expression is given: r =01/101?

Taking r =01,

r1=0 r2=1
0 1
q0 q1 q2 q3

r3=r1r2

q0 q1 q2 q3
0 1

Taking r=101,

r4=1 r5=0 r6=1


1 0 1
q4 q5 q6 q7 q8 q9

r7=r4r5r6

1 0 1
q4 q5 q6 q7 q8 q9

Now r=01/101

0 1
q0 q1 q2 q3
q10 q11

1 0 1

q4 q5 q6 q7 q8 q9

MVIT/DEPT. OF CSE Page 7


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

27) Explain finite automata with -moves ?


The „ ‟ is a character used to indicate the null string (i,e) the string which is used simply for
transition from one state to the other without any input . The NFA with -moves can be shown below:

a
q0 q2 q3
a b

q1

28) Explain the transition mapping regarding finite automata with -moves?

The transition mapping regarding finite automata with -moves is :


Q x ( { })  2^Q.

29) Give the transition mapping for moore and mealy machine?
For moore machine the transition mapping is:
:Q x  .
For mealy machine the transition mapping is:
:Q .

30) Define the rules for transition diagram?


Rules for drawing transition diagram are:
1. The transition diagram starts with a arrow pointer.
2. The initial state is being represented by a circle.
3. Each alphabet or symbol is being represented above the edge or arcs.
4. The final state is represented by concentric circle.

31) What is the transition mapping for NFA and DFA?


For NFA:
:Q x Q
For DFA:
:Q x Q‟ or 2^Q

MVIT/DEPT. OF CSE Page 8


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

32) Give an example for NFA? a


a b
a,b a,b
q0 q1 q2

33)Give an example for DFA?

a b b
b a
q0 q1 q2

34)Why are switching circuits called as finite state systems?


A switching circuit consists of a finite number of gates, each of which can be in any one of the two
conditions 0 or 1. Although the voltages assume infinite set of values, the electronic circuitry is designed so
that the voltages corresponding to 0 or 1 are stable and all others adjust to these values. Thus control unit of a
computer is a finite stat system.

35)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.

36)What are the applications of automata theory?


Some of the applications of automata theory are:
In complier 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 machine.

37)Define Finite Automaton(FA)


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 ∑. Finite automaton is denoted by a 5-tuple (Q, ∑, δ, q0, F), where
Q is the finite set of states,
∑ is the finite input alphabet,
δ is the transition mapping function,
q0 is the initial state.
F is the set of final state.

MVIT/DEPT. OF CSE Page 9


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

UNIT -II

1. What is meant by pumping lemma for regular language/regular set?

Let L be a regular set. Then there is a constant n such that if Z is any word in L, and |z|≥n. we may
write Z=uvw in such a way that |uv| ≤ n, |v| ≥ 1and for all L ≥0 then uv iw is in L.

2. What are the application of pumping lemma for regular set?

The applications of pumping lemma for regular set are:

The pumping lemma is a powerful tool providing and proving certain language is regular or not.
It is also useful in the development of algorithms to answer certain question concerning finite
automata, such as whether the language accepted by a given FA is finite or infinite.

3. What is homomorphisms?
A string homomorphism is a function on strings that works by substituting a particular string for
each symbol.
Example: The function h given by h(0) = abb and h(1) = ba is a homomorphism which replaces
each 0 by abb and each 1 by ba. Thus h(1011) = baabbbaba.

4. What is inverse homomorphisms?


Homomorphisms can also applied in reverse and in this mode they also preserve regular language.
That is, suppose h is a homomorphism from some alphabet ∑ to strings in another (possibly the same)
alphabet T-1. Let L be a language over alphabet T. Then h-1 is the set of strings w in ∑* such that h(w) is
in L.

5. Write the principal closure properties for regular language?


The principal closure properties for regular language are:
i. The union of two regular languages is regular.
ii. The intersection of two regular languages is regular.
iii. The complement of a regular language is regular.
iv. The difference of two regular languages is regular.

6. Write the closure properties of regular set under Boolean operations?


The first closure properties are the three Boolean operations: Union, Intersection, and
Complementation:
i. Let L and M be language over alphabet ∑. Then LUM is the language that contains all
strings that are in either or both of L and M.
ii. Let L and M be language over alphabet ∑. Then L∩M is the language that contains all
strings that are in both of L and M.
iii. Let L be a language over alphabet ∑. Then , the complement of L, is the set of strings in
∑* that are not in L.

MVIT/DEPT. OF CSE Page 10


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

7. What is reversal?
The reversal of a string a1a2...anis the string written backwards, that is, a nan-1…a1. We use wR for
the reversal of string w. thus, 0010R is 0100, and ЄR = Є. The reversal of language L, written LR, is the
language consisting of the reversals of all its strings. For instances, if L ={001, 10, 111}, then L R
={100,01,111}.

8. What is meant by minimization of DFA?


For each DFA we can find an equivalent DFA that has a few states as any DFA accepting the same
language. Moreover, except for our ability to call the states by whatever names we choose, this minimum-
state DFA is unique for the language. The algorithm is as follows:
a. First, eliminate any state that cannot be reached from the start state.
b. Then, partition the remaining states into blocks, so that all states in the same block are equivalent,
and no pair of states from different blocks are equivalent.

9. What is meant by minimizing the states of an NFA?


We all may think that the same state-partition technique that minimizes the states of a DFA could
also be used to find a minimum-state NFA equivalent to a given NFA or DFA. We can do it, by a process
of exhaustive enumeration, find an NFA with as few states as possible accepting a given regular language,
we cannot simply group the states of some given NFA for the language.

10. Verify the language Lpal of palindromes of 0’s and 1’s is regular language or not?
To verify this we use pumping lemma. If L pal is a regular language, let n be the associated constant,
and consider the palindrome w =0 n10n. If Lpal is regular, then we can break w into w = xyz, such that y
consist of one or more 0‟s from the first group. Thus, xz, which would also have to be Lpal if Lpal were
regular, would have fewer 0‟s to the left of the lone 1 than there are to the right of the 1. Therefore xz
cannot be a palindrome. So we have now contradicted the assumption that L pal is a regular language.

11. What is meant by Context-Free Grammar(CFG)?


A CFG is a way of describing languages by recursive rules called productions. A CFG consists of
a set of variables, a set of terminal symbols, and a start variable, as well as the productions. Each
production consists of a head variable and a body consisting of a string of zero or more variables and/or
terminals.

12. Write down the components of CFG?


There are four components present in CFG, or just grammar. We shall represent a CFG G by its
four components, that is, G=(V,T,P,S), where V is the set of variables, T the terminals, P the set of
productions, and S the start symbol.

MVIT/DEPT. OF CSE Page 11


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

13. What is derivation?


Beginning with the start symbol, we derive terminal strings by repeatedly replacing a variable by
the body of some production with that variable in the head. The language of the CFG is the set of terminal
strings we can so drive; it is called a context-free language.

14. What is meant by leftmost derivation and rightmost derivation?


At each step when the leftmost variable is replaced by one of its bodies then it is called leftmost

derivation. It is denoted by . At each step when the rightmost variable is replaced by one of its bodies

then it is called rightmost derivation. It is denoted by .

15. Write about sentential form?


Derivations from the start symbol produce strings tht have a special role. We call these “sentential
forms”. That is, if G=(V,T,P,S) is a CFG, then any string α in (V U T)* such that S ==> α is a sentential

form. If S α, then α is left-sentential form, and if

S α, then α is a right-sentential form.

16. What is meant by parse tree?


The parse tree is a tree that shows the essentials of a derivation. Interior nodes are labeled by
variables, and leaves are labeled by terminals or Є. For each internal node, there must be a production
such that the head of the production is the label of the node, and the labels of its children, read from right
to left, from the body of that production.

17. What are the conditions to construct the parse tree?


The condition to construct parse tree are:
a. Each interior node is labeled by a variable in V.
b. Each leaf is labeled by either a variable, a terminal, or Є. However, if the leaf is labeled Є, then it
must be the only child of its parent.
c. If an interior node is labeled A, and its children are labeled X 1,X2,…,Xn respectively, from the left,
then A  X1,X2,…,Xn is a production in P. Note that the only time one of the X‟s can be Є is if
that is the label of the only child, and A Є is a production of G.

18. What are the applications of context free language?


Context free languages are used in:
a. Defining programming languages.
b. Formalizing the notation of parsing.
c. Translation of programming languages.
d. String processing applications.

MVIT/DEPT. OF CSE Page 12


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

19. What are the uses of context free grammars?


a. Construction of compliers.
b. Simplified the definition of programming languages.
c. Describes the arithmetic expressions with arbitrary nesting of balanced parenthesis {(, )}.
d. Describes block structure in programming languages.
e. Model neural nets.

20. 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
set.
 P is a finite set of productions each is of the form A∑ where A is a variable and
∑ is the string of symbols from (V U T) *.
 S is the start symbol.

21. What is the language generated by CFG or G?

The language generated by G(L(G)) is {w in T* | S w}. That is a string is in L(G) if:


i. The string consists solely of terminals.
ii. The string can be derived from S.

22. What is meant by ambiguous grammars?


For some CFG‟s, it is possible to find a terminal string with more than one parse tree, or
equivalently, more than one leftmost derivation or more than one rightmost derivation. Such a grammar is
called ambiguous grammar.

23. What is meant by unambiguous?


For some CFG‟s, it is possible to find a terminal string with at most one parse tree, or equivalently,
at most one leftmost derivation or at most one rightmost derivation. Such a grammar is called ambiguous
grammar.

24. State Chomsky normal form?


A context-free grammar “G” is in CNF if every production is of the form Aa (Non-Terminal
Terminal) or ABC (Non-Terminal Non-Terminal*Non-Terminal) is in G. For example consider “G”
whose production are SAB, Aa, Bb. The G is in Chomsky normal form.

25. State Greibach normal form?


A context-free grammar “G” is in GNF if every production is of the form Aaα and Aa where
α Є VN* and aЄ∑. Non-TerminalTerminal. Any number of Non-Terminal. For example: SaAB,
Abc , Bb, Cc is in GNF.

MVIT/DEPT. OF CSE Page 13


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

26. What is meant by parsers?


The CFG is an essential concept for the implementation of compilers and other programming-
language processors. Tools such as YACC take a CFG as input and produce a parser, the component of a
complier that deduces the structure of the program being complied.

27. What is meant by equivalence of parse trees and derivation?


A terminal string is in the language of a grammar if and only if it is the yield of at least one parse
tree. Thus, the existence of leftmost derivation, rightmost derivation, and parse trees are equivalent
conditions that each define exactly the strings in the language of a CFG.

28. What is meant by inherent ambiguity?


A context-free language L is said to be inherent ambiguous if all its grammars are ambiguous. If
even one grammar for L is unambiguous, then L is an unambiguous language.

29. What is meant by eliminating ambiguity?


For many useful grammars, such as those that describe the structure of programs in a typical
programming language, it is possible to find an unambiguous grammar that generates the same language.
Unfortunately, the unambiguous grammar is frequently more complex than the simplest ambiguous
grammar for the language. There are also some context-free languages, usually quite contrived, that are
inherently ambiguous, meaning that every grammar for that language is ambiguous.

30. What is yield of a parse tree?


If we look at the leaves of any parse tree and concatenate them from the left, we get a string, called
the yield of the tree, which is always a string that is derived from the root variable. The fact that the yield
is derived from the root will be proved shortly. Of special importance are those parse tree such that:
a. The yield is a terminal string. That is, all leaves are labeled either with a terminal or with ε.
b. The root is labeled by the start symbol.

31. What is meant by language of a grammar?


If G (V,T,P,S) is a CFG, the language of G, denoted L(G), is the set of terminal strings that have
derivations from the start symbol.

L(G)={w in T* | S w}
If a language L is the language of some context-free grammar, then L is said to be a CFL.
32. What are the notation for CFG derivation?
There are a number of conventions in common use that help us remember the role of the symbols we use
when discussing CFG‟s. Here are the conventions we shall use:
a. Lower-case letters like a, b are called terminal symbols.
b. Upper-case letters like A, B are variables.
c. Lower-case letter near the end of the alphabet are string of terminals.
d. Upper-case letters near the end of the alphabet are either terminals or variables.
e. Lower-case Greek letters are strings consisting of terminals and/or variables.

MVIT/DEPT. OF CSE Page 14


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

33. The following grammar generates the grammar of the language consisting of all strings of even
length:
S→AS|ε
A→ aa|ab|ba|bb
Give leftmost and rightmost derivations for the following strings:
aabbba
Solution:

Leftmost derivation:
S AS
 aaS
 aaAS
 aabbAS
 aabbbaS
 aabbba

Rightmost derivation:

SAS
AAS
AAAS
AAA
AAba
Abbba
aabbba

34. Prove whether {0n | n is a power of 2} is regular set or not?


L={0n, n is a power of 2}
L={00,0000,00000000, …}
CASE 1:
Consider z= 00
Here u=0, w=0, V=ε
V must not have ε value.
CASE 2:
Consider z= 0000
Here u=0, w=0 and v=00
|uv|≤n

MVIT/DEPT. OF CSE Page 15


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

3≤4
|v|≥1
 uviw
= 0(00)i0
When i=1
=0(00)10
=0000
When i=2
=0(00)20
=000000
Thus the string 000000 is not present in the set so it is not a regular set.

35. Prove whether {0n1n | n ≥ 1} is regular set or not?


L={0n1n, n≥1}
L={01,0011,000111, …}
CASE 1:
Consider z= 01
Here u=0, w=1, V=ε
V must not have ε value.
CASE 2:
Consider z= 0011
Here u=0, w=1 and v=01
|uv|≤n
3≤4
|v|≥1
 uviw
= 0(01)i1
When i=1
=0(01)11
=0011
When i=2
=0(01)21
=001011

MVIT/DEPT. OF CSE Page 16


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

Thus the string 001011 is not present in the set so it is not a regular set.

36. Prove whether {0n10n | n ≥ 1} is regular set or not?


L={0n10n, n≥1}
L={010,00100,0001000, …}
CASE 1:
Consider z= 010
Here u=0, w=0, V=1
|uv|≤n
2≤3
|v|≥1
 uviw
= 0(1)i0
When i=1
=0(1)10
=010
When i=2
=0(1)20
=0110
Thus the string 0110 is not present in the set so it is not a regular set.

37. Prove whether {01n1| n ≥ 1} is regular set or not?


L={01n1, n≥1}
L={011,0111,01111, …}
CASE 1:
Consider z= 011
Here u=0, w=1, V=1
|uv|≤n
2≤3
|v|≥1
 uviw
= 0(1)i1
When i=1
=0(1)11
MVIT/DEPT. OF CSE Page 17
AUTOMATA LANGUAGE AND COMPUTATION 2 marks

=011
When i=2
=0(1)21
=0111

Thus the string 0111 is present in the set so it is a regular set or regular language.

38. What is the language generated by the grammar G=(V,T,P,S) where P={S->aSb,
a. S->ab}?

S==> aSb
==>aaSbb
==>aaabbb
i.e the general form is anbn
Thus the language L(G)={ anbn | n>=1}. The language has strings with equal number of a‟s
and b‟s.

39. What are the three ways to simplify a context free grammar?
a. By removing the useless symbols from the set of productions.
b. By eliminating the empty productions.
c. By eliminating the unit productions.

40. 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.

41. Find the grammar for the language L={ a2nbc, where n>1 }
Let G=( {S,A,B}, {a,b,c}, P, {S} ) where P:
SAbc
AaaA

42. Find the language generated by :S0S1 | 0A | 0 | 1B | 1 ; A0A | 0; B1B | 1


The minimum string is S0 |1
S0S1 =>001
S0S1 =>011
S0S1 =>00S11 =>000S111 =>0000A111 =>00000111
Thus L= {0n 1m | m not equal to n, and n,m>=1}

MVIT/DEPT. OF CSE Page 18


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

43. Differentiate sentences Vs sentential forms


Sentences Sentential forms

A sentence is a string of terminal A sentential form is a string


symbols. containing a mix of variables and
terminal symbols or all variables.
This is an intermediate form in
doing a derivation.

44. What is BNF?


a. BNF stands for Backus-Naur Form.
i. 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.

MVIT/DEPT. OF CSE Page 19


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

UNIT – III

1. What is Push down automata?


Push down automata is mainly used to recognize the CFL. It is named as Push down automata
because it makes use of stack as Push down list. Here stack acts as Cache memory and Auxiliary memory.

2. Define Push down automata.


The Push down automata (M) are
M= {Q, Σ, δ, Γ, q0, z0, F)
where,
Q  Finite set of states.

Σ  Finite set of input symbols.

δ  Set of Transitions.

Γ  Finite set of stack symbols.

q0Initial state.

z0Top of the stack.

F  Set of Final state.

3. Explain the transition mapping of PDA.

The transition mapping for PDA can be given as

Q * (Σ U e) * Γ  Q* Γ*

where Γ is a finite set of stack symbols and Γ* consist of stack symbols with z0.

4. Why there is a need for stack in PDA?


In PDA stack acts as Cash memory and Auxiliary memory. Cash memory is used to store the
frequently accessing data and the data can be retrieved as fast as possible. If there is no enough space in
input tape then the data can be stored in external memory.

5. What are the additional features of PDA has when compared with NFA?
In PDA we use push down list called stack which is not used in NFA. Also we use cache memory and
auxiliary memory which is not present in NFA. We have 7 tuples in PDA they are M= {Q, Σ, δ, Γ, q0, z0,
F)
The additional 2 tuples which are present in PDA and not in NFA are Γ and Z 0.

MVIT/DEPT. OF CSE Page 20


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

6. Write down the application of Pumping lemma for CFL?


The applications of pumping lemma for CFL are
To check whether the given language is CFL or not.
To check whether the given string is finite or infinite

7. Define Top-down parsing?


Top-down parsing is a methodology in which we construct the derivation tree or
parse tree starting from root node to the leaf node. Top-down parsing can be viewed as an attempt to find
a left most derivation for an input string which is left sentential forms.

8. Define Bottom-up parsing?


Bottom-up parsing is a methodology in which we construct the derivation tree or parse tree starting
from leaf node to the root node. In Bottom-up parsing we use reverse of right most derivation which is
right sentential forms.

9. Define handle and handle pruning?


When the right side of the production can be replaced by the left hand side of the production then
the left part is known as handle. The methodology by which we replace is known as handle pruning.
Handle pruning is also called as right sentential form. Right sentential form example:
id+id*id
→E+id*i
→E+E*id
→E*id
→E*E
→E
It is the reverse of right derivation.

10. Explain the actions used in Bottom up parsing.


The actions used in Bottom up parsing are:
a) Shift
b) Reduce
c) Accept
d) Error
Shift: Shifting action is that we shift the symbol from input tape to the stack.
Reduce: If handle is present at the top of the stack then it is replace by the left hand side of the
derivation. This action is known as reduce.
Accept: When the $ symbol encounter then the input string is accepted.
Error: If $ symbol does not encounter then it leads to error.

MVIT/DEPT. OF CSE Page 21


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

11. State decision algorithm


Decision algorithm for CFL is mainly to check the string generated by a language is empty, finite
and infinite.

12. State the relationship between derivation and derivation tree.


Let G be the context free grammar indicated by G= {V, T, P, S} then S => α if only if there is a
derivation tree in G.

13. Write down the assumptions involved in decision algorithm.


The assumptions involved in decision algorithm are:
Production must be in CNF.
Production must not contain any ø production.
Let S be the starting symbol then rank of S is r then we cannot produce a string of length greater
than 2r. i.e. l ≤ 2r.
The other non-terminals must have rank lesser than r. i.e. the rank must be r-1,
r-2 etc.,

14. How to eliminate the left recursive patterns?


When the given production is of the format A→Aα/β then left recursive occurs. To eliminate the
left recursive we must introduce two new production which is of the form A→βA‟ and A‟→αA‟/ε.
For example:
Given production are E→E+T/T
This production is of the form A→Aα/β
where A= E, α= +T, β=T
Now the production will change to
E→TE‟
E‟→+TE‟/ε.

15. State the “pumping lemma for context-free languages”.


Let L be a CFL. Then there exists a constant n such that if z is any string in L such that |z| is at
least n, then we can write z=uvwxy, subject to the following conditions:
1. |vwx|<=n. That is, the middle portion is not too long.
2. |vx|>=1 . Since v and x are the pieces to be “pumped”, this condition says that at least one of
the string we pump must not be empty.
3. For all i>=0, uviwxiy is in L. That is, the two strings v and x may be “pumped” any number of
times, including 0, and the resulting string will still be a member of L.
16. What are the conditions to select a sub tree in Pumping lemma for CFL?
The conditions to select a sub tree in Pumping Lemma for CFL are
1. The two vertices of the sub tree must be very close to each other at the bottom of the tree.
2. The root of the sub tree must be very close to the root of the tree but it should not be the root.

MVIT/DEPT. OF CSE Page 22


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

17. When the pumping lemma is generally used?


The pumping lemma for CFL is used to check whether the given language is CFL or not and to
determine whether the string generated by the CFL is finite or not.

18. Define ambiguous and unambiguous grammar.


An ambiguous grammar is a one which has more than one derivation tree whereas unambiguous
grammar refers to the grammar with exactly one derivation tree.

19. Define directed acyclic graph.


A directed acyclic graph is a directed graph which has no cycles in it.
Example:

B C

This directed graph can be called as a directed acyclic graph since it has no cycles in it.

20. What is mean by left recursion?


Left recursion is the major drawback of the top down parsing. A production is said to be left
recursive if it is of the form A->αA/β. The left recursion can be eliminated by producing two productions
of the form A->βA‟ and A‟->αA‟/ε.

21. State the closure properties of CFL.


The closure properties of CFL are
CFL‟s are closed under union, concatenation and Kleene closure.
CFL‟s are closed under homomorphism
CFL‟s are closed under substitutions
If L is a CFL and R is a regular language then, L/\R is a CFL.
CFL‟s are not closed under intersection
CFL‟s are closed under complementation.

MVIT/DEPT. OF CSE Page 23


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

22. Give an example for PDA.

STEP 1:

¢ a a b b $

F.C

a
Z0
Transition mapping : δ(q0,a, Z0) = (q1, aZ0)

STEP 2:

¢ a a b b $

F.C
a
a
Z0
Transition mapping : δ(q1,a, a) = (q2, aaZ0)

STEP 3:

¢ a a b b $

F.C

a
a
Z0
Transition mapping: δ(q2,b, a) = (q3, aZ0)

MVIT/DEPT. OF CSE Page 24


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

STEP 4:

¢ a a b b $

F.C

a
Z0

Transition mapping: δ(q3,b, , Z0 ) =(q4,Z0)

23. Consider G whose productions are SaAS |a , ASbA| SS |ba ,Show that S => aabbaa and
construct a derivation tree.

The derivation for aabbaa can be given as follows.

S  aAS
aSbAS
aabAS
 aabbaS
 aabbaa

The derivation tree for the above derivation is as follows :

a A S

S b A a

a b a

MVIT/DEPT. OF CSE Page 25


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

24. Explain the shit reduce parser for id1*id2 with actions if EE+E , EE*E, E(E), Eid.
Input string Stack Diagram Action

id1*id2 $ Start

*id2 id1 Shift


id1

*id2 E Reduce
E

id2 E* Shift
*
E

$ E*id2 Shift
id2
*
E

$ E*E Reduce
E
*
E

$ E Reduce
E

$ E Accept
E

MVIT/DEPT. OF CSE Page 26


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

25. Whether id1 – id2 is accepted by the shift reduce parser? Justify.

Input string Stack Diagram Action

id1 - id2 $ Start

-id2 id1 Shift


id1

-id2 E Reduce
E

id2 E- Shift
-
E

$ E-id2 Shift
id2
-
E

$ E-E Reduce
E
-
E

$ E-E Error
E
-
E

26. In a production if A is the start symbol with rank zero then show that the length of the string is
finite.
Consider the production Aa,
The directed acyclic graph for above production can be given as,

MVIT/DEPT. OF CSE Page 27


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

By the assumption of Decision algorithm , a non terminal with rank r cannot generate a string of length
greater than 2r ,

Here r = 0,

l ≤ 2r

l ≤ 20

l≤1

Hence it is proved with string of length 1 which is finite.

27. What is the Equivalence of PDA’s and CFG’s.


The languages defined by PDA‟s are exactly the context-free languages. The equivalence is given as
1. The context-free languages, i.e the languages defined by CFG‟s.
2. The languages that are accepted by final state by some PDA.
3. The languages that are accepted by empty stack by some PDA.
are all same class. This can be given as

Grammar PDA by PDA by


empty stack final state

28. Consider the grammar with productions S AB, AB, Bb. whether the length of the string
generated by the grammar is finite or infinite. Justify.

The given productions are,

S AB

AB

Bb

The directed graph for the above production can be given as

A B

MVIT/DEPT. OF CSE Page 28


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

The graph does not contain any cycles. Hence the length of the string produced by the grammar is
finite. This can also be proved by the assumption of Decision algorithm,

A non terminal with rank r cannot generate a string of length greater than 2 r ,

Here r = 2 for the non terminal S,

l ≤ 2r

l ≤ 22

l ≤ 4 which is finte.

29. Compare NFA and PDA.


NFA PDA

The language accepted by NFA is the The language accepted by PDA is context
regular language. free language.

NFA has no memory. PDA is essentially an NFA with a


stack(memory).

It can store only limited amount of It stores unbounded limit of information


information.
A language/string is accepted only by It accepts a language either by empty stack
reaching the final state. or by reaching a final state.

30. Specify the two types of moves in PDA?


The moves dependent on the input symbol(a) scanned is:
δ (q,a,Z) = {(p1,aZ1), (p2,aZ2),………… (pm,aZm)}
where q and p are states, a is in ∑, Z is a stack symbol and ∑i is in Γ*. PDA is in state q,
with input symbol a and Z the top symbol on state enter state p i replace symbol Z by string ∑i.
The moves dependent on the input symbol is (ε-move)
δ (q,ε,Z) = {(p1,Z1), (p2,Z2),………… (pm,Zm)}
Is that PDA is in state q, independent of input symbol being scanned and with Z the top
symbol on the stack enter a state pi replace symbol Z by string ∑i.

31. What are the different types of language acceptances by a PDA.


There are 4 types of language acceptances of a PDA. They are
Acceptance by final state
Acceptance by empty state
From empty to final state
From final state to empty state.

MVIT/DEPT. OF CSE Page 29


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

32. Define acceptance by final state.


Let P = {Q, Σ, δ, Γ, q0, z0, F} be a PDA. Then L(P), the language accepted by P by final state, is
{ w | (q0,w,z0) ├*p (q,ε,α)}

For some state q in F and any state string α. That is, starting in the initial ID with w waiting on the
input, P consumes w from the input and enters an accepting state. The contents of the stack at that time is
irrelevant.
33. Define acceptance by empty stack.
For each PDA P= {Q, Σ, δ, Γ, q0, z0, F}, we also define

N(P) = { w | (q0,w,z0) ├* (q,ε,ε)}

For any state q. That is, N(P) is the set of input w that P can consume and at the same tme
empty its stack.

34. 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 language accepted by
PDA‟s empty stack.

35. When is a string accepted by a PDA?


The input string is accepted by the PDA if:
The final state is reached.
The stack is empty.

36. What is the significance of PDA?


Finite automata is used to model regular expression and cannot be used to represent non regular
languages. Thus to model a context free language, a push down automata is used.

37. How we can represent the configuration of a PDA?


We can represent the configuration of PDA by triple (q, w, γ), where
q is the state,
w is the remaining input
γ is the stack contents
38. Define Instantaneous description in PDA.
ID describe the configuration of a PDA at a given instant. ID is a triple such as (q, w, γ), where
q is the state,
w is the remaining input
γ is the stack contents
If P = {Q, Σ, δ, Γ, q0, z0, F} is a PDA we say that
(q, aw, Z) ├p (p, w, αβ) if δ(q, a, Z) contains (p, α)
Example: (q1, BG) is in δ (q,0,G) tells that (q1, 011,GGR) ├ (q1,11,BGGR).

MVIT/DEPT. OF CSE Page 30


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

39. What are the components of Pushdown Automata?


The PDA usually consists of four components:
A control unit
Read unit
Input tape
Memory unit

40. Compare NPDA and DPDA.

NPDA DPDA

NPDA is the standard PDA used in The standard PDA in practical situation is
automata theory. DPDA.

Every PDA is NPDA unless otherwise The PDA is deterministic in the sense, that
specified. at most one move is possible from any ID.

MVIT/DEPT. OF CSE Page 31


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

UNIT-IV

1. What is the difference between the Turing machine and the Finite automata?
Finite automata Turing machine

Here the input tape is closed at both the Here the input tape is infinite at one end
ends. either at the left or at right usually at the
right side.

The reading pointer moves only one side. Here the read/write head pointer moves to
right or left or stay at a square after a
read/write.

2. What are the components of Turing machine?


The components of Turing machine are:
finite control
an input tape
a tape head

3. How many tuples are in the Turing machine? What are they?
Formally a Turing machine(TM) is denoted

M = (Q,∑,┌,§,q0,B,F),

Where

Q is the finite set of states,

┌ is the finite set of allowable tape symbols,

B a symbol of┌ ,is the blank,

∑ a subset of┌ not including B, is the set if input symbols,

§ is the next move function, a mapping from Q×┌×{L,R},

q0 in Q is the start state,

F€Q is the set of final states.

MVIT/DEPT. OF CSE Page 32


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

4. What is computational function?

* *
Let S and let f be a function f : S -> . Then we say T computes f or f is computable

if for every x S,

* *
(q0, x) (h, f(x)) and for every x that is not in S, T does not halt on x.

5. What do you meant by “Acceptance of Turing Machine”?


In the Turing machines there are two halt states: "accept halt" and "reject halt". A string is accepted
by a Turing machine if given the string, the Turing machine eventually goes into the accept halt state. A
language is a phrase structure (type 0) language if and only if it is Turing-acceptable in either sense and it
has no effects on decidability.

6. What are the different types of Turing machine?


Turing Machines with Two Dimensional Tapes
Turing Machine with One Dimensional Tape
Turing Machines with Multiple Tapes
Turing Machines with Multiple Heads
Turing Machines with Infinite Tape
Nondeterministic Turing Machines

7. What is Turing machine with two dimensional tapes?


This is a kind of Turing machines that have one finite control, one read-write head and one two
dimensional tape. The tape has the top end and the left end but extends indefinitely to the right and down.
It is divided into rows of small squares.

8. What is Turing machine with one dimensional tape?


For any Turing machine of this type there is a Turing machine with a one dimensional tape that is
equally powerful, that is, the former can be simulated by the latter.
One Dimensional Tape

v 1 v 2 3 h 4 5 6 v 7 8 9
10 h 11 ... ...

9. What is Turing machine with multiple heads?


A k-head turing machine has some fixed number, k, of heads. The heads are numbered 1 through
k, and a move of the TM depends on the state and on the symbol scanned by each head. In one move , the
heads may each move independent left, right, or remain stationary.

MVIT/DEPT. OF CSE Page 33


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

10. What is Turing machine with multiple tapes?


A multitape turing machine consists of a finite control with k tape heads and k tapes; each tape is
infinite in both directions. On a single move, depending on the state of the finite control and the symbol
scanned by each of the tape heads, the machine can:

1) Change state

2) Prints a new symbol on each of the cells scanned by its tape heads;

3) Move each of its tape heads, independently, one cell to the left , or right, or keep it stationary.

Initially the input appears on the first tape, and the other tapes are blank.

11. What is Turing machine with infinite tape?


In case of a Turing machine the input tape is infinite at one end either at the left or at the right
usually the right is called a Turing machine with infinite tape.

12. What is Non-deterministic Turing machine?


A Nondeterministic turing machine is a device with a finite control and a single , one way infinite
tape. For a given state and tape symbol scanned by the tape head, the machine has a finite number of
choices for the next move. Each choice consists of a new state, a tape aymbol to print and a direction of
head motion.

13. What is a recursive algorithm?


A recursive algorithm is an algorithm applied to an problem then it can be solved or decidable. The
problem that can be solved by applying an algorithm is called recursive algorithm.

14. What is recursive enumerable language?


Recursive enumerable language is a set of language or a set of problems that can be solved or
decided.

15. What is meant by Off-line Turing machines?


An off-line Turing machine is a multitape turing machine whose input tape is read only. The input
is surrounded by end markers ,¢ on the left and $ on the right.The Turing machine is not allowed to move
the input tape head off the region between ¢ and $.The off-line Turing machine copy its own input onto
the extra tape, and it then simulates M as if the extra tape were M‟s input.

16. What is semi infinite tape?


In case of a Turing machine one side of the input tape is infinite hence it is called as the semi
infinite tape.

MVIT/DEPT. OF CSE Page 34


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

17. What is the difference between Semi infinite and two way infinite tapes?

Semi infinite tape Two way infinite tape

In case of semi infinite tape TM only one side In case of two way infinite tape both the sides
of the input tape is infinite. of the input tape is infinite.

The head pointer moves only to the infinite Here the head pointer moves in both sides
side of the input tape. infinitely.

18. What are the uses of checking of symbol?


Checking off symbols is a useful trick for visualizing how a TM recognizes languages defined by
repeated strings, such as

{ww|w in ∑*}, {wcy|w and y in ∑ *,w≠y} or {wwR |w in ∑ *}.

It is also useful when lengths of substrings must be compared , such as in the languages

{ai bi|i>=1} or{aibick|i≠j or j≠k}.

We extract an extra track on the tape that holds a blank or √. The √ appears when the symbol
below it has been considered by the TM in one of its comparisons.

19. Write about the storage in the Finite control?


The finite control can be used to hold a finite amount of information. The state is written as a pair
of elements,one exercising control and the other storing a symbol.It should be emphasized that this
arrangement is for conceptual purposes only. No modification in the definition of the Turing Machine has
been made.
20. Write about shifting over in the turing machine?
A Turing machine can make space on its tape by shifting all nonblank symbols a finite number of
cells to the right . The tape head makes an excursion to the right ,repeatedly storing the symbols read in its
finite control and replacing them with symbols read from cells to the left.The TM can return to the vacated
cells and print symbols of its choosing .If space is available ,it can push block of symbols left in a similar
manner.

21. What is a turing machine?


Turing machine is a simple mathematical model of a computer. TM has unlimited
and unrestricted memory and is a much more accurate model of a general purpose computer. The turing
machine is a FA with a R/W Head. It has an infinite tape divided into cells ,each cell holding one symbol.

MVIT/DEPT. OF CSE Page 35


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

22. Define Instantaneous description of TM.


The ID of a TM M is denoted as |--*1q2. Here q is the current state of M is in Q;
1 2 is the string in ∑* that is the contents of the tape up to the rightmost nonblank symbol or the symbol
to the left of the head, whichever is the rightmost.

23. What are the applications of TM?


TM can be used as:
Recognizers of languages.
Computers of functions on non negative integers.
Generating devices.

24. What is the basic difference between 2-way FA and TM?


Turing machine Two way finite automata

Turing machine can change symbols on its FA cannot change


tape.
symbols on tape.

TM has a tape head that moves both left FA doesn‟t have such a tape head.
and right side

TM has infinite input tape Input tape is finite in FA

25. What is (a)total recursive function and (b)partial recursive function


If f(i1,i2,………ik) is defined for all i1,…..ik then we say f is a total recursive function. They are
similar to recursive languages as they are computed by TM that always halt.

A function f(i1,…ik) computed by a Turing machine is called a partial recursive function. They
are similar to r.e languages as they are computed by TM that may or may not halt on a given input.

26. Define a move in TM.


Let X1 X2…X i-1 q Xi…Xn be an ID.
The left move is: if _ (q, Xi )= (p, Y,L) ,if i>1 then
X1 X2…X i-1 q Xi…Xn |---- X1X2… X i-2 p X i-1 Y X i+1…Xn.
M
The right move is if _ (q, Xi )= (p, Y,R) ,if i>1 then
X1 X2…X i-1 q Xi…Xn |---- X1X2… X i-1Y p X i+1…Xn. M
27. What is the language accepted by TM?
The language accepted by M is L(M) , is the set of words in ∑ * that cause M to
enter a final state when placed ,justified at the left on the tape of M, with M at qo and the tape head of M
at the leftmost cell. The language accepted by M is:

{ w | w in ∑ * and q0w |--- α pβ for some p in F and α, β is in ∑ * }.

MVIT/DEPT. OF CSE Page 36


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

28. Give examples of total recursive functions.


All common arithmetic functions on integers such as multiplication , n!, [log2n] and 22n are total
recursive functions.

29. What are(a) recursively enumerable languages (b) recursive sets?


The languages that is accepted by TM is said to be recursively enumerable (r. e ) languages.
Enumerable means that the strings in the language can be enumerated by the TM. The class of r. e
languages include CFL‟s.

The recursive sets include languages accepted by at least one TM that halts on all inputs.

30. What are the various representation of TM?


We can describe TM using:
Instantaneous description.
Transition table.
Transition diagram.

31. What are the possibilities of a TM when processing an input string?


TM can accept the string by entering accepting state.
It can reject the string by entering non-accepting state.
It can enter an infinite loop so that it never halts.

32. What are the techniques for Turing machine construction?


Storage in finite control.
Multiple tracks.
Checking off symbols.
Shifting over
Subroutines.

33. Differentiate PDA and TM.


PDA TM

1. PDA uses a stack for storage. 1. TM uses a tape that is infinite .

2.The language accepted by PDA is CFL. 2. Tm recognizes recursively enumerable


languages.

34. How can a TM used as a transducer?


A TM can be used as a transducer. The most obvious way to do this is to treat the entire nonblank
portion of the initial tape as input , and to treat the entire blank portion of the tape when the machine halts
as output. Or a TM defines a function y=f(x) for strings x ,y _ _* if: q0X | --- qfY, where qf is the final
state.
MVIT/DEPT. OF CSE Page 37
AUTOMATA LANGUAGE AND COMPUTATION 2 marks

35. What is a multidimensional TM?


The device has a finite control , but the tape consists 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 apehead in one of the 2k directions, either positively or negatively
,along one of the k-axes.

36. When a recursively enumerable language is said to be recursive ? Is it true that the language
accepted by a non-deterministic Turing machine is different from recursively enumerable
language?
A language L is recursively enumerable if there is a TM that accepts L and recursive if here is a
TM that recognizes L. Thus r.e language is Turing acceptable and recursive language is Turing decidable
languages.

No , the language accepted by non-deterministic Turing machine is same as recursively


enumerable language.

37. What is Church’s Hypothesis?


The notion of computable function can be identified with the class of partial recursive functions is
known as Church-hypothesis or Church-Turing thesis. The Turing machine is equivalent in computing
power to the digital computer.

MVIT/DEPT. OF CSE Page 38


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

UNIT-V

1. What is computational complexity?


A computational complexity is based on the amount of time, space, or other resource needed to
recognize a language on some universal computing device such a Turing Machine.

2. What are the complexity of classes?

DSPACE(S(n)) = determinastic Space complexity(S(n))

NSPACE(S(n)) = nondeterminastic Space complexity(S(n))

DTIME(T(n)) = determinastic Timecomplexity(T(n))

NTIME(T(n)) = nondeterminastic Timecomplexity(T(n))

3. Define Time Complexity.


For every input word of length n, M (Turing machine) makes at most T(n) moves before halting,
then M is said to be a T(n) time-bounded Turing machine, or of time complexity T(n). The language
recognized by M is said to be of time complexity T(n).

4. Define Space Complexity.


For every input word of length n, M (Turing machine) scans at most S(n) cells on any storage tape,
then M is said to be an S(n) space-bounded Turing machine or of space complexity S(n). The language
recognized by M is said to be of Space complexity S(n).

5. Define Growth Rate of Functions.


When we have two algorithm for the same problem, we may require a comparison between the
running time of these two algorithms. With this in mind, we study the growth rate of functions defined on
the set of natural numbers.

6. Briefly explain f(n)=O(g(n)) Or State the condition under which f(n)=O(g(n)).


Let f , g: N->R+
(R+ being the set of all positive real numbers.) We say that f(n)=O(g(n)) if there exists positive integer C
and No such that
F(n)<C g(n) for all n>No. In these case we say “f” is the order of g.
f(n)=O(g(n)) it expresses a relation between two functions f and g.

MVIT/DEPT. OF CSE Page 39


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

7. Compare the Growth Rate of Polynomial Function with Exponential Function.

n f(n)=n^2 g(n)=n^2 +3n+9 q(n)=2^n

1 1 13 2

5 25 49 32

1000 1000000 1003009 1.07*10^301

From the table, it is easy to say that the function q(n) grows at a very fast rate when compared to f(n) or
g(n). Hence Exponential function grows at very faster rate when n value increase and polynomial function
grows at lesser rate when n value increases.

8. Define Travelling Salesman Problem.


The Travelling Salesman Problem(TSP) is a problem which contain a list of cities and their
pairwise distances, the task is to find a shortest possible tour that visits each city exactly once.

9. Define Hamiltonaian path or Traceable path.


A Hamiltonian path or Traceable path defines in a directed graph G is a directed path that goes
through each node exactly once.

10. Define Hamiltonian Cycle or Hamiltonian Circuit and give an example.


A Hamiltonian cycle (or Hamiltonian circuit) is a cycle in an undirected graph which visits each
vertex exactly once and also retuns to the starting vertex.
Example:
A complete graph with more than two vertices is Hamiltonain
Every cycle graph is Hamiltonian.

11. Define NP-completeness and give an example.


If the problem may or may not exists a solution then it is called NP-Complete. In other word, A
language B in NP- complete if it satisfies two conditions:
B is in NP, and
Every A in NP is polynomial time reducible to B.

Examples: Boolean satisfiablity problem, Knapsack problem, Hamiltonian path problem.

12 Define Horn-satisfiability.
A clause is Horn if it contains at most one positive literal. This clauses are able to express
implication of on variable from a set of other variables.

Example: If the set of all values are true then Y needs to be true .

MVIT/DEPT. OF CSE Page 40


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

13 Define NP-hardness.
If the problem as a complete set of solution then it is called NP-hard.

14 What is clique problem and give an example graph?


A clique in an undirected graph is a subgraph wherein every two nodes are connected by an edge.
A k-clique is a clique that contains K nodes.

A graph with a 5-clique

15 What is Bollean satisfiablity problem?


Bollean satisfiablity problem is a decision problem, whose instance is a Boolean expression
written using only AND, OR, NOT, variables, and paranthesies.

16 Define class NP ?
A language L is in the class NP (Nondeterministic polynomial) if there is a nondeterministic TM
M and a polynomial time complexity T(n) such that L=L(M) and when M is given a input of length n,
there are no sequences of more than T(n) moves of M.
Example: The Travelling salesman problem

17 Define class P and give an example .


P is the class of languages that are decidable in polynomial time on a deterministic single-tape
Turing machine.
Example: Kruskal‟s algorithm
A graph; its minimum-weight spanning tree is indicated by heavy lines.

18 What is Knapsack problem or Rucksack problem?


The Knapsack problem or Rucksack problem is a problem in combinatorial
optimization: Given a set of items, each with a weight and a value, determine the number of each item to
include in a collection so that the total weight is less than a given limit and the total value is as large as
possible.

19 What is bounded and unbounded Knapsack problem ?


The bounded Knapsack problem restricts the number of item to a maximum integer value and the
Unbounded problem contain nonnegative integers of weights(W1,…,Wn and W), then the Knapsack
problem solved in pseudo-polynomial time called Unbounded problem.

MVIT/DEPT. OF CSE Page 41


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

20. What is Vertex cover problem?

A Vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least
one vertex of the set.

21. When we say a problem is decidable? Give an example of undecidable problem?


A problem whose language is recursive is said to be decidable. Otherwise the problem is said to be
undecidable. Decidable problems have an algorithm that takes as input an instance of the problem and
determines whether the answer to that instance is “yes” or “no”.

(eg) of undecidable problems are (1)Halting problem of the TM.

22. Give examples of decidable problems.


1. Given a DFSM M and string w, does M accept w?
2. Given a DFSM M is L(M) = _ ?
3. Given two DFSMs M1 and M2 is L(M1)= L(M2) ?
4. Given a regular expression r and a string w ,does r generate w?
5. Given a NFSM M and string w ,does M accept w?

23. Give examples of recursive languages?


i. The language L defined as L= { “M” ,”w” : M is a DFSM that accepts w} is recursive.
ii. L defined as { “M1” U “M2” : DFSMs M1 and M2 and L(M1) =L(M2) } is recursive.

24. Differentiate recursive and recursively enumerable languages.

Recursive languages Recursively enumerable languages

1. A language is said to be recursive if and 1. A language is said to be r.e if there exists a


only if there exists a membership algorithm for TM that accepts it.
it.

2. A language L is recursive iff there is a TM 2. L is recursively enumerable iff there is a TM


that decides L. that semi-decides L.

(Turing decidable languages). TMs that decide (Turing acceptable languages). TMs that semi-
languages are algorithms. decides languages are not algorithms.

25. What are UTMs or Universal Turing machines?


Universal TMs are TMs that can be programmed to solve any problem, that can be solved by any
Turing machine. A specific Universal Turing machine U is:
Input to U: The encoding “M “ of a Tm M and encoding “w” of a string w.
Behavior : U halts on input “M” “w” if and only if M halts on input w.

MVIT/DEPT. OF CSE Page 42


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

26. What is the crucial assumptions for encoding a TM?


There are no transitions from any of the halt states of any given TM . Apart from
the halt state , a given TM is total.

27. What properties of recursive enumerable seta are not decidable?


Emptiness
Finiteness
Regularity
Context-freedom.

28. Define L .When is a trivial property?


L is defined as the set { <M> | L(M) is in Φ. } is a trivial property if Φ is empty or it consists of all
r.e languages.

29. What is a universal language Lu?


The universal language consists of a set of binary strings in the form of pairs (M,w) here M is TM
encoded in binary and w is the binary input string. Lu = { < M,w> | M accepts w }.

30. What is a Diagonalization language Ld?


The diagonalization language consists of all strings w such that the TM M whose code is w
doesnot accept when w is given as input.

31. What properties of r.e sets are recursively enumerable?


L ≠Φ
L contains at least 10 members.
w is in L for some fixed w.
L ∩ Lu ≠ Φ

32. What properties of r.e sets are not r.e?


L=Φ
L = £ *.
L is recursive
L is not recursive.
L is singleton.
L is a regular set.
L - Lu ≠ Φ

MVIT/DEPT. OF CSE Page 43


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

33. How can a TM acts as a generating device?

In a multi-tape TM ,one tape acts as an output tape, on which a symbol, once written can never be
changed and whose tape head never moves left. On that output tape , M writes strings over some alphabet
∑ , separated by a marker symbol # , G(M) ( where G(M) is the set w in ∑ * such that w is finally printed
between a pair of #‟s on the output device ).

34. What are the different types of grammars/languages?

Unrestricted or Phase structure grammar.(Type 0 grammar).(for TMs)


Context sensitive grammar or context dependent grammar (Type1)(for Linear Bounded Automata
)
Context free grammar (Type 2) (for PDA)
Regular grammar (Type 3) ( for Finite Automata).
This hierarchy is called as Chomsky Hierarchy.

35. State a single tape TM started on blank tape scans any cell four or more times is decidable?

If the TM never scans any cell four or more times , then every crossing sequence is of length at
most three. There is a finite number of distinct crossing sequence of length 3 or less. Thus either TM stays
within a fixed bounded number of tape cells or some crossing sequence repeats.

36. Does the problem of “ Given a TM M ,does M make more than 50 moves on input B “?
Given a TM M means given enough information to trace the processing of a fixed string for a
certain fixed number of moves. So the given problem is decidable.

37. Show that AMBIGUITY problem is un-decidable.


Consider the ambiguity problem for CFGs. Use the “yes-no” version of AMB. An algorithm for
FIND is used to solve AMB. FIND requires producing a word with two or more parses if one exists and
answers “no” otherwise. By the reduction of AMB to FIND we conclude there is no algorithm for FIND
and hence no algorithm for AMB.

38. State the halting problem of TMs.


The halting problem for TMs is:
Given any TM M and an input string w, does M halt on w? This problem is undecidable as there is no
algorithm to solve this problem.

39. Define PCP or Post Correspondence Problem.


An instance of PCP consists of two lists , A = w1,w2,….wk and B = x1,…..xk of strings over some
alphabet _ .This instance of PCP has a solution if there is any sequence of integers i1,i2,..im with m >=1
such that wi1, wi2,…wim = xi1,xi2 ,…xim
The sequence i1 ,i2 ,…im is a solution to this instance of PCP.

MVIT/DEPT. OF CSE Page 44


AUTOMATA LANGUAGE AND COMPUTATION 2 marks

40. Define MPCP or Modified PCP.


The MPCP is : Given lists A and B of K strings from _ * ,say A = w1 ,w2, …wk and B= x1,
x2,…..xk does there exists a sequence of integers i1,i2,…ir such that w1wi1wi2…..wir = x1xi1xi2…xir?

41. What is the difference between PCP and MPCP?


The difference between MPCP and PCP is that in the MPCP ,a solution is required to start with the
first string on each list.

42. What are the concepts used in UTMs?


Stored program computers.
Interpretive Implementation of Programming languages.
Computability.

MVIT/DEPT. OF CSE Page 45

Anda mungkin juga menyukai