Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

TAFL Unitwise - QuestionBank

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

GCET – CSE – II Year IV Sem Mr Rishabh Jain

KCS402 – Formal Languages and Automata Theory– Question Bank

Galgotias College of Engineering and Technology, Greater Noida

DEPARTMENT OF COMPUTER SCIENCE &


ENGINEERING
Year / Sem : II / IV
Sub. Code & Subject : KCS402 – Formal Languages and Automata Theory
QUESTION BANK

Unit – I
Sl.
Questions CO PO
No
1 Write down the operations on set. 1 1
2 List any three applications of Automata Theory. 1 1
3 Define Finite Automation. 1 1
4 Define Deterministic Finite Automation. 1 1
5 Define Non-Deterministic Finite Automation. 1 1
6 Define NFA with  transition. 1 1
7 Design FA which accepts odd number of 1‟s and any number of 0‟s. 1 2,3
8 Design FA to check whether given unary number is divisible by three. 1 2,3
9 Design FA to check whether given binary number is divisible by three. 1 2,3
10 Design FA to accept the string that always ends with 00. 1 2,3
Obtain the  closure of states q0 and q1 in the following NFA with 
11 1 2
transition.
12 Obtain  closure of each state in the following NFA with  move. 1 2
13 Explain a transition diagram. 1 1
14 Explain a transition table. 1 1
15 Explain the transition function. 1 1
16 Differentiate DFA and NFA? 1 2
17 Write notes on Moore Machine. 1 1
18 Write the formal definition of Moore Machine. 1 1
19 Short notes on Mealy Machine. 1 1
20 Write the formal definition of Mealy Machine. 1 1
21 Compare the Mealy and Moore Model? 1 2
22 Design FA to accept the string that always ends with 00. 1 2,3
23 Design FA to check whether given binary number is divisible by three. 1 2,3
Show that “For every NFA, there exists a DFA which simulates the
24 behavior of NFA. If L is the set accepted by NFA, then there exists a 1 2
DFA which also accepts L”.
Show that “If L is accepted by NFA with ε-moves, then there exists L
25 1 2
which is accepted by NFA without ε-moves.
Construct DFA equivalent to the given NFA
0, 1
26 0 1 1 2,3
q0 q1 q2

Page 1 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Let M = ({q0, q1}, {0,1}, δ, q0, {q1}) be NFA. Where δ (q0, 0) = {q0,
27 q1}, δ (q0, 1) = {q1}, δ (q1, 0) = {}, δ (q1, 1) = {q0, q1}. Construct its 1 2,3
equivalent DFA.
Let M = ({q0, q1,q2,q3}, {0,1}, δ, q0, {q2,q3}) be -NFA.
Where δ (q0, 0) = {q0, q1}, δ (q0, 1) = {q1}, δ (q1, 0) = {q2,q3}, δ (q1,
28 ε) = {q1}, δ (q1, 1) = {q0, q1}, δ (q2, 0) = {q2}, δ (q2, ε) = {q3}, δ (q2, 1 2,3
1) = {q0, q3,}, δ (q3, 0) = {q3}, δ (q3, 1) = {q2, q3}, δ (q3, ε) = {q0}.
Construct its equivalent DFA.
Consider the following ε–NFA. Compute the ε–closure of each state and
find it‟s equivalent DFA.
ε a b c
29 p Ф {p} {q} Ф 1 2,3
q {p} {q} {r} Ф
*r {q} {r} ф {p}

30 Convert a NFA which accepts the string ends with 01 to a DFA. 1 2,3
Consider the Moore machine described by the transition diagram given
below. To construct a Mealy machine, which is equivalent to moore
machine 1
q3/ 1

0
q0/ 0
1 0
31 1 2,3
0
0 q2/ 0

1
q1/ 1 1

Consider the Mealy machine described by the transition table given


below. To construct a Moore machine, which is equivalent to mealy
machine?
input = 0 input = 1
Present State
Next State Output Next State Output
32 1 2,3
q1 q3 0 q2 0

q2 q1 1 q4 0

q3 q2 1 q1 1

q4 q4 1 q3 0

Page 2 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Unit – II
Sl.
Questions CO PO
No
1 State regular expression. 2 1
2 How the kleen‟s closure of L can be denoted? 2 1,2
3 How do you represent positive closure of L? 2 1,2
Write the regular expression for the language accepting all combinations
4 2 2,3
of a‟s over the set  = {a}.
Write regular expression for the language accepting the strings which
5 2 2,3
are starting with 1 and ending with 0, over the set  = {0,1}.
6 Show that (0*1*)* = (0+1)*. 2 2
7 Show that (r+s)*  r* + s*. 2 2
If L = { The language starting and ending with „a‟ and having any
8 2 2,3
combinations of b‟s in between, that what is r?
Give regular expression for L= L1  L2 over alphabet {a,b}
9 where L1 = all strings of even length 2 2,3
L2 = all strings starting with „b‟.
10 Explain the application of the pumping lemma. 2
Describe the following by regular expression
a. L1 = the set of all strings of 0‟s and 1‟s ending in 00.
11 2 2,3
b. L2 = the set of all strings of 0‟s and 1‟s beginning with 0 and
ending with 1.
12 Show that (r*)* = r* for a regular expression r. 2 2
13 Write down the closure properties of regular language. 2 3
14 What is pumping lemma? 2 2
15 State Arden‟s theorem. 2 1
16 What is dead state? 2 2
Show that „r‟ be a regular expression, the there exists an NFA with 
17 2 2
transitions that accepts L{r}.
Construct the NFA with  for the regular expression using Thomson
construction method.
18 2 2,3
a. 0(0+1)*100
b. a(a+b)*b
Obtain the equivalent DFA from the following regular expressions
19 a. (a+b)*abb 2 2,3
b. (00+11)*(0+1)*
Show that the following languages are not regular using pumping lemma
20 a. L={0i 1i ; i>=1} 2 2,3
b. L={ap ; p is prime}
Find the regular expression for the set of all strings denotes by (R 13)2
from the deterministic finite automata given below

21 2 2,3

Page 3 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Obtain the regular expression using Arden‟s theorem from the given
DFA.
0 1

1
qq21 q2
22 2 2,3
1
0 0

q3

Obtain the regular expression using state elimination method from the
given DFA.
0 1

1
qq21 q2
23 2 2,3
1
0 0

q3

Unit – III
Sl.
Questions CO PO
No
1 Obtain the Right Linear Grammar from the given Left Linear Grammar 3 1
Let G = ( {S,C}, {a,b}, P,S} where P consists of S  aCa, C aCa,
2 3 2
Find L(G))?
Consider G whose productions are S aAS/ a ,ASbA / SS / ba, show
3 3 2
that S aabbaa and construct a derivation tree.
4 Find L(G) where G = ({S},{0,1}, {S0S1, sε },S) 3 2
5 Construct a CFL from the given grammar S aaA, AS / a 3 2
6 Define a derivation tree for CFG. 3 1
7 Construct CFG L= { anbn ; n≥1}. 3 2,3
8 Find a LM derivation for aaabbabbba with the productions. 3 2
9 Find L(G), S  aSb, S  ab. 3 2
Show that id* id can be generated by two distinct leftmost derivation in
10 3 2
the grammar

Page 4 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Write a CFG for the set of strings which does not produce any
11 3 2
palindromes.
Find the derivation tree for the grammar G = ( {S, A, B}, {a,b}, P, S}
Where P is given by
12 S  Aa / bB 3 2
Aab
B aBb / a
13 Define parse tree. 3 1
14 What are the two major normal forms for context-free grammar? 3 2
15 What is a useless symbol? 3 2
16 Define Nullable Variable? 3 1
Let G = (V, T, P,S) with the productions given by
S  aSbS/ B / ε
17 3 2
B abB
Eliminate the useless production.
18 What is a useful production? 3 2
Determine whether the grammar G has a useless production?
SA
19 3 2
AaA / ε
B  bA
20 Write a procedure to eliminate ε production. 3 2
21 Write the procedure to eliminate the unit productions. 3 2
22 Define CNF. 3 1
23 Define GNF. 3 1
Consider the Grammar G whose productions are
S  0B / 1A
A  0 / 0S / 1AA
24 B  1 / 1S / 0BB and the string 0110 3 2
a. Find the left most derivation and associated derivation tree.
b. Find the right most derivation and associated derivation tree.
c. Show that the G is ambiguous.
d. Find L(G)
Consider the Grammar whose productions are
S  aAS / a
25 A  SbA / SS / ba 3 2
a. Construct a LMD and RMD Tree for S =>* aabbaa
b. Find the above grammar is ambiguous or unambiguous.
Construct Right Linear Grammar from the given Finite Automata

1 0

0 1 qB2
26 S A 3 2,3

0
1

Page 5 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Construct Left Linear Grammar from the given Finite Automata

27 3 2,3

Construct a Finite Automata from the following Right Linear Grammar


a) A → aB/bA/b
B → aC/bB
C → aA/bC/a
28 3 2,3
b) S  A / B / ε
A  /1B/0
B  0S/1A/1
Construct a Finite Automata from the following Left Linear Grammar
a) A  Ba/Ab/b
B  Ca/Bb
C  Aa/Cb/a
29 3 2,3
b) S → Aab / Aba / B / ε
A→ Sb / b
B → Sa
C→ε
Consider the grammar
S→ 0A0 / 1B1 / BB
A→ C
B→ S / A
30 3 2,3
C→ S / ε and simplify using the same order
a. Eliminate ε-Productions
b. Eliminate unit productions
c. Eliminate useless symbols
Let G be the following grammar with productions:
a) S  bA / aB
A  bAA / aS / 
B  aBB / bS / b. Convert the above grammar G into CNF
31 3 2,3
b) S→ 0A0 / 1B1 / BB
A→ C
B→ S / A
C→ S / ε. Convert the above grammar G into CNF
Find the GNF equivalent of the given grammar
32 3 2,3
S  AA / 0 A SS / 1
Consider the Grammar G = ({S,A,B},{a,b}, P, S} as the productions
S → AB
33 A → BS / b 3 2,3
B → SA / a Convert it into GNF.

Page 6 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Unit – IV
Sl.
Questions CO PO
No
1 Define pushdown automaton. 4 1
What are the different ways of language acceptances by a PDA and
2 define them. 4 2

Construct a PDA that accepts the language generated by the grammar


3 4 2,3
S aSbb / aab
Construct a PDA that accepts the language generated by the grammar
4 4 2,3
S  aABB , A  aB / a , B  bA / b
5 How do you convert CFG to a PDA. 4 2
6 Define Deterministic PDA. 4 1
Is it true that NDPA is more powerful than that od DPDA? Justify your
7 4 2
answer.
Is it true that the language accepted by a PDA by empty stack and final
8 4 2
states are different languages.
What is the additional feature PDA has when compared with NFA? Is
9 4 2
PDA superior over NFA in the sense L acceptance? Justify your answer.
Prove that if L=N(PN) for some PDA PN = (Q, Ʃ, , δ, q0, Z0, F), then
10 4 1,2
there is a PDA PF such that L=L(PF).
Prove that if M1 = (Q, Ʃ, , δ, q0, Z0, F) accept by final state, we can
11 4 1,2
find a PDA M2, accepting L by empty store i.e., L = L(M1) = N(M2).
Construct a PDA that accepts the following languages
a. L= {wcwr | W in (0+1)* } by empty stack or final state
b. L = {wwR ; w  (0+1)*} by empty stack or final state
12 4 2,3
c. L = {0n 1n ; n ≥ 0} accepted by empty stack or final state
d. L = {anbmcmdn; n, m ≥ 1} accepted by empty store and check
whether the string w = aaabcddd is accept or not.
Construct a PDA that will accept the language generated by the grammar
13 G = ({S, A}, {a, b}, P, S) with the productions S  AA / a, A  SA / b 4 2,3
and test whether “abbabb” is in N(M).
Consider the grammar G = (V, T, P, S) and test whether “0101001” is in
N(M). Where Productions are
14 S → 0S/1A/1/0B/0 4 2,3
A → 0A/1B/0/1
B → 0B/1A/0/1
Construct a PDA from the given CFG G = ({S, A}, {a, b}, P, S) where
15 4 2,3
the productions are S  AS / ε and A  aAb / Sb / a
Construct a PDA from the following CFG.
16 G = (V, T, P, S) with V = {S}, T = {a, b, c}, and P = {S → aSa, 4 2,3
S → bSb, S → c}
Convert the PDA P= ({p, q},{0,1},{X,Z0}, δ, q, Z0) to a CFG. Where δ
is given below:
17  (q0, 0, S) = {(q0 , AS)}  (q0, 0, A) = {(q0, AA), (q1, S)} 4 2,3
 (q0, 1, A) = {(q1, )}  (q1, 1, A) = {(q1, )}
 (q1, , A) = {(q1, )}  (q1, , S) = {(q1, )}

Page 7 of 8
GCET – CSE – II Year IV Sem Mr Rishabh Jain
KCS402 – Formal Languages and Automata Theory– Question Bank

Convert the PDA P= ({p, q},{0,1},{X,Z0}, δ, q, Z0) to a CFG , if is


given by
δ(q, 1, Z0) ={(q, XZ0)}
δ(q, 1, X) = {(q, XX)}
18 4 2,3
δ(q, 0, X) = {(p, X)}
δ(q, ε, X) = {(q, ε)}
δ(p, 1, X) = {(p, ε)}
δ(p, 0, Z0) = {(q, Z0)}

Unit – V
Sl.
Questions CO PO
No
1 What is a Turning Machine? 5 1
2 Define a Turing Machine. 5 1
3 Define Instantaneous description of TM. 5 1
4 What are the applications of TM? 5 1
What are the required fields of an instantaneous description or
5 5 1
configuration of a TM.
6 Differentiate PDA and TM. 5 2
7 Define Universal TM 5 1
8 When is a function f said to be Turing computable? 5 2
9 Explain the Class of Grammars. 5 1
10 Discuss about PCP. 5 2
11 Differentiate PCP and MPCP. 5 2
Design a TM to recognize the language L ={anbn; n>0} and test whether
12 5 2,3
the strings “aabb” is accepts or not.
Design a TM to recognize the language L ={wwr ; w  (a+b)*} and test
13 5 2,3
whether the strings “abba” is accepts or not.
14 Design a TM to recognize the language L ={wcwr ; w  (0+1)*}. 5 2,3
15 Design a Turing machine to compute proper subtraction m-n. 5 2,3
16 Explain the class of Grammars with example. 5 1,2
17 Explain the PCP and MPCP with example 5 1,2

Page 8 of 8

You might also like