0% found this document useful (0 votes)
26 views19 pages

QB unit-IV FLAT Answers

BB ??

Uploaded by

ikrisshna08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views19 pages

QB unit-IV FLAT Answers

BB ??

Uploaded by

ikrisshna08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

EXCEL ENGINEERING COLLEGE

(Autonomous)
B.E COMPUTER SCIENCE AND ENGINEERING
IV Semester
20CS401- Formal Languages and Automata Theory
Regulations 2020
Question Bank
UNIT – IV (Properties of Context Free Languages)
PART- A
Q.No Questions
Define normal form.Give the two types of normal form of CFG.

When the productions in CFG are made to satisfy certain restrictions, then CFG is said
to be in normal form. Two types of normal forms are
1
 Chomsky normal form (CNF)
 Greibach Normal Form (GNF

State GNF

2 A CFG is said to be in GNF if all productions are of the form A→aX where a is terminal
symbol and X is a string of variables (possibly empty)are of the form A→a

List the closure properties of CFL.

CFL are closed under union, concatenation and Kleene closure. CFL are closed under
substitution , homomorphism.
3
CFL are not closed under intersection , complementation.

Closure properties of CFL’s are used to prove that certain languages are not context free

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 :

4 (i) |vx| >=1

(ii) |vwx| <=n and

(iii) for all i>=0 uviwxiy is in L.

Consider the Grammar


5
S->AB|a
A->b

Eliminate Useless Symbols.

Useless symbol B

Since S→AB,A is also useless symbol

After eliminating useless symbol

S→a

State Chomsky Normal Form theorem.

A context-free grammar G is said to be in Chomsky normal form (if all of its production rules
are of the form:

A → BC, or
6
A→a

where A, B, and C are nonterminal symbols, a is a terminal symbol (a symbol that represents a
constant value)

List the various techniques for TM construction.

A TM is usually described by the following three components:

 Tape: A tape is divided into sequence of numbered cells or squares, one next to other.
7 Each cell contains a symbol from some finite alphabet.
 Head: A tape head always stationed at one of the tape cells and provides
communication for the interaction between the tape and the control unit.
Control unit: The reading from the tape or writing into the tape is determined by the control
unit.

Give the formal definition of a Turing Machine.

The Turing machine is represented as a 7-tuple M = (Q,,,,q0, B , F)


Q Finite set of states
 Finite set of input symbols
8  Finite set of allowable tape symbols
q0 Initial state (q0 Є Q)
B Blank symbol,

F A set of final state (F is subset of Q)


 Transition function defined as :(Q ) ( Q L,R,N).
Compare between a finite automata and a TM.
9 FA/PDA TM
The cells of the tape of FA or PDA The cells of the tape of TM may be
are only read/scanned but never written also.
changed/written into.

The tape head of FA or PDA The tape head of TM can move


always move left to right left to right and right to left also.

Outgoing transition from final Outgoing transition from final


state in FA or PDA is allowed. state is allowed.

Is it possible that a Turing machine could be considered as a computer of functions


from integers to integers? If yes justify.

TM is viewed as a computer of functions from integer to integer. The traditional approach


10
is to view integer in unary format. The integer is represented by the string 0i. Example. The
integer 3 is represented as 03=000.If the function has k arguments then these integers are
separated by 1.

List out different types of TM Or Extensions of TM Or modification of TM.

 Two way infinite tape TM


 Multi tape TM
 Multi head TM
11
 Multidimensional TM
 Off-line TM
 Non-deterministic TM and
 Universal TM

List the Chomsky hierarchy of languages.


classification for grammars is given below:
Type 0 - Unrestricted grammar
12
Type 1 - Context sensitive grammar
Type 2 - Context free grammar
Type 3 - Regular grammar
Give the configuration of Turing machine.
A configuration for a Turing machine is an ordered pair of the current state and the tape
contents with the symbol currently under the head marked with underscore. For example (q,
aababb) shows that the Turing machine is currently in state q, the taper contents are the string
aababb and the head is reading the last a of the string. We write
13 ( p , xay ) ( q , zbw ) if the Turing machine goes from the first configuration to the second in
one move, and ( p , xay ) * ( q , zbw ) if the Turing machine goes from the first configuration
to the second in zero or more moves. If the Turing machine needs to be explicitly indicated T

or T* is used.

Define multi-tape TM
14
A TM with more than one tape and each tape having its own independent head is said to
be a multi-tape TM. Formally it is represented as a 7-tuple M = (Q,,,,q0, B , F) where  is
the Transition function defined as  : Qk  Q k L,R, k (k is the number of tapes)

Define non-deterministic TM (NTM)


A NTM is a device with a finite control and a single one way infinite tape. For a given
state and tape symbol the machine has a finite number of choices for the next move. Each
move consists of a new state, tape symbol to print, and a direction of head move. The
15
transition of NTM is represented as:  (q,s) = (qi,si,Mi) for i = 1, 2,….
Where q current state
s symbol being scanned by the tape head and
M move
Define Instantaneous description (ID) of Turing machine.
The complete state of a TM, at any point during a computation, may be described by
 The name of the state that in which the machine is
 The symbols on the tape and
16
 The cell that is currently being scanned.
A description of these three data is called instantaneous description (ID) or configuration of a
TM.

Convert the following grammar to GNF

S->XY
17
X->YS|a

Y->SX|b

Define Turing machine?


The Turing machine is represented as a 7-tuple M = (Q,,,,q0, B , F)
Q Finite set of states
 Finite set of input symbols
18  Finite set of allowable tape symbols
q0 Initial state (q0 Є Q)
B Blank symbol,
F A set of final state (F is subset of Q)
 Transition function defined as :(Q ) ( Q L,R,N).
Define Nullable Variable.

19 A variable 'A' is called nullable if є can be derived from 'A'.

For all the productions of type 'A -> є' , 'A' is a nullable variable.

What is offline Turing Machine?

An off line is a multi-tape TM, whose input tape is of type read-only. The input is end marked
20
by a Φ on the left and $ on the right. The TM is not allowed to move the input tape head, off
the region between Φ and $. An offline TM can simulate any TM T, by using one more tape.
PART- B
Q.No Questions
1 Obtain the Greibach Normal form for the following grammar
G= ({A1,A2,A3},{a,b},P,A1 ) where P consists of the following
A1A2 A3
A2A3 A1/ b
A3A1A2/ a
2 Construct a equivalent grammar G in CNF for the grammar G1 where G1=({S,A,B},{a,b},
{S→ASB| ε,
A→aAS|a,
B→SbS|A|bb},S).
3 Convert the following grammar G into Greibach Normal Form (GNF)

S→XA|BB
B→b|SB
X→b
A→a
4 Find out whether L={ anbncn/n ≥1} Context Free Languages or Not. Apply the Rules for
Pumping lemma Properties.
5 Describe Chomsky hierarchy of languages with example. What are the devices that accept
these languages?
6. i)Construct a TM to compute a function f(n)= n+3

ii)Construct a TM to compute a an addition f(n)= m+n


7 Show that L={ an2 } is not a Context Free Languages
8 Design a Turing Machine that accepts the language L= {anbn / n≥ 0}
9. i)Prove that CFL is closed under union

ii)Prove that CFL is not closed under intersection

i)
ii)
10 Explain the various (programming) techniques for Turing machine construction.

(Note:*Blooms Level (R – Remember, U – Understand, AP – Apply, AZ – Analyze, E – Evaluate, C – Create)


PART A- Blooms Level : Remember, Understand, Apply
PART B- Blooms Level: Understand, Apply, Analyze, Evaluate(if possible)
Marks: 16 Marks, 8+8 Marks, 10+6 Marks)

Subject In charge Course Coordinator HOD IQAC


(Name & Signature) (Name & Signature)

You might also like