0% found this document useful (0 votes)
3 views

Automata Py q

The document is an examination paper for the course 'Formal Language & Automata Theory' for B.Tech students, covering multiple choice, short answer, and long answer questions. It includes various topics related to formal languages, automata theory, and grammars. The paper is structured into three groups with a total of 70 marks and a time limit of 3 hours.
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)
3 views

Automata Py q

The document is an examination paper for the course 'Formal Language & Automata Theory' for B.Tech students, covering multiple choice, short answer, and long answer questions. It includes various topics related to formal languages, automata theory, and grammars. The paper is structured into three groups with a total of 70 marks and a time limit of 3 hours.
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/ 65

Name : ………………………………………………………………………………………………………………

Roll No. : ……………………………………………………………………………………………………………

Invigilator’s Signature : ……………………………………………………………………………………..

CS/B.Tech(IT)/SEM-5/CS-512/2009-10

2009

FORMAL LANGUAGE & AUTOMATA THEORY


Time Alloted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.

Candidates are required to give their answers in their own words

As far as practicable.

GROUP – A

(Multiple Choice Type Questions)

1. Choose the correct alternatives for any ten of following : 10 × 1= 10

i) Let R1 and R2 be regular sets defined over alphabet ∑ then

a) R1 ∩ R2 is not regular.

b) R1 U R2 is not regular.

c) ∑ ∩ R2 is not regular.

d) R2* is not regular.

ii) Which of the following strings can be obtained by the language L = { ai b2i/i≥ 1}?

a) aaabbbbbb b) aabbb

c) abbaabbbb d) aaaabb
iii) The regular expression with all strings of 0’s and 1’s with atleast
two consecutive 0’s is

a) 1 + (10) * b) (0 +1) * 00 (0 +1) *

c) (0 + 1) * 011 d) 0 * 0 * 1 *

iv) Which string can be generated by S → aS / bA ,


A → d / ccA ?

a) aabccd b) adabcca

c) abcca d) abababd.

v) The regular sets are closed under

a) Union b) Concatenation

c) Kleene closure d) all of these.

vi) The intersection of CFL and regular language

a) is always regular b) is always context – free

c) both (a) & (b) d) need not to be regular.

vii) A grammar that produces more than one parse tree for some sentence is called

a) ambiguous b) unambiguous

c) regular d) none of these.

viii) Consider the regular expression ( 0 + 1) ( 0 + 1 ) …. n times. The minimum state

finite automation that recognizes the language represented by this regular

expression contains

a) n states b) n + 1 states

c) n + 2 states d) n - 1 states.
ix) The vernacular language English, if considered a formal language is a

a) regular language

b) context – free language

c) context – sensitive language

d) none of these.

x) Palindromes cannot be recognized by Finite State Machine because

a) an FSM cannot remember arbitrarily large amount of information

b) an FSM cannot fix the mid - point

c) FSM cannot find whether the second half of the string matches the first half

d) all of these.

xi) NDFA can be constructed equivalent of

a) type - 0 grammar b) type - 1 grammar

c) type - 2 grammar d) type - 3 grammar.

xii) Pumping lemma for CFG proves that a given language

a) belongs to CFG

b) does not belongs to CFG

c) belongs to regular grammar

d) none of these.

xiii) NDFA can be constructed equivalent of

a) only type - 1 grammar b) only type - 2 grammar

c) only type - 3 grammar d) all grammars.

xiv) If a machine of n states is μ definite, then

a) μ ≤ n - 1 b) μ ≥ n - 1

c) μ = n - 1 d) none of these.
xv) Merger table is substitute of

a) merger graph b) compatible graph

c) minimized machine d) finite state machine.

xv) Merger table is substitute of

a) merger graph b) compatible graph

c) minimized machine d) finite state machine.

xvi) If G = ( { S }, { a }, { S → SS}, S ), the language generated by G is

a) L ( G ) = ø b) L ( G ) = an

c) L ( G ) = aø d) L ( G ) = an ban.

GROUP – B

(Short Answer Type Questions)

Answer any three of the following: 3 × 5 = 15

2. Test the machine below is definiteness or not. If yes, find the order μ. 5

NS
PS
x=0 x=1
A A B
B E B
C E F
D E F
E A D
F E B

3. a) State pumping lemma for Context Free Language.

b) Using this lemma prove that L = { ai bj | j = i2} is not

Context Free Language. 2+3


4. a) What is ambiguous grammar ?

b) Check whether the following grammar is ambiguous :

S → iCtS | iCtSeS | a

C→b 1+4

5. a) What are the differences between Moore machine and Mealy machines?

b) Construct a Moore machine equivalent to the Mealy machine :

NS
PS
a=0 a=1

NS o/p NS o/p

q1 q1 1 q2 0
q2 q4 1 q4 1
q3 q2 1 q3 1
q4 q4 0 q1 1

2+3

6. aa) What are the differences between DFA & NFA?

bb) Construct DFA which is equivalent to given NFA.

M = ( { q0, q1, q2, q3 }, { 0, 1 }, δ, q0, { q3 } ) and δ is given in the table :

Q/Σ 0 1
q0 q0, q1 q0
q1 q2 q1
q2 q3 q3
q3 ---- q2

2+3
GROUP – C

(Long Answer Type Questions)

Answer any three of the following: 3 × 15 = 45

7. a) State and prove Arden’s Theorem.

b) Prove that ( 1 + 00* 1) + (1 + 00* 1 ) ( 0 + 10* 1) * ( 0 + 10* 1) = 0*1 ( 0 + 10* 1)*

c) Find the regular expression for the given transition diagram :

a a

q0 b q1 a q2 5+5+5

8. a) What is PDA?

b) Design a PDA to accept the following language L = (ωω R | ω € (0, 1)*).

c) Construct a context free grammar generating following language :

L = { an bn |n ≥ 1 } U {am b2m |m ≥ 1 } and also construct PDA for the above derived

CFG. 1+6+8

9. a)

NS, z
PS
I1 I2 I3
A C, 0 E, 1 ---
B C, 0 E,-- ---
C B,-- C, 0 A,--
D B,0 C,-- E,--
E --- E A,--

For the incompletely specified machine shown above, find a minimum state reduced

machine containing the original one.


b)

NS, z
PS
x=0 x=1
A B,1 H, 1
B F, 1 D, 1
C D, 0 E, 1
D C, 0 F, 1
E D, 1 C, 1
F C, 1 C, 1
G C, 1 D, 1
H C, 0 A, 1

Using this table

i) find the equivalence partition.

ii) find the standard form of the corresponding reduced machine.

What the minimum length sequence that distinguishes state A from state B.

8 + (3 + 3 +1 )

10. a) For the grammar

S → aB| bA

A → a | aS | bAA

B → b | bS |aBB

Give the left most and right most derivation for the string “aaabbabbba”.

b) Design a CFG for the language

L (G ) = { 0n 1m | n ≠ m }

c) Construct a regular grammar G generating the regular set by r = 01 ( 0 + 1 )*

5+5+5
11. a) Remove left recursion from guven grammar :

A → Ba |b

B → Bc | Ad |e

b) Convert the grammar into GNF :

S → a ABb | a

A → aaA |B

B → bAb

c) In response to an unknown input sequence, the machine given below produces

the output sequence 1110000010. Find the input sequence to the machine if it is

known that is initial state is A and final state is F.

NS, z
PS
x=0 x=1
A B, 1 C, 0
B D, 1 B, 1
C E, 1 B, 0
D A, 0 E, 0
E F, 0 D, 1
F D, 0 A, 1

-------------------
http://www.makaut.com

Name : ……………………………………………………………
Roll No. : ………………………………………………………..
Invigilator's Signature : ……………………………………….
CS/B.Tech(IT)/SEM-5/CS-512/2009-10
2009
FORMAL LANGUAGE & AUTOMATA THEORY
Time Allotted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

GROUP – A
( Multiple Choice Type Questions )

1. Choose the correct alternatives for any ten of the following :


10 ∞ 1 = 10
i) Let R 1 and R 2 be regular sets defined over alphabet


then
a) R 1 I R 2 is not regular

b) R 1 U R 2 is regular

c) ∑ I R 2 is not regular

d) R 2 * is not regular.

ii) Which of the following strings can be obtained by the


language L = { a i b 2i / i ≥ 1 } ?

a) aaabbbbbb b) aabbb

c) abbaabbbb d) aaaabb.

55902 [ Turn over


CS/B.Tech(IT)/SEM-5/CS-512/2009-10

iii) The regular expression with all strings of 0's and 1's
with at least two consecutive 0's is

a) 1 + ( 10 ) * b) ( 0 + 1 ) * 00 ( 0 + 1 ) *

c) ( 0 + 1 ) * 011 d) 0* 0* 1* .

iv) Which string can be generated by S ∅ aS / bA,


A ∅ d / ccA ?

a) aabccd b) adabcca

c) abcca d) abababd.

v) The regular sets are closed under

a) Union b) Concatenation

c) Kleene closure d) all of these.

vi) The intersection of CFL and regular language

a) is always regular b) is always context-free

c) both (a) & (b) d) need not be regular.

vii) A grammar that produces more than one parse tree for
some sentence is called

a) ambiguous b) unambiguous

c) regular d) none of these.

viii) Consider the regular expression ( 0 + 1 ) ( 0 + 1 ) .... n


times. The minimum state finite automation that
recognizes the language represented by this regular
expression contains

a) n states b) n + 1 states

c) n + 2 states d) n – 1 states.

55902 2
CS/B.Tech(IT)/SEM-5/CS-512/2009-10

ix) The vernacular language English, if considered a formal


language is a

a) regular language

b) context-free language

c) context-sensitive language

d) none of these.

x) Palindromes cannot be recognized by any Finite State


Machine because

a) an FSM cannot remenber arbitrarily large amount


of information

b) an FSM cannot fix the mid-point

c) FSM cannot find whether the second half of the


string matches the first half

d) all of these.

xi) NDFA can be constructed equivalent of

a) type-0 grammar b) type-1 grammar

c) type-2 grammar d) type-3 grammar.

xii) Pumping lemma for CFG proves that a given language

a) belongs to CFG

b) does not belong to CFG

c) belongs to regular grammar

d) none of these.

55902 3 [ Turn over


CS/B.Tech(IT)/SEM-5/CS-512/2009-10

xiii) Turing machine accepts


a) only type-1 grammar b) only type-2 grammar
c) only type-3 grammar d) all grammars.
xiv) If a machine of n states is µ definite, then
a) µ≤n–1 b) µ≥n–1
c) µ=n–1 d) none of these.
xv) Merger table is substitute of
a) merger graph b) compatible graph
c) minimized machine d) finite state machine.
xvi) If G = ( { S }, { a }, { S ∅ SS }, S ), the language generated
by G is
a) L(G)=φ b) L(G )=an
c) L(G )=aφ d) L(G )=anban .

GROUP – B
( Short Answer Type Questions )
Answer any three of the following. 3 ∞ 5 = 15
2. Test the machine below is definiteness or not ? If yes, find
the order µ . 5

PS NS
x=0 x=1

A A B
B E B
C E F
D E F
E A D
F E B

55902 4
CS/B.Tech(IT)/SEM-5/CS-512/2009-10

3. a) State pumping lemma for Context Free Language.


b) Using this lemma prove that L = {aibj|j=i2} is not
Context Free Language. 2+3
4. a) What is ambiguous grammar ?
b) Check whether the following grammar is ambiguous :
S ∅ iCtS|iCtSeS|a
C∅b 1+4
5. a) What are the differences between Moore and Mealy
machines ?
b) Construct a Moore machine equivalent to the Mealy
machine :
PS NS
a=0 a=1
NS o/p NS o/p
q1 q1 1 q2 0
q2 q4 1 q4 1
q3 q2 1 q3 1
q4 q4 0 q1 1
2+3
6. a) What are the differences between DFA & NFA ?
b) Construct DFA which is equivalent to given NFA.
M = ( { q0, q1, q2, q3 }, { 0, 1 }, δ, q0, { q3 } ) and δ is
given in table : 2+3
Q/Σ 0 1
q0 q0, q1 q0
q1 q2 q1
q2 q3 q3
q3 — q2

55902 5 [ Turn over


CS/B.Tech(IT)/SEM-5/CS-512/2009-10

GROUP – C
( Long Answer Type Questions )
Answer any three of the following. 3 ∞ 15 = 45
7. a) State and prove Arden's Theorem.
b) Prove that
( 1 + 00* 1 ) + ( 1 + 00*1 ) ( 0 + 10*1 )*( 0 + 10*1 )
= 0*1 ( 0 + 10*1 )*
c) Find the regular expression for the given transition
diagram :

dia.

5+5+5
8. a) What is PDA ?
b) Design a PDA to accept the following language
L = ( ww R |w ε( 0, 1 )* ).
c) Construct a context free grammar generating following
language :
L = { a n b n|n ≥ 1 } U { a m b 2m|m ≥ 1 } and also
construct PDA for the above derived CFG. 1+6+8
9. a)

Dia.

For the incompletely specified machine shown above,


find a minimum state reduced machine containing the
original one. 8

55902 6
CS/B.Tech(IT)/SEM-5/CS-512/2009-10

b)

Dia

Using this table

i) find the equivalence partition

ii) find the standard form of the corresponding


reduced machine.
What is the minimum length sequence that
distinguishes state A from state B. 8+(3+3+1)

10. a) For the grammar

S ∅ aB|bA

A ∅ a|aS|bAA

B ∅ b|bS|aBB

Give the left most and right most derivation for the
string "aaabbabbba".

b) Design a CFG for the language

L ( G ) = { 0 n 1 m |n ≠ m }

c) Construct a regular grammar G generating the regular


set by r = 01 ( 0 + 1 )*. 5+5+5

55902 7 [ Turn over


CS/B.Tech(IT)/SEM-5/CS-512/2009-10

11. a) Remove left recursion from given grammar :


A ∅ Ba|b
B ∅ Bc|Ad|e
b) Convert the grammar into GNF :
S ∅ ABb|a
A ∅ aaA|B
B ∅ bAb
c) In response to an unknown input sequence, the
machine given below produces the output sequence
1110000010. Find the input sequence to the machine if
it is known that its initial state is A and final state is F.

Dia.

3+5+7

55902 8
http://www.makaut.com

Name : …………………………………………….………………
Roll No. : …………………………………………...……………..
Invigilator’s Signature : ………………………………………..

CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

2010-11
FORMAL LANGUAGE AND AUTOMATA THEORY
Time Allotted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

GROUP – A

( Multiple Choice Type Questions )

1. Choose the correct alternatives for the following : 10 × 1 = 10

i) What is the language of the grammar with the following

production rules?

S → ASb |c
A →a

a) { a n cb n |n ∈ IN } b) { xcb | x ∈ {a } * }

c) { acy | y ∈ {b } * } d) None of these.

5402 [ Turn over ]


CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

ii) A grammar has the following production :


S → aSSb |a |bSa

Which of the following sentences are in the language


that is generated by this grammar ?
a) aaaaabb b) aabbaabb
c) bbbaabbaa d) All of these.
iii) The following grammar generates a small part of the
statements in Java :
S → S ; S | if Bool then S else S | Identifier : = IN |

You may assume that an Identifier is represented by a


string. What is the most precise statement about this
grammar ?
a) This grammar is unambiguous
b) This grammar is left recursive
c) This grammar is LL (1)
d) All three statements are correct.
iv) Take a look at the following grammar :
S → AaC | Bd
A → BC
B → bB |C
C → accS |

For which non-terminals N is symbol a part of the


collection follow N ? Give the best answer.
a) {A}
b) { A, C }
c) { A, B, C }
d) { A, B, C, S }

5402 2
CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

v) Which of the following grammars is a (right) regular


grammar with the same language as the

regular expression a ∗ +b ∗ +ab ?

a) S → AB b) S → ab | A | B
A → aA | A → Aa |
B → bB | B → Bb |

c) S → A |B d) S → ab | A | B
A → aA |b A → aA |
B → Bb |a B → bB |

vi) Input sequence of an information lossless machine can


be determined from the knowledge of

a) only output sequence

b) output sequence and initial state

c) output sequence, initial state and final state

d) initial state.

vii) The logic pumping lemma is a good example of

a) the pigeon-hole principle

b) the divide & conquer technique

c) recursion

d) iteration.

viii) If S is the number of states in NDFA then equivalent


DFA can have maximum of

a) S states b) S –1 states

c) 2S states d) 2S –1 states.

5402 3 [ Turn over ]


CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

ix) The regular sets are closed under


a) Union b) Concatenation
c) Kleene closer d) all of these.
x) Look at the following non-deterministic finite-state
automation (NFA),with A as the start state, and D as the
only accepting state.

With deterministic finite-state automation (DFA) with d


as its state transition function accepts the same
language ?
a) Start state A, accepting state C and D.
dAb=B
dBa=C
dCa=D
b) Start state A, accepting state C.
d A b= B
d B a =C
d C a =C
c) Start state A, accepting state D.
d A b =B
d B a =D
d B b =C
d C a =D
d) All of these.

5402 4
CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

GROUP – B

( Short Answer Type Questions )

Answer any three of the following. 3 × 5 = 15

2. Find a grammar generating L = {a n ,b n ,c f |n >= 1, f >= 0 } .

3. Construct a PDA equivalent to the grammar


S → aAAA → aS /b .

4. State and prove pumping lemma for CFL’s.

5. The language defined as L = {a n b n c n /n >= 1} is context free


or not. Prove it.

6. Draw state diagram of a sequence detector which detects the


sequence 01101 (Overlapping sequence acceptable).

GROUP – C

( Long Answer Type Questions )

Answer any three of the following. 3 × 15 = 45

7. a) Design a Moore Machine to determine the residue mode


4 for each binary string treated as integer.

b) Design a Mealy machine that uses its state to remember


the last symbol read and emits output ‘y’ whenever
current input matches to previous one, and emits n
otherwise. 7+8

5402 5 [ Turn over ]


CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

8. a) Find the equivalence partition of the machine shown

below :

NS, z
PS
x=0 x=1

A B, 1 H, 1

B F, 1 D, 1

C D, 0 E, 1

D C, 0 F, 1

E D, 1 C, 1

F C, 1 C, 1

G C, 1 D, 1
H C, 0 A, 1

b) Show a standard form of the corresponding reduced

machine.

c) Find a minimum length input sequence that

distinguishes state A from B. 5+5+5

9. a) Develop a procedure to determine the shortest input

sequence that distinguishes a state Si from another

state S j of a given machine.

5402 6
CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

b) Use the procedure to determine the shortest input

sequence that distinguishes state A from state G in the

machine given below :

NS, z
PS
x=0 x=1
A A, 0 B, 0
B C, 0 D, 1
C E, 0 D, 0
D F, 0 E, 1
E G, 0 A, 0
F G, 0 B, 1
G C, 0 F, 1
c) Draw merger graph for the following incompletely

specified machine.

NS, z
PS
I1 I2 I3 I4
A – – E, 1 –
B C, 0 A, 1 B, 0 –
C C, 0 D, 1 – A, 0
D – E, 1 B, – –
E B, 0 – C, – B, 0
5+5+5

10. a) Define Pushdown Automata. Discuss with an example.

b) Find if the string aaa bbb ccc can be derived from the

productions.

S → ABSc, S → Abc, BA → AB, Bb → bb, Ab → ab, AA → aa

5402 7 [ Turn over ]


CS / B. TECH (IT) / SEM-5 / CS-512 / 2010-11

c) Draw derivation tree for the sentential form baabaab for

the productions

S → AB , A → Aa , A → bB , B → a , B → Sb 5+5+5

11. a) Define Turing Machine.

b) Design a Turing machine M to recognize the language

{ 1n 2n 3n |n ≥ 1 }

c) Construct an FA equivalent to the regular expression

(0 + 1) * (00 + 11)(0 + 1) * . 2+8+5

=============

5402 8
http://www.makaut.com

Name : …………………………………………….………………
Roll No. : …………………………………………...……………..
Invigilator’s Signature : ………………………………………..

CS/B.TECH(IT)/SEM-5/CS-512/2011-12

2011
FORMAL LANGUAGE AND AUTOMATA THEORY
Time Allotted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

GROUP – A
( Multiple Choice Type Questions )

1. Choose the correct alternatives for the following : 10 × 1 = 10


i) Let S and T be language over = { a, b } represented by
the regular expressions ( a + b * ) * and ( a + b ) *
respectively.
Which of the following is true ?
a) S ⊂ T ( S is a subset of T )
b) T ⊂ S ( T is a subset of S )
c) S=T
d) SnT = Ø.
ii) Let L denotes the language generated by the grammar
S → oSo | oo. Which of the following is true ?
a) L=O
b) L is regular but not O
c) L is context free but not regular
d) L is not context free.

5402 [ Turn over


CS/B.TECH(IT)/SEM-5/CS-512/2011-12

iii) Consider the following two statements :

S1 : { O 2n |n ≥ 1 } is a regular language.

{ }
S2 : O mO nO m +n |m ≥ 1, n ≥ 1 is a regular language.

Which of the following statements is correct ?


a) Only S1 is correct

b) Only S2 is correct

c) Both S1 and S2 are correct

d) None of S1 and S2 is correct.

iv) Which of the following statements is true ?


a) If a language is context free it can always be
accepted by a deterministic push-down
automation.
b) The union of two context free languages is context
free.
c) The intersection of two context free languages is
context free.
d) The complement of a context free language is
context free.
v) Given an arbitrary non-deterministic finite automation
(NFA) with N states, the maximum number of states in
an equivalent minimized DFA is at least

a) N2 b) 2N
c) 2N d) N!.
vi) Properties of equivalence relations are
a) Reflexive b) Symmetric
c) Transitive d) all of these.

5402 2
CS/B.TECH(IT)/SEM-5/CS-512/2011-12

vii) The type of the production grammar


{ S → aSbb, S → abb } is

a) 3 b) 2

c) 1 d) 0.

viii) The output function in mealy machine depends on


a) present state b) present input
c) both (a) and (b) d) none of these.
ix) NDFA is a

a) non-deterministic finite automation

b) deterministic finite automation

c) both deterministic and non-deterministic finite


automation

d) none of these.

x) The compatibility graph is used in searching for

a) minimal closed covering

b) minimum number of edges

c) all incompatible pairs

d) both (a) and (c).

GROUP – B
( Short Answer Type Questions )
Answer any three of the following 3 × 5 = 15

2. Draw the state transition diagram and state table of a


deterministic finite state automata that accept the
language L (M ) = { w ε { a , b }* : w does not contain three
consecutive b's }

5402 3 [ Turn over


CS/B.TECH(IT)/SEM-5/CS-512/2011-12

3. Design a push down automata for the language


{ 2
L = c da b n (n +1)
}
: n >0 .
4. Construct a Push Down Automata equivalent of the following
Context Free Grammar :
G = ( Vn, Vt, P, S ) with Vn = { S, E }, Vt = { 0 , 1 } and P is
defined by transition function as follows :
S → 0S1/A
A → 1A0/S/ ε
Now check the string whether 001011 is acceptable by this
Push Down Automata or not.
5. a) What is parse tree ?
b) Consider the CFG :
S → aaB
A → bBb/ ε
B → Aa
Find the Parse tree for the string aabbababa.
6. Design Context Free Grammar over alphabet { a, b } that
generates the set of all strings with at least one a, and derive
a string 'babba'.
GROUP – C
( Long Answer Type Questions )
Answer any three of the following. 3 × 15 = 45
7. a) What is information lossless machine ? Consider the
following table. Is this machine lossless of finite order ?
If yes, find the order.
Present state Next state, output
X=0 X=1
A B, 1 C, 1
B D, 0 E, 0
C A, 1 F, 1
D C, 0 B, 0
E F, 1 A, 1
F E, 0 D, 0

5402 4
CS/B.TECH(IT)/SEM-5/CS-512/2011-12

b) Design an inverse of the machine above. Give a reduced

standard form state table, assuming that the initial

state of the lossless machine is A. 5 + 10

8. a) Define a compare Moore and Mealy machines.

b) Convert the following Mealy machine into Moore


machine.

c) Consider the N.F.A. given by the following diagram :

Find the equivalent D.F.A. without ε -transition.

2+6+7

5402 5 [ Turn over


CS/B.TECH(IT)/SEM-5/CS-512/2011-12

9. Consider the following state table :


Present state Next state, output
I1 I2
A E, 0 B, 0
B F, 0 A, 0
C E, — C, 0
D F, 1 D, 0
E C, 1 C, 0
F D, — B, 0
a) Draw the marger graph :
b) Draw the marger table.
c) Draw the compatibility graph.
d) Find the minimal machine which covers that machine.
3+3+3+6
10. Consider the following state table :

Present state Next state, output


X=0 X=1
A B, 1 H, 1
B F, 1 D, 1
C D, 0 E, 1
D C, 0 F, 1
E D, 1 C, 1
F C, 1 C, 1
G C, 1 D, 1
H C, 0 A, 1
a) Find the equivalence partition for the machine.
b) Show a standard form of the corresponding reduced
machine and draw the state diagram.
c) Find a minimum length sequence that distinguishes
state A from state B. 8+5+2

5402 6
CS/B.TECH(IT)/SEM-5/CS-512/2011-12

11. a) Find a reduced grammar equivalent to the grammar G


whose productions are S → AB |CA , B → BC | AB ,
A → a , C → aB |b .

b) Let G be the grammar S → 0B |1A , A → 0 | 0S |1AA ,


B → 1|1S | 0BB . For the string 00110101, find,

i) the leftmost derivation,

ii) the rightmost derivation

iii) the derivation tree.

c) Convert the grammar S → AB , A → BS |b , B → SA |a


into GNF. 5+5+5
=============

5402 7 [ Turn over


http://www.makaut.com

Name : …………………………………………….………………
Roll No. : …………………………………………...……………..
Invigilator’s Signature : ………………………………………..

CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

2012
FORMAL LANGUAGE & AUTOMATA THEORY
Time Allotted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

GROUP – A

( Multiple Choice Type Questions )

1. Choose the correct alternatives for the following :

10 × 1 = 10

i) The basic limitation of FSM is that

a) it can’t remember arbitrary large amount of

information

b) it sometimes recognize grammar that is not regular

c) it sometimes fails to recognize grammar that is


regular

d) all of these.

4358 [ Turn over


CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

ii) Choose the correct statements :

a) Moore & Mealy machine are FSM with output


capabilities

b) Any given Moore machine has an equivalent Mealy


machine

c) Any given Mealy machine has an equivalent Moore


machine

d) Moore machine is not an FSM.

iii) The intersection of CFL & regular language

a) need not be regular b) need not be CF

c) is always regular d) none of these.

iv) Palindromes can’t be recognized by any FSM because

a) an FSM can’t be remember arbitrary large amount


of information

b) an FSM can’t deterministically fix the mid point

c) FSM can’t find whether 2nd half of the string


machines the 1st half or not

d) None of these.

v) Can a DFA simulate NFA ?

a) no b) yes

c) some times d) depends on DFA.

4358 2
CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

vi) ( P + Q )* = ?

a) ( P* + Q* ) b) P* + Q*

c) ( P* Q* )* d) both (a) and (c).

vii) What is the RE for the language set strings with atleast

one 1, one 2 and one 3 ?

a) 1+2+3 b) 11* 22* 33*

c) 1* 2* 3 d) both (a) and (b).

viii) Which of the following sets is regular ?

a) { ai : i = n2, n > = 1 }

b) { ap : p is prime }

c) { ww : w is in (a, b) + }

d) { a2n : n > = 1 }.

ix) The regular expression representing the set of all strings

over { x, y } ending with XX beginning with Y is

a) XX ( X + Y ) * Y b) YY ( X + Y ) * X

c) Y ( X + Y ) * XX d) Y ( XY ) * XX.

x) Regular expression (a/b)(a/b) denotes the set

a) { a, b, ab, aa } b) { a, b, ba, bb }

c) both (a) and (b) d) none of these.

4358 3 [ Turn over


CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

GROUP – B
( Short Answer Type Questions )
Answer any three of the following. 3 × 5 = 15

2. Show that L = { On 1n|n > = 1 } is not regular.


3. Write the CFG for the following language
L = { 0i 1j 2k|I = j j = k }
4. Design a PDA which accepts the language
L = { w ∈ (a,b)*|w has equal no. of a & b }.
5. a) Give DFA which reads strings from {a,b} and with aaa. 3
b) Construct a DFA equivalent to M = { {q0, q, }, {0, 1}, δqo,
{q0}}, δ is given by the state table.

State / 0 1
q0 q 0 q 1

q1 q1 q0, q1 2

6. Find a GNF grammar equivalent to the following CFG :


A1 → A2 A3
A2 → A3 A1|b
A3 → A1 A2|a

GROUP – C
( Long Answer Type Questions )
Answer any three of the following. 3 × 15 = 45

7. a) Construct a DFA diagram to the NFA given below. 6

4358 4
CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

b) Convert Mealy Machine to Moore Machine. 6

c) What are Kleene Closure and Positive Closure ? Give


example for both. 2+1

8. a) What are distinguishable and Indistinguishable state ? 3

b) Use Myhill Nerode Theorem to minimize the following


finite automata. 12

4358 5 [ Turn over


CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

9. a) Give the Regular Expression for the DFA using arden

Theorem. 5

b) What is Griebach Normal Form (GNF) for Context Free

grammar ?

Convert the following grammar into GNF

S → ABb/a

A → aaA/B

B → bAb 1+4

c) Using Pumping Lemma show that L = {anbn : n > = 0} is

not regular. 5

10. a) Construct a NFA with ε or λ transition for

r = (11 + 0)*(00 + 1)* 5

b) What is PDA ? 5

c) Construct PDA for L = {wwR : w belongs to (0, 1)* } 5

4358 6
CS/B.TECH(CSE/IT)NEW/SEM-4/CS-402/2012

11.
PS NS, Z
I1 I2 I3
A C,O E,1 ….......
B C,O E,… ………
C B,… C,O A,…
D B,O C,… E,…
E …… E A,…

For the incompletely specified machine shown above


find the minimum state reduced machine containing the
original one. 8
PS NS,Z
x=0 x=1
A B, 1 H, 1
B F, 1 D, 1
C D, 0 E, 1
D C, 0 F, 1
E D, 1 C, 1
F C, 1 C, 1
G C, 1 D, 1
H C, 0 A, 1

Using this table

a) Find the equivalence partition. 3

b) Find the standard form of the corresponding


reduced machine. 3

c) What is the minimum length sequence that


distinguishes state A from state B ? 1

4358 7 [ Turn over


www.makaut.com

Name : ……………………………………………………………
Roll No. : ………………………………………………………..
Invigilator’s Signature : ………………………………………..

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013
2013
FORMAL LANGUAGE & AUTOMATA THEORY
Time Allotted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

GROUP – A
( Multiple Choice Type Questions )
1. Choose the correct alternatives for any ten of the following :
10 1 = 10

i) The following grammar


G = ( N, T, P, S )
N = { S, A, B }
T = { a, b, c )
P :S aSa
S aAa
A bB
B bB
B c
a) is type 3
b) is type 2 but not type 3
c) is type 1 but not type 2
d) is type 0 but not type 1.

4001 (O) [ Turn over


www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

ii) Consider the following language :

L= { anbncndn | n 1 }
L is
a) CFL but not regular
b) CSL but not CFL
c) regular
d) type 0 language but not type 1.

iii) Can a DFSA simulate a NFSA ?


a) No b) Yes
c) Sometimes d) Depends on NFA.
iv) The following grammar
G = ( N, T, P, S )
N = { S, A, B, C, D, E }
T = { a, b, c }
P :S aAB
AB CD
G = ( N, T, P, S )
CD CE
C aC
C b
bE bc
a) is type 3
b) is type 2 but not type 3
c) is type 1 but not type 2
d) is type 0 but not type 1.

4001 (O) 2
www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

v) The following grammar

G = ( N, T, P, S )

N = { S, A, B, C }

T = { a, b, c }

P :S aS

A bB

B cC

C a

a) is type 3

b) is type 2 but not type 3

c) is type 1 but not type 2

d) is type 0 but not type 1.

vi) Consider the following language :

L= { a n b n |n 1 }
L is

a) CFL but not regular

b) CSL but not CFL

c) regular

d) type 0 language but no type 1.

4001 (O) 3 [ Turn over


www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

vii) The following CFG is in

S AB

B CD

B AD

B b

D AD

D d

A a

C a

a) Chomsky normal form but not strong Chomsky


normal form

b) Weak Chomsky normal form but not Chomsky


normal form

c) Strong Chomsky normal form

d) Greibach normal form.

viii) Which of the following CF languages is inherently


ambiguous ?

a) { a n b n c m d m |n‚ m 1 }
b) { a n b m c p d q |n = p or m = q‚ n‚ m‚ p‚ q 1 }
c) { a n b m c p d q |n m p q }
d) { a n b m c p d q |n mVp q }.

4001 (O) 4
www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

ix) The concept of FSA is much used in which part of the


compiler ?

a) Lexical analysis

b) Parser

c) Code generation

d) code optimization.

x) The set of all strings over the alphabet

= { a, b } ( including ) is denoted by

a) (a+b) b) (a+b)+

c) a+b + d) a b

xi) Which one of the following statements is False ?


a) Context-free languages are closed under union.
b) Context-free languages are closed under
concatenation.
c) Conext-free languages are closed under
intersection.
d) Context-free languages are closed under Kleene
closure.

xii) Which of the following conversions is not possible


( algorithmically ) ?

a) Regular grammar to context-free grammar

b) Non-deterministic FSA to deterministic FSA

c) Non-deterministic PDA to deterministic PDA

d) Non-deterministic M to deterministic TM.

4001 (O) 5 [ Turn over


www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

GROUP – B
( Short Answer Type Questions )
Answer any three of the following. 3 5 = 15

2. a) Give an NFA that accepts the language

L(( a+b) b ( a + bb ) ). 2

b) Design a Moore machine for 1’s complement of a given


binary number. 3

3. a) Write the regular expression of the language on ( 0, 1 )


such that it contains at least one double letter. 2

b) Show the left-most derivation tree for the string aabbbb


with the grammar

S AB |

A aB

B Sb. 3

4. Test the following machine for definiteness using contracted


tables :

NS
PS
x=0 x=1
A A B
B E B
C E F
D E F
E A D
F E B

4001 (O) 6
www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

5. What are the closure properties of Regular sets ? Explain.

6. Write a short note on context sensitive language with


suitable example.

7. Write about Linear Bounded Automata.

GROUP – C
( Long Answer Type Questions )
Answer any three of the following. 3 15 = 45

8. a) Design a Mealy machine which is equivalent to the


Moore machine given in the table below : 5

NS
PS Output
i=0 i=1

q1 q1 q2 0

q2 q1 q3 0

q3 q1 q3 1

b) Construct a PDA for the language

L= { a3 bncn : n 0 }. 8

c) Define linear grammar and regular grammar. 1+1

9. a) Construct a Turing machine for the language

L= { an bncn : n 1 }. 12

b) Show that the language L = {an :n 0‚ n 4 } is

regular. 3

4001 (O) 7 [ Turn over


www.makaut.com

CS/B.TECH (CSE/OLD)/SEM-4/CS-401/2013

10. a) Find the equivalence partitions for the machine below.


Also find the standard form of the corresponding
reduced machine. 8+1
NS, z
PS x=0 x=1
A E, 0 C, 0
B C, 0 A, 0
C B, 0 G, 0
D G, 0 A, 0
E F, 1 B, 0
F E, 0 D, 0
G D, 0 G, 0
b) Remove all unit productions, all useless productions
and all -productions from the following grammar : 6
S aA | aBB
A aaA |
B bB | bbC
C B.
11. a) Find a Greibach normal form equivalent to the following
CFG : 8
S AB/a, A BS/b, B SA/c
b) Remove all unit productions, all useless productions
and all e-productions for the following grammar : 7
S aA/aBB, A aaA/e, B bB/bbC, C B.
12. a) Construct a PDA equivalent to the grammar S aAA,
A aS/b. 7
b) Show that L = { WW|W { a, b } } is not regular. 8
13. Write notes on any three of the following : 3 5
a) Myhill-Nreode theorem
b) Chomsky Normal form
c) Recursively enumerable sets
d) DFA and NFA.

4001 (O) 8
http://www.makaut.com

Name : …………………………………………….………………
Roll No. : …………………………………………...……………..
Invigilator’s Signature : ………………………………………..

CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

2013
FORMAL LANGUAGE AND AUTOMATA THEORY
Time Allotted : 3 Hours Full Marks : 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

GROUP – A
( Multiple Choice Type Questions )

1. Choose the correct alternatives for the following :


10 × 1 = 10

i) Which is true of the following ?

a) Merger graph is directed graph

b) Compatible graph is directed graph

c) Both are directed

d) None of these.

ii) The logic of pumping lemma is a good example of

a) The pigeon-hole principle

b) The divide and conquer technique

c) Recursion

d) Iteration.

4302 [ Turn over


CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

iii) a*(a + b)* is equivalent to

a) a* + b* b) a*b*

c) (ab)* d) none of these.

iv) The class of context free language is not closed under

a) Concatenation

b) Union

c) Intersection

d) Repeated Concatenation.

v) Which of the following strings can be obtained by the


language L = {a i
b 2i i ≥ 1 }
a) aaabbbbbb b) aabbb

c) abbabbba d) aaaabbbabb.

vi) Which string is not accepted by the following FSA ?

a) 00111 b) 00110

c) 01010 d) 11010.

4302 2
CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

vii) Which of the following production is in CNF ?

a) S → aA b) SA → AS

c) S → AB d) All of these.

viii) The solution to the equation R = Q + RP is

a) R = QP* b) R = Q*P

c) P = RQ* d) R = P.

ix) A shift register is

a) Mealy M/C

b) Turing M/C

c) Moore M/C

d) all of these.

x) Consider the following language :

L = {an bn cn dn | n ≥ 1}

L is

a) CFL but not regular

b) CSL but not CFL

c) Regular

d) Type 0 language but not type 1.

4302 3 [ Turn over


CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

GROUP – B

( Short Answer Type Questions )

Answer any three of the following. 3 × 5 = 15

2. Design a Finite automate the accepts set of strings that every

string ends with 00 over alphabet {0, 1}.

3. Let Σ = {a,b}, Prove that the Language L = {w ∈ Σ* : na (w) } is

not regular.

4. Find the Context Free Grammar for the following language

L = { anb 2ncm : n,m > = 0}.

5. Construct the regular expression corresponding to the state

diagram given below :

6. Design a Turing Machine that recognizes the language of all

string of even length over the alphabet {a,b}.

4302 4
CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

GROUP – C

( Long Answer Type Questions )

Answer any three of the following. 3 × 15 = 45

7. a) Construct a DFA from the NFA given below : 6

State/Σ I/P
0 1
→ Q0 Q0 , Q3 Q 0, Q 4
Q3 Qf ........
Q4 ....... Qf
Qr (Final State) Qf Qf

b) Construct λ - NFA for the regular expression


(0 + 1)* 1 (0 + 1) 4

c) What is regular expression ? 2

d) What will be regular expression over the alphabet {a,b},


for the language L = (anbn : n > = 4, m < = 3} ? 3

8. a) Design a TM that accepts {0n1n|n ≥ 1} 5

b) What do you mean by halting problem of a Turing


machine ? 2

c) Design a TM which can multiply two positive integers. 6

d) Why a Turing machine is called linear bounded


automation ? 2

9. a) State Myhill-Nerode theorem with the definition of


equivalent relation and invariance. 3+2

4302 5 [ Turn over


CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

b) Minimize the following machine by applying Myhill-


Nerode theorem. 10

PS NS
X=a X=b
→ A B E
B C D
C H I
D I H
E F G
F H I
G H I
H H H
I I I

10. a) Construct CFG for the following. 3+2+3

i) Palindrome for binary numbers.

ii) L = { anbncmdm |m, n > 0 }

iii) L = { anbm | n ≠ m }

b) Convert the following grammar to CNF. 5

S → aA/B/C/a

A → aB/E

B → aA

C → cCD

D → abd

c) Define non-generating and non-reachable symbols with


example. 2

4302 6
CS/B.TECH (CSE-NEW/IT-NEW)/SEM-4/CS-402/2013

11. a) Construct a PDA to accept L = { WWR|W belongs to


(a,b)* and WR is reverse string of W } by empty stack
and final state. 5

b) Construct an equivalent PDA for the following CFG.

S → aAB/bBA

A → bS/a

B → aS/b

Show an ID for the string abbaaabbbab for the PDA


generated with stack description. 7

c) Explain Ogden’s Lemma for CFL. 3

4302 7 [ Turn over

You might also like