0% found this document useful (0 votes)
33 views7 pages

TOC Question Bank

The document is a question bank for the Theory of Computation course, covering various topics such as DFA, NFA, regular expressions, context-free grammars, and PDAs. It includes definitions, design tasks for automata, and proofs related to regular languages and grammars. The questions are structured into modules and focus on both theoretical concepts and practical applications in automata theory.

Uploaded by

Rakshitha T
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)
33 views7 pages

TOC Question Bank

The document is a question bank for the Theory of Computation course, covering various topics such as DFA, NFA, regular expressions, context-free grammars, and PDAs. It includes definitions, design tasks for automata, and proofs related to regular languages and grammars. The questions are structured into modules and focus on both theoretical concepts and practical applications in automata theory.

Uploaded by

Rakshitha T
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/ 7

Department of Information Science & Engineering

QUESTION BANK
Semester: V Section: ‘A’ & ‘B’
Subject Name & Code: Theory of Computation [BCS503]
MODULE-1

1) a. Define a DFA and language accepted by it.


b. Define (i)Alphabet (ii) Power of an alphabet (iii) String (iv) Language v) Length of string
iv) Concatenation of strings v) string reversal
2) Write the DFSM for the following languages and List a string belonging to the L and a stringnot
belonging to L.
i) The set of all strings ending with abb and show the sequence of moves made by the
DFA forthe strings ababb and aab.
ii) The set of all strings not containing substring abb.
iii) The set of all strings with number of a’s is multiple of 3 and number of b’s is multiples of 5.
iv) Set of all strings such that number of 1’s is even and number of 0’s is a multiple of 3 on
∑={0,1}.
v) Design a DFSM for the L={w: |w| mod 5 ≥ |w| mod 3} on ={0,1}.
vi) L= {wϵ{0,1}* : w has 001 as a substring}
vii) To accept string of 0’s,1’s and 2’s beginning with a ‘0’ followed by odd number of 1’s
andending with a ‘2’ over ∑={0,1,2}.
viii) To accept the string of a’s and b’s ending with ab or ba.
ix) Set of all strings with exactly three consecutive a’s
x) Obtain a DFA to accept the language L={ w:|w|mod5≠0} on ∑={a}
3) Design a DFA which accepts set of all strings of 0’s and 1’s begins with 1 that when interpreted as
binary integer is multiple of 5.ex: 101, 1010,1111 are in the language and 0,0101are not.
4) Construct a DFA to accept decimal strings divisible by 3
5) Build a Nondeterministic FA for each of the following languages. List a string belonging tothe L and
a string not belonging to L.
i. L={w|w ϵ ababn or aban where n≥0}
ii. To accept the string of a’s and b’s ending with ab or ba.
6) Obtain a DFA to accept strings of a’s and b’s having
A. Even number of a’s and Even number of b’s
B. Even number of a’s and Odd number of b’s
C. Odd number of a’s and Even number of b’s
D. Odd number of a’s and Odd number of b’s
7) Define ε-NFA and ε − 𝐶𝐿𝑂𝑆𝑈𝑅𝐸 .Obtain an NFA for the following regular expressions.
i)a* +b* +c* ii)(a+b)* aab (a+b)* iii) (0+1)*1(0+1)
8) Obtain the DFA for the following NFA using subset Evaluation method

δ 0 1
→p {p,q} {p}
{r}
q ∅
*r {p,r} {q}
9) Design NFA’s to recognize the following set of strings:
i) lab, cab and dab. Assume the alphabet is{a,b,c,d,l}
ii) 1101,101 and 111.Assume the alphabet is { 0,1}
Prepared by Dr. Nandini S, ISE, SJCIT page 1
Convert each of your NFA’s from i) and ii) to DFA’s.
10) Convert the following ε-NFA to DFA

11) Consider the following ε-NFA

δ ε 0 1
→p {r} {q} {p,r}
q ∅ {p} ∅
*r {p,q} {r} {p}
i) Compute -Closure for each state.
ii)Convert automaton to DFA.
iii) Give the set of all strings of length 3 or less accepted by the automaton.
12) Convert the following NFA to its equivalent DFA

MODULE-2
1) Define Regular expression and write the regular expression for the following:
( i)L={a2n b2m+1 | m≥0, n≥0 } (ii)L={ an bm | m+n is even } (iii)L={ an bm | m≤3, n≥4 }
iv)L={anbm | m≥1, n≥1, nm≥3} v) String of a’s and b’s having even length of a’s followed by odd
length of b’s. vi)String of a’s and b’s whose length is either evenor multiples of 3 or both.
2) Obtain a regular expression to accept the words with two (or) more letters but beginning andending
with the same letter over the input {a,b}.
3) Obtain the regular expression to accept strings of a’s , b’s,c’s such that 4th symbol from the
right is a and ends with b.
4) Give the regular expression for the following languages
i) L={w: |w| mod 4=0 } on ∑={a,b}.
ii) L={w: w contains even number of 0’s followed by odd number of 1’s}.
iii) L={w∈ {a,b}* | w has exactly one pair of consecutive a’s}.
iv) Set of all strings not ending in substring ‘ab’ over ∑={a,b}.
5) Write the regular expression for the following
i) {w ∈ {a, b}*: every a in w is immediately preceded and followed by b}.
ii) {w ∈ {a, b}* : w does not end in ba}.
iii) {anbm | m>=1, n>=1 nm>=3 } (Feb2021)
iv) {w ∈ {0, 1}* : w has 001 as a substring}.
v) {w ∈ {a, b}* : w has both aa and bb as substrings}.
vi) {w ∈ {0, 1}* : none of the prefixes of w ends in 0}.
vii) {w ∈ {a, b}* : #a(w) =3 }.
viii) {w ∈ {a, b}* : #a(w) ≤ 3}.
ix) {w ∈ {a, b}* : w contains no more than two occurrences of the substring aa}.
6) Prove that , for every regular expression there exists a finite automaton which accepts the same
language accepted by regular expression.
7) Convert the following automaton to regular expression using state elimination method

Prepared by Dr. Nandini S, ISE, SJCIT page 2


8) State and prove pumping lemma theorem for regular languages.
9) Apply pumping lemma for the following languages and prove that they are not Regular.
i) L1= { an bn |n ≥ 0} ii)L2= {w | na(w) < nb(w) } iii) L3={an! |n>0}
iv)L4={ a |n=k2 ,n≥ 1}
n

10) Prove that if L=L(A) for some DFA A, then there is a regular expression R such that L=L(R)
11) Define distinguishable and indistinguishable states. Minimize the following DFAs using table filling
algorithm:
i) (ii)

𝜎 0 1
→A B A
B A C
C D B
*
D D A
E D F
F G E
G F G
H G D
iii)
𝜎 a b
→→ q0 q1 q2
q1 q1 q3
q2 q1 q2
q3 q1 q4
*q4 q1 q2

12) Prove that regular languages are closed under union, intersection, concatenation, complementation
,reverse and homomorphism.
13) If L1 and L2 are regular then prove that L1- L2 is also regular.
14) Consider the homomorphism from the alphabet {0,1,2} to {a,b} defined by h(0)=ab, h(1)=b,
h(2)=aa.
(i)What is h(2201)?
(ii)If L is language 1*02*, what is h(L)?
(iii) If L is language (ab+bab)*bab, what is h-1(L)?
MODULE-3
1) Define Context Free Grammar. Design CFG for the following Languages.
a) L = {an bn+3| n ≥ 3 }
b) L=(01)n |n>=1
c) Let ∑ = {a, b} obtain a grammar G generating set of all palindromes over ∑.
d) Let ∑ = {a, b} obtain a grammar G generating set of all non-palindromes over ∑.
e) L= {anbn | n>=1}
f) L = {an bm | n ≥ 0, m > n} (June/Jul 2023,18 scheme)
g) L = {anb2n : n>=0} (Jan/Feb 2021,18 scheme)
h) L={wwR | w ε{a,b}*}
i) L={0m1m2n | m>=1, n>=0}
j) L={ambnck|m+2n=k & m,n>=0}
k) L={an bn-3| n ≥ 3 (Dec 2018/Jan 2019,15 scheme)

Prepared by Dr. Nandini S, ISE, SJCIT page 3


l) L={w: |w| mod3 not equal to |w| mod2}on w ε{a,b}*
m) L = {strings of a's and b's with equal no. of a's and b's} Also show the moves made by the
PDA for the string "aabbab". (Aug/Sep 2020,17 Scheme) (Aug/Sep 2020,17 Scheme
n) L₂={aⁿ bᵐ cᵏ: m = n + k} over ∑ = {a, b, c} (Feb/March 2022,18 scheme)
o) L₁={w: lwl Mod 3 = 0} over ∑ = {a}
p) L = {0m1m2n | m ≥ 0 , n ≥ 0 }
q) L = {0m1m2n | m ≥ 0 , n ≥ 0 }
r) L = {aibj | i=j+1} (Aug/Sep 2020,17 Scheme)
s) L = {W | na(W) = nb(W) |n>=1}
t) L = {a(2n+1)bm cm c2n| n, m ≥ 0} (July/Aug 2022,15 scheme)
u) L = {ai bj ck: i+j=k, i≥0, j≥0}
v) L = {an bm ck: n+2m=k} (Jan/Feb 2021,15 scheme) (Jan/Feb 2023,18 scheme)
w) L = {ai bj | i ≠ j, i ≥ 0, j ≥ 0} (June/Jul 2023,18 scheme)
x) L = {an bn+1 | n ≥ 0} (June/Jul 2023,17 scheme)

2) What is NPDA? Design NPDA for Language L = {a n bn | n >= 1}. Draw transition diagram.
Write sequence of moves made by NPDA to accept the string aaabbb. (2022, 2018,19,23,17 )
3) Define PDA. Obtain PDA to accept the language L(M) = {wcwR | w ∈ (a + b)*}, where wR is the
reverse of w by a final state. And show the moves made by PDA for the string "aabcbaa" and
"abacbba".(Jan/Feb 2023,18 scheme) (June/Jul 2023,18 scheme) (Jul/Aug 2022)
4) Construct a PDA to accept the language L = {wwR | w ∈ {a, b}* }.Draw the graphical representation of
this PDA. Show the moves made by this PDA for the string aabbaa. (Dec 2017, Jan 2018) (June/Jul
2023,17 scheme) (Jan/Feb 2023,18 scheme)
5) Design a PDA for the language that accepts the string with n a(w) < nb(w), where w ∈ {a + b}* and
show the instantaneous description of the PDA on input abbab. (Jan/Feb 2021,18 scheme)
6) Design a PDA for the language that accepts the string with n a(w) = nb(w), where w ∈ {a + b}* and
show the instantaneous description of the PDA on input abbaba.
7) Build a PDA to accept delimiters or balanced parentheses having parentheses { , ( , ) , }
8) Obtain a CFG for PDA M with the transitions:
δ(q0, a, Z) = (q0, AZ)
δ(q0, b, A) = (q0, AA)
δ(q0, a, A) = (q1, ε) (Jan/Feb 2021,15 scheme)
9) Convert the following CFG to PDA:
S → aABB | aAA
A → aBB | a
B → bBB | A
C → a (Dec 2017, Jan 2018) (Jul/Aug 2022,17 scheme)
10) Convert the following grammar into equivalent PDA:
S -> aABC
A -> aB | a
B -> bA | b
C -> a (Dec 2018/Jan 2019,15 scheme) (June/Jul 2023,17 scheme)
11) Consider the grammar G with production Obtain the left most derivation, right most derivation and
parse tree for some string for the following CFG.
a) S -> AbB
A -> Aa | ε
B -> aB | bB | ε
For the string aaabab.
b) S -> aB | bA
A -> aS| bAA | a
B -> bS | aBB | b
For the string aaabbabbba.
c) E -> E + E
E -> E - E

Prepared by Dr. Nandini S, ISE, SJCIT page 4


E -> E * E
E -> E / E
E -> E ^ E
E -> id
For the string id+id^id
12) Prove that the given grammars below are ambiguous.
a) S -> aS | X b) S -> aB |bA c) S -> iCtS |iCtSeS |a
X -> aX | a A -> aS |bAA | a C-> b
B -> bS | aBB | b
MODULE 4
1) Eliminate ϵ, unit and useless productions from the following grammar:
S→AaA| CA| BaB
A→aaBa| CDA| aa| DC
B→bB | bAB | bb| aS
C→Ca| bC|D
D→bD| ϵ
2) What is a unit production? Begin with the grammars
(i) S→ABC| BaB (ii) S→aAa| bBb | ϵ
A→aA| BaC| aaa A→C |a
B→bBb | a | D B→C|b
C→CA| AC C→CDE | ϵ
D→ ϵ D→A|B|ab
Eliminate ϵ-productions.
Eliminate any unit production in the resulting grammar.
Eliminate any useless symbols in the resulting grammar.
3) Remove useless symbols from the following grammar:
S→aA| B
A→aA| a
B→bB
D→ ab| Ea
E→ac| d
4) What is Chomsky Normal Form of CFG? Convert the following grammar to CNF. (2022,18 scheme)
S → ABC | BaB
A → aA | BaC | aaa
B → bBb | a | D
C → CA | AC
D→ε Eliminate ε-productions, Unit productions and useless symbols if any before conversion.
5) Obtain the following grammar in CNF
S → ABC
A → aC / D
B → bB / E / A
C → Ac / E / Cc
D → aa (Aug/Sep 2020,17 Scheme)
6) Define CNF. Design PDA for the language L = {0n b m12n | n,m ≥ 0}. Write Instantaneous Description
for the string 0bb11. (July/Aug 2022,15 scheme)
7) Convert the given grammar into CNF :
S -> 0A | 1B
A -> 0AA | 1S | 1
B → 1BB | 0S | 0 (June/Jul 2023,18 scheme) (Jul/Aug 2022,17 scheme)
8) Simplify the grammar by removing productive and unreachable symbols:
S → AB | AC
A → aA b | ε
B → bB
C → bCa
D → AB (Jul/Aug 2022,18 scheme)
Prepared by Dr. Nandini S, ISE, SJCIT page 5
9) Convert the following grammar to CNF:
S → ASB
A → a AS |a
B -> SbS |A | bb (Jul/Aug 2022,18 scheme) (Jan/Feb 2023,18 scheme)
10) What is CNF and GNF? Convert the following grammar into GNF:
S → AA | a
A → SS | b (Jan/Feb 2021,18 scheme)
11) Convert the grammar into Chomsky Normal Form (CNF)
S → aAD,
A → aB | bAB,
B → b,
D → d (June/Jul 2023,17 scheme)
ii) S → OA | 1B
A → OAA | 1S | 1(June/Jul 2023,17 scheme)
iii) List out the simplification techniques of CFG. Explain PDA and obtain an equivalent PDA for
CFG given below: S -> a | b | a s b | b s a (July/Aug 2022,15 scheme)
12) Design a FSM for the following regular grammar and obtain corresponding regular expression.
a) S->bS | aT |ε b) S → aT
T->bS T → bT|a | aW
W → ε |aT
13) Eliminate left recursion from the following grammars.
a) E->E+T | T b) A->Aab|AbB|ab|aa c) S->Ab|a
T->T*F |F B->bB|b A->ASa
F->(E) |id
14) Convert the following grammar into an equivalent unambiguous grammar
a) S->ABA b) E->E+E |E-E|
A->Aa| ε E->E*E |E/E
B->bB| ε E->( E) | I
I->a|b|c
MODULE-5
1) Design TM for WCWᴿ over Σ = {0, 1}. Write transition diagram, and ID for w = 101C101
(Feb/March 2022,18 scheme)
2) Design Turning machine to accept the Language L = {0ⁿ1ⁿ2ⁿ | n >= 0}. Draw the transition diagram.
Write sequence of moves made by TM for string 001122. (Feb/March 2022,18 scheme)
3) Design and construct TM to accept the language L = {W | W is balanced parenthesis}. Show the
moves made by TM for string W = ( ( ) ( ) ). (July/Aug 2022,15 scheme)
4) Design a Turing Machine for the given languages
i) L = {0n 1n| n ≥ 0} (Jul/Aug 2022,17 scheme)
ii) L = {an bn cn | n ≥ 1}. Draw the transition diagram .Show the moves made by TM for the
string aabbcc. . (Dec 2017, Jan 2018) (June/Jul 2023,18 scheme) (Jul/Aug 2022,17 scheme)
iii) L = {0n 1n | n ≥ 1}. Draw the transition diagram. Show the moves made by the machine for the
string 000111, 1001, 0011 and 00111. (Jul/Aug 2022,17 scheme) (Jan/Feb 2023,18 scheme)
iv) L = {1n 2n 3n | n ≥ 1}. Show that the string 112233 is accepted by ID. (Jul/Aug 2022,18 scheme)
5) Explain the working principle of Turning Machine with diagram. Design a TM to accept strings
formed on {0, 1} and ending with 000. Write transition diagram and ID for w = 101000. (2021,18)
6) Define TM and design a TM for L = {w | w ∈ (0, 1)* containing the substring 001}. Write transition
diagram and show the moves made by the TM for input string 10010. (Jan/Feb 2023,18 scheme)
7) Design a TM to accept strings of a's and b's ending with ab or ba. (2018,2019,15 )
8) Explain halting problem in Turing machine. Prove that HALT TM(M, W) = {<M, w> | The Turing
machine M halts on input w} is undecidable. (June/Jul 2023,18 )
9) Write Short notes on
i) Post correspondence problem with respect to TM ii)Quantum Computers iii) Church Turing Thesis
iv) Linear bound Automation v) variants of Turing machine vi) Halting problem vii) decidability viii)
undecidable language. ix) ) Classes of p and NP

Prepared by Dr. Nandini S, ISE, SJCIT page 6


Prepared by Dr. Nandini S, ISE, SJCIT page 7

You might also like