Question Bank
Question Bank
UNIT – 1
12 Find the language represented by the finite automata given below. Write 4 sample 2
strings that will be accepted by the automata
13 Identify the language represented by the finite automata given below. Write 4 sample 2
strings that will be accepted by the automata
14 Find the language represented by the finite automata given below. Write 4 sample 2
strings that will be accepted by the automata
15 Find ε-closure for all the states for the ε-NFA given below. 2
16 Find ε-closure for all the states for the ε-NFA given below. 2
17 Consider the Deterministic Finite Automata whose transition table is given below. 2
Assume that q0 is the initial state and q2 is the final state. Check whether the input
‘abaab’ is accepted by the DFA.
State/Input a b
q0 q1 q0
q1 q1 q2
q2 q1 q0
18 Consider the Deterministic Finite Automata whose transition table is given below. 2
Assume that q0 is the initial state and q2 is the final state. Check whether the input
‘010100’ is accepted by the DFA.
State/Input 0 1
q0 q1 q0
q1 q2 q1
q2 q1 q2
19 Consider the Non Deterministic Finite automata given below. Write the formal 2
definition of the NFA.
20 Consider the Non Deterministic Finite automata given below. Check whether the 2
string ‘aabaa’ is accepted by the NFA by picturizing all possible transitions.
21 Prove by contradiction that √ 2 is irrational 5
22 Prove that for every integer n ≥ 0 , n3 +2 n is divisible by 3 5
23 Apply the principle of mathematical induction and prove that for all positive integers 5
n, the statement given below is true.
n
n(n+1)(2n+ 1)
∑ i 2= 6
i=1
24 Apply the principle of mathematical induction and prove that for all positive integers 5
n, the statement given below is true.
n(n+1)
1+2+3+…+ n=
2
25 Apply the principle of mathematical induction and prove that for all positive integers 5
n, the statement given below is true.
n 2 2
n (n+1)
∑i = 4
3
i=1
26 Design a Deterministic Finite Automata (DFA) that takes a binary string as input and 5
accepts the string only if the last two digits are the same (either 00 or 11). Write the
formal definition of the DFA. Also show that the string 10100 is accepted by the DFA
27 Design a Nondeterministic Finite Automata (NFA) that takes a binary string as input 5
and accepts the string only if the last two digits are the same (either 00 or 11). Write
the formal definition of the NFA. Also show that the string 01011 is accepted by the
NFA
28 Design a Deterministic Finite Automata (DFA) that accepts strings having ‘ab’ as a 5
substring over 𝚺={a,b}. Write the formal definition of the DFA. Also show that the
string aabaa is accepted by the DFA
29 Design a Nondeterministic Finite Automata (NFA) to accept strings that end with’ab’ 5
over 𝚺={0,1}. Write the formal definition of the NFA. Also show that the string
aabab is accepted by the NFA by picturizing all possible transitions
30 Construct a Deterministic Finite Automata (DFA) to accept strings having odd number 5
of 1’s over 𝚺={0,1}. Write the formal definition of the DFA. Also check whether the
string 010110 is accepted by the DFA or not.
31 Construct a Nondeterministic Finite Automata (NFA) to accept strings that end with 5
101 over 𝚺={0.1}. Write the formal definition of the NFA. Also show that the string
00101 is accepted by the NFA by picturizing all possible transitions
32 Design a Deterministic Finite Automata (DFA) to accept strings that start and end with 5
different symbols over𝚺={0,1}. Write the formal definition of the DFA. Also show
that the string 110100 is accepted by the DFA
33 Design a Nondeterministic Finite Automata (NFA) to accept strings that start and end 5
with different symbols over𝚺={0.1}. Write the formal definition of the NFA. Also
show that the string 110100 is accepted by the NFA by picturizing all possible
transitions
34 Design a Deterministic Finite Automata (DFA) to recognize the language containing 5
strings having at least three 1s over𝚺={0,1}. Write the formal definition of the DFA.
Also show that the string 110100 is accepted by the DFA
35 Design a Nondeterministic Finite Automata (NFA) to recognize the language 5
containing strings having at least three 1s over𝚺={0,1}. Write the formal definition of
the NFA. Also show that the string 110100 is accepted by the NFA by picturizing all
possible transitions
36 Consider the NFA given below which accepts some language L over the alphabet 10
𝚺={a,b}. Construct a DFA that represents the same language L
37 Consider the NFA given below which accepts the language representing the set of all 10
strings having 001 as a substring over the alphabet 𝚺={0,1}. Construct a DFA that
represents the same language
38 Consider the NFA given below which accepts some language L over the alphabet 10
𝚺={0,1}. Construct a DFA that represents the same language L
39 Consider the NFA given below which accepts some language L over the alphabet 10
𝚺={a,b}. Construct a DFA that represents the same language L
40 Consider the NFA given below which represents some language over the alphabet 10
𝚺={0,1}. Construct a DFA that represents the same language
41 A NFA with ε-transitions is given below. Find ε-closure for each state and construct 10
an equivalent NFA without ε-transitions that accepts the same language. Draw its
transition table and mark the initial and final states
42 A NFA with ε-transitions is given below. Find ε-closure for each state and construct 10
an equivalent NFA without ε-transitions that accepts the same language. Draw its
transition table and mark the initial and final states
43 A NFA with ε-transitions is given below. Find ε-closure for each state and construct 10
an equivalent DFA which accepts the same language. Draw its transition table and
mark the initial and final states
44 A NFA with ε-transitions is given below. Find ε-closure for each state and construct 10
an equivalent DFA which accepts the same language. Draw its transition table and
mark the initial and final states
45 A NFA with ε-transitions is given below. Find ε-closure for each state and construct 10
an equivalent DFA that accepts the same language. Draw its transition table and mark
the initial and final states
UNIT – 2
30 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
31 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
32 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
33 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
34 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
35 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
36 Apply Arden’s Theorem and derive the regular expression for the language 5
represented by the given automata
37 Consider the DFA given below. Find the states that are equivalent and construct a 10
minimum state automata equivalent to the given automata. Draw the minimized
automata, write its transition table and mark initial and final states
38 Consider the DFA given below. Find the states that are equivalent and construct a 10
minimum state automata equivalent to the given automata. Draw the minimized
automata, write its transition table and mark initial and final states
39 Consider the DFA given below. Find the states that are equivalent and construct a 10
minimum state automata equivalent to the given automata. Draw the minimized
automata, write its transition table and mark initial and final states
40 Consider the DFA given below. Find the states that are equivalent and construct a 10
minimum state automata equivalent to the given automata. Draw the minimized
automata, write its transition table and mark initial and final states
Next State
Present State
Input (a) Input (b)
s0 s0 s1
s1 s2 s0
s2 s1 s3
s3 s0 s3
s4 s5 s3
s5 s4 s6
s6 s6 s5
s7 s3 s6
41 Consider the DFA given below. Find the states that are equivalent and construct a 10
minimum state automata equivalent to the given automata. Draw the minimized
automata, write its transition table and mark initial and final states
UNIT – 3
3 Formulate a Context Free Grammar for the language containing strings that start with 2
a and end with b over the alphabet set 𝚺={a,b}. Also, mention a few sample strings
in the language
4 Formulate a Context Free Grammar for the language containing strings that have 2
atleast one occurrence of 000 over the set 𝚺={0,1}. Also, mention a few sample
strings in the language
5 Formulate a Context Free Grammar for the language L={a n b 2 n∨n ≥1 } which 2
contains strings having n number of a’s followed by 2n number of b’s over the
alphabet set 𝚺={a,b}. Also, mention a few sample strings in the language
6 Formulate a Context Free Grammar for the language containing strings with 00 as a 2
substring over the alphabet set 𝚺={0,1}. Also, mention a few sample strings in the
language
7 Formulate a Context Free Grammar for the language containing strings having atleast 2
two a’s over the alphabet set 𝚺={a,b}. Also, mention a few sample strings in the
language
8 Formulate a Context Free Grammar for the language L={a n b n∨n ≥ 1} which contains 2
strings having n number of a’s followed by n number of b’s over the alphabet set
𝚺={a,b}. Also, mention a few sample strings in the language
9 Consider the grammar G=(V,T,P,S) where V={S,A},T={a,b} and P is the set of 2
productions given below. Find the language denoted by the given context free
grammar. Also, mention a few sample strings in the language
S → SAS |aS | bS | ε
A → aa
10 Consider the grammar G=(V,T,P,S) where V={S,A},T={a,b} and P is the set of 2
productions given below. Find the language denoted by the given context free
grammar. Also, mention a few sample strings in the language
S → aSbb | A
A → abb
11 Consider the grammar G=(V,T,P,S) where V={S,A},T={0,1} and P is the set of 2
productions given below. Find the language denoted by the given context free
grammar. Also, mention a few sample strings in the language
S → 0A1 | 1A0
A → 0A | 1A | ε
12 Consider the grammar G=(V,T,P,S) where V={S, A, T},T={0,1} and P is the set of 2
productions given below. Find the language denoted by the given context free
grammar. Also, mention a few sample strings in the language
S → ATA
A → 0A | 1A | ε
T → 000
13 Consider the grammar G=(V,T,P,S) where V={S},T={a,b} and P is the set of 2
productions given below. Find the language denoted by the given context free
grammar. Also, mention a few sample strings in the language
S → aSa | bSb | a | b | ε
14 Consider the grammar G=(V,T,P,S) where V={E},T={ + , * , ( , ) , id } and P is the 2
set of productions given below. Find the language denoted by the given context free
grammar. Also, mention a few sample strings in the language
E → E+E | E*E | (E) | id
15 Compare the closure properties of regular languages and context free languages with 2
respect to the following operators.
i) Union
ii) Intersection
iii) Compliment
iv) Concatenation
16 If L1 and L2 are two context free languages, what can you say about the languages 2
given below? Are they context free?
i) L1UL2
ii) L1∩L2
iii) L1*
iv) L1 L2
17 If L1 and L2 are two context free languages, what can you say about the languages 2
given below? Are they context free?
v) Compliment of L2
vi) L1∩L2
vii) Substitution of L1
viii)Homomorphism of L2
18 What is an ambiguous grammar? Give an example. 2
19 List the two normal forms for writing Context Free Grammar. 2
20 State pumping lemma for context free languages. 2
21 Tabulate the different types of grammar in Chomsky’s hierarchy, the language 5
accepted be each grammar and the corresponding automata
22 Justify that the language {0 n 1n 2n∨n ≥ 1} over the alphabet 𝚺={0,1,2} is not context 5
free using pumping lemma
23 Justify that the language {0i 1 j 2i 3 j∨i , j ≥1 } over the alphabet 𝚺={0,1,2,3} is not 5
context free using pumping lemma
24 Justify that the language {0i 1 j 2k ∨i< j< k } over the alphabet 𝚺={0,1,2} is not context 5
free using pumping lemma
25 Justify that the language {a p∨ p is prime } over the alphabet 𝚺={a} is not context free 5
using pumping lemma
26 Write leftmost, rightmost derivations and depict the corresponding parse tree for the 5
string ((a,a),(a,a)) from the given grammar
S → (L) | a
L → L, S | S
27 Write leftmost, rightmost derivations and depict the corresponding parse tree for the 5
string aabbbb from the given grammar
S → aSbb | A
A → abb
28 Consider the following Context Free Grammar 5
S → aB | bA
A→a | aS | bAA
B→b | bS | aBB
For the input string abbaab find
a) Leftmost Derivation
b) Rightmost Derivation
c) Parse Tree
29 Write leftmost, rightmost derivations and depict the corresponding parse tree for the 5
string 1000111 from the given grammar.
S → T00T
T → 0T | 1T | ℇ
30 Write leftmost, rightmost derivations and depict the corresponding parse tree for the 5
string 00110101 from the given grammar
S → 0B | 1A
A → 0 | 0S | 1AA
B → 1 | 1S | 0BB
31 Consider the following Context Free Grammar 5
S → aAS
S→ a
A→ SbA
A→ SS
A→ ba
For the input string aabbaa find
a) Leftmost Derivation
b) Rightmost Derivation
c) Parse Tree
32 Write leftmost, rightmost derivations and depict the corresponding parse tree for the 5
string ababbb from the given grammar
S → AB |ε
A → aB
B → Sb
33 Write leftmost, rightmost derivations and depict the corresponding parse tree for the 5
string babba from the given grammar
S → Aa | bB | ℇ
A → bS |ℇ
B → aA
34 Consider the following Context Free Grammar 5
S→AB | 0
A→BC | 1
B→CD | 2
C→AD | 0
D→1
For the input string 01112 find
a) Leftmost Derivation
b) Rightmost Derivation
c) Parse Tree
35 Consider the grammar G=(V,T,P,S) where V={S},T={a,b} and P is the set of 5
productions given below. Find the symbols which are nullable and eliminate ε-
productions from the grammar
S → Aa | bB | ε
A → bS |ε
B → aA
36 Consider the grammar G=(V,T,P,S) where V={E,T,F}, T={ +, *, (, ), id } and P is the 5
set of productions given below. Write all unit pairs and rewrite the grammar without
unit productions
E → E+T | T
T → T*F |F
F → ( E ) | id
37 Find the symbols that are not generating and not reachable. Analyze the context free 5
grammar given below and eliminate such useless symbols from the grammar if
present
S → AS | 1SA | BS | 2
A → 0BC | 1
B→C
C → 0C | 0
D→0|2
38 Optimize the grammar given below by eliminating ε-productions, unit productions 5
and useless symbols
S → aAA | ε
A → aS | bS | ε
46 Find the symbols that are not generating and not reachable. Analyze the context free 5
grammar given below and eliminate such useless symbols from the grammar if
present
S → AB|CA
A→a
B → BC|AB
C → aB |b
D → aA|d
47 Rewrite the grammar in Chomsky Normal Form (CNF). If needed, optimize the 10
grammar before rewriting
S → ATA
A → 0A | 1A | ε
T → 000
48 Rewrite the grammar in Chomsky Normal Form (CNF). If needed, optimize the 10
grammar before rewriting
S → Aa | bB | ε
A → bS | ε
B → aA
49 Rewrite the grammar in Chomsky Normal Form (CNF). If needed, optimize the 10
grammar before rewriting
S → SAS |aS | bS | ε
A → aa
50 Rewrite the grammar in Chomsky Normal Form (CNF). If needed, optimize the 10
grammar before rewriting
E → E+T | T
T → T*F | F
F → (E) | I
I → Ia | Ib | I0 | I1 | a | b
51 Rewrite the grammar in Chomsky Normal Form (CNF). If needed, optimize the 10
grammar before rewriting
S → (L) | a
L → L,S | S
52 Optimize the given Context Free Grammar if needed and put the resulting grammar in 10
Greibach Normal Form (GNF)
S → AB
A → BS | b
B → SA | a
53 Optimize the given Context Free Grammar if needed and put the resulting grammar in 10
Greibach Normal Form (GNF)
S →ABA
A →aA |ℇ
B→bB |ℇ
54 Optimize the given Context Free Grammar if needed and put the resulting grammar in 10
Greibach Normal Form (GNF)
S → XY
X → YS | a
Y → SX | b
55 Optimize the given Context Free Grammar if needed and put the resulting grammar in 10
Greibach Normal Form (GNF)
S → CA | BB
B → b | SB
C→b
A→a
56 Optimize the given Context Free Grammar if needed and put the resulting grammar in 10
Greibach Normal Form (GNF)
S→A | 0C1
A→B | 01 | 10
C→ CD | ε
UNIT – 4
30 Design a Pushdown Automata for the language representing a’s followed by b’s and 5
the number of a’s and b’s must be the same.
n n
L={a b ∨n ≥1 }
Write the logic for the design and the formal definition.
31 Design a Pushdown Automata for the language representing 0’s followed by 1’s and 5
the number of 0’s and 1’s must be the same.
n n
L={0 1 ∨n ≥ 1}
Write the logic for the design and the formal definition.
32 Design a Pushdown Automata for the language representing a’s followed by b’s and 5
the number of b’s must be twice than that of a’s.
n 2n
L={a b ∨n≥ 1 }
Write the logic for the design and the formal definition.
33 Design a Pushdown Automata for the language representing 0’s followed by 1’s and 5
the number of 1’s must be twice than that of 0’s.
n 2n
L={0 1 ∨n ≥1 }
Write the logic for the design and the formal definition.
34 Design a Pushdown Automata for the language representing strings having equal 5
number of 0’s in the front and the back and any number of 1’s in between.
n m n
L={0 1 0 ∨n ≥ 1}
Write the logic for the design and the formal definition.
35 Design a Pushdown Automata for the language representing strings having equal 5
number of a’s in the front and the back and any number of b’s in between.
n m n
L={a b a ∨n ≥ 1}
Write the logic for the design and the formal definition.
36 Convert the Pushdown Automata given below to a Context Free Grammar. 10
M=({s0,s1},{a,b},{Z0,a},δ,s0,Z0,ϕ) where δ is defined as
δ(s0,a,Z0)={(s0,aZ0)}
δ(s0,a,a)={(s0,aa)}
δ(s0,b,a)={(s1,ε)}
δ(s1,b,a)={(s1,ε)}
δ(s1,ε,Z0)={(s1,ε)}
37 Convert the Pushdown Automata given below to a Context Free Grammar. 10
M={q0,q1},{0,1},{X,Z0},δ, q0,Z0} where δ is defined as
δ(q0,0,Z0)={(q0,XZ0)}
δ(q1,1,X)={(q1,ℇ)}
δ(q0,0,X)={(q0,XX)}
δ(q1,ℇ,X)={(q1,ℇ)}
δ(q0,1,X)={(q1,ℇ)}
δ(q1,ℇ,Z0)={(q1,ℇ)}
Write the logic used for the design and the formal definition
UNIT – 5
35 What is Post Correspondence Problem (PCP)? Apply PCP for the dominos given 10
below.
{
ab ba b abb a
, , ,
aba abb ab b bab
, }
36 What is Post Correspondence Problem (PCP)? Apply PCP for the dominos given 10
below.
{
1 0 20 012
, , ,
20 01 0 2 }
37 What is Post Correspondence Problem (PCP)? Apply PCP for the dominos given 10
below.
{
B A CA ABC
,
CA AB A
, ,
C }
UNIT VI
20 Apply non deterministic Turing Machine to solve class NP Problem with polynomial time 10
complexity
21 Outline the concept of polynomial time reductions 10
22 What are tractable problems? Compare it with intractable problems 10