RN SHETTY TRUST®
RNS INSTITUTE OF TECHNOLOGY
Autonomous Institution Affiliated to VTU, Recognized by GOK, Approved by AICTE
(NAAC ‘A+ Grade’ Accredited, NBA Accredited (UG - CSE, ECE, ISE, EIE and EEE)
Channasandra, Dr. Vishnuvardhan Road, Bengaluru - 560 098
Ph:(080)28611880,28611881 URL: www.rnsit.ac.in
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
Question Bank
SUBJECT CODE AND TITLE BCS503 Theory of Computation
SCHEME
2022 BATCH 2022-26
SEMESTER& SECTION VA
FACULTYNAME Dr. Girijamma H A
Module -1
Q. Bloom’s
Questions COs
No. LL
1. What is an alphabet? What is power of an alphabet? Give examples L1 CO1
2. What are the two variations of power of an alphabet? Explain L1 CO1
Define the terms with example :
3. L2 CO1
a) Length b) Concatenation c) Replication d) Reversal
Define the terms:
4. a) Substring b) proper substring c) prefix d) proper prefix e) suffix f) L2 CO1
proper suffix
5. List all the substrings and proper substrings of string “HELLO” L2 CO1
6. What are the applications of Theory of Computations? L2 CO1
Obtain a DFA to accept strings of a’s and b’s except those containing the
7. L4 CO1
substring aab.
Obtain a DFA to accept strings of a’s and b’s having exactly one a, at least
8. L4 CO1
one a, not more than three a’s
Obtain a DFA to accept strings of a’s and b’s having even number of a’s
9. L4 CO1
and b’.
10. Obtain a DFA to accept strings of 0’s, 1’s and 2’s beginning with a ‘0’
L4 CO1
followed by odd number of 1’s and ending with a ‘2’.
11.
What is regular language? What are the applications of finite automation? L1 CO1
12.
What is the difference between DFA and NFA? L1 CO1
13.
Give a general procedure to convert an NFA to DFA. L2 CO2
14. Consider the following €-NFA. L6 CO2
a. Compute the €-closure of each state
b. Give the set of all strings of length 3 or less accepted by the automaton
1
c. Convert the automaton to DFA.
Determine the minimized DFA for the following :
∂ a b
A B A
B A C
15. C D B L6 CO2
*D D A
E D F
F G E
G F G
H G D
Module -2
Q. Bloom’s
Questions COs
No. LL
1. Obtain a regular expression representing L3 CO1
a) strings of a’s and b’s having even length.
b) strings of a’s and b’s having odd length.
c) strings of a’s and b’s with alternate a’s and b’s or no two consecutive letters are
same.
2. Obtain a regular expression such that L(R) = {w | w ↋ {0,1}* L3 CO1
with at least three consecutive 0’s.
3. Obtain a regular expression representing L3 CO1
a) strings of a’s and b’s ending with ‘b’ and has no substring aa.
b) strings of 0’s and 1’s having no two consecutives zeros.
c) strings of a’s and b’s starting with ‘a’ and ending with ‘b’.
4. Obtain a regular expression representing L3 CO1
a) language L={w: |w| mod 3=0 where w ↋(a,b)*}
b) language l={w : na(w) mod 3=0 where w ↋(a,b)*}
5. What is a grammar? What are various types of grammars? Or L2 CO3
Explain Chomsky Hierarchy? Or Explain the classification of grammars
6. Obtain grammar to generate strings of a’s and b’s having a substring ab L3 CO2
7. Prove that the following languages are not regular L3 CO4
i) {0n1m2n | n, m>=1}
ii){0n12n | n>=1 }
8. What is homomorphism? Explain with example L1 CO4
9. State and prove Pumping Lemma. L2 CO4
10. Obtain a regular expression representing L4 CO1
a) strings of a’s and b’s containing not more than three a’s.
b) the language L={an bm : n≥ 4, m≤ 3}
c) strings of a’s and b’s whose length are multiples of 3.
Module -3
Q. Bloom’s
Questions COs
No. LL
1. Obtain a grammar to generate the following languages L5 CO3
a) L={an bn : n≥ 0}
b) L={an+1bn : n≥ 0}
c) L={an bn+1 : n≥ 0}
d) L={an bn+2 : n≥ 0}
e) L={an b2n : n≥ 0}
2. Obtain a grammar to generate set of all palindromes over ∑={a,b} L5 CO3
3. Obtain a grammar to generate integers. Show the derivation for the unsigned L5 CO3
number 1965 and signed number +1965.
4. Obtain a reduced grammar for the grammar shown below L4 CO3
2
S ->aAa
A-> Sb | bCC | Ada
C-> ab | aD
E->aC
D->aAD
5. Remove the unit productions from the grammar L4 CO3
S -> A | B | Cc
A ->aBb | B
B ->aB | bb
C-> Cc | B
6. Write a CFG for arithmetic evaluation without explicitly specifying L4 CO3
precedence and associatively.
Note:
i) + and – should be given higher precedence when compared to * and /.
ii) Right precedence for operators.
7. Simplify the following CFG and convert it into CNF L5 CO3
S ->AaB | aaB
A -> ϵ
B ->bbA | ϵ
8. Eliminate the useless symbols in the grammar L4 CO3
S ->aA | bB
A ->aA | a
B ->bB
D -> ab | Ea
E ->aC | d
9. Eliminate left recursion from the following grammar L4 CO3
S -> Ab | a
A -> Ab | Sa
10. Eliminate all ϵ productions from the grammar L4 CO3
S -> BAAB
A ->0A2 | 2A0 |ϵ
B -> AB | 1B |ϵ
11. Define a)PDA b)Deterministic PDA c) Computation in PDA d) String L1 CO1
accepting PDA e) String reject in PDA
12. Design a PDA for the following language :L= {wcwR: wε {a,b}*}. L5 CO1
Also Draw the transition diagram. Write the computation (sequence of all
configurations) for the input string 'abacaba' and ‘abcab’
13. Design PDA along with transition diagram for the following language: L5 CO1
L = {anbn | n >=0 }.
Write the computation (sequence of all configurations) for the input string
'aabbb' and ‘aabb’.
14. Construct PDA for the following language with transition diagram. L5 CO1
a. String of balanced parentheses.
b. L={anb2n|n>=1 }
c. L= {wwR{wε {a,b}*}.
d. L={w€{a,b}*: #a(w) = #b(w)}
Module -4
Q. Bloom’s
Questions COs
No. LL
1. Convert the following CFG to PDA that accepts the same language by empty L4 CO3
stack
a) S->aABC
A->aB|a
B->bA|b
3
C->a
b) S->0S1|A
A->1A0|S|Ɛ
2. Convert the following grammar to CNF:
S->ASB| Ɛ
L4 CO3
A->aAS|a
B->SbS|A|bb
3. Convert the following into CNF CO3
S->aAD
A->aB|bAB L4
B->b
D->d
4. Eliminate Useless symbols from the following grammar: CO3
S->AB|CA
A->a L4
B->BC|AB
C->aB|b
5. Convert to CNF:
I. S -->aSa|bSb|a|b|aa|bb
L4 CO3
II. S -->bA|aB, A->bAA|aS|a, B ->aBB|bS|b
III. S->0A0|1B1|BB, A->C, B->S|A, C -->S| ε
6. Using pumping lemma for CFL prove that below languages are not context
free
L3 CO3
I. (0p | p is a prime)
II. (anbnci | i≥ n}
7. Eliminate the useless symbols from S->aS | A | C, A->a, B->aa, C->aCb L4 CO3
8. Eliminate non-reachable symbols from G= ({S, A}, {a}, {S->a, A->a), S) L4 CO3
9. Draw the dependency graph as given above. A is non-reachable from S.
L3 CO3
After eliminating A, G1= ((S), {a}, {S ->a), S)
10. Eliminate non-reachable symbols from S ->aS | A, A ->a, B->aa
L3 CO3
11. Eliminate useless symbols from the grammar
P= {S->aAa, A->Sb | bCC, C ->abb, E ->aC}
P= {S->aBa | BC, A->aC | BCC, C->a, B->bcc, D ->E, E ->d} L3 CO3
P= {S->aAa, A ->bBB, B ->ab, C ->aB}
P= {S->aS | AB, A->bA, B ->AA)
Module -5
Q. No. Bloom’s
Questions COs
LL
1. Explain the Turing machine model. L1 CO1
2. What is an Id with respect to TM?. L1 CO1
3. Define move of a TM. L2 CO1
4. What language is accepted by TM? L2 CO1
5. What is a recursively enumerable language? L2 CO1
n n
6. Obtain a Turing machine to accept the language L={0 1 |n≥1}. L5 CO1
7. Obtain a Turing machine to accept the language L(M)={0n1n2n|n≥Є1}. L5 CO1
*
8. Obtain a TM to accept the language L={w | w Є(0+1) } containing the sub
L5 CO1
string 001.
9. Obtain a Turing machine to accept the language containing strings of 0’s and
L5 CO1
1’s ending with 011.
4
10. Obtain a Turing machine to accept the language L={w| w is even and
L5 CO1
∑={a ,b}} .
11. Obtain a Turing machine to generate language L = {ww| w Є{a ,b}*}.
L5 CO1
12. Obtain a Turing machine to accept a palindrome of even length where w Є
L5 CO1
{a , b}*.
13. Obtain a Turing machine to accept a palindrome of odd length where w Є
L5 CO1
{a ,b}*.
14. Design a Turing machine to accept strings of a’s and b’s such that string
L5 CO1
ends with either ab or ba.
15. What are the various techniques for TM constructions?
L2 CO1
16. Design a Turing machine to add two unary numbers separated by the
L5 CO1
delimiter 1.
17. Design a Turing machine to multiply two unary numbers separated by the
L5 CO1
delimiter 1.
18. Write a short note on the following variations of Turing machine with stay-
L2 CO1
option,Turing machine with multiple tracks
19. What is algorithm? Is the algorithm can be executed by Turing machine?
L2 CO5
20. What is recursively enumerable language? What is recursive language?
L2 CO5
21. Define decidable language and undecidable language.
L2 CO5
22. Prove that DFA is a decidable language.
L2 CO5
Course Coordinator Module Coordinator Program Coordinator/ HOD