0% found this document useful (0 votes)
50 views20 pages

4RCS04 (1) - Merged

This document outlines the examination structure for the Theory of Computation course at Siddaganga Institute of Technology, including instructions and a variety of questions from different units. It covers topics such as finite automata, regular expressions, context-free grammars, pushdown automata, and Turing machines. The exam consists of multiple units, each with specific questions that students must answer, ensuring a comprehensive assessment of their understanding of computational theory.

Uploaded by

kushal2005bs
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)
50 views20 pages

4RCS04 (1) - Merged

This document outlines the examination structure for the Theory of Computation course at Siddaganga Institute of Technology, including instructions and a variety of questions from different units. It covers topics such as finite automata, regular expressions, context-free grammars, pushdown automata, and Turing machines. The exam consists of multiple units, each with specific questions that students must answer, ensuring a comprehensive assessment of their understanding of computational theory.

Uploaded by

kushal2005bs
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/ 20

USN 1 S I 4RCS04

Siddaganga Institute of Technology, Tumakuru-572 103


(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Supplementary Semester B.E. Computer Sc. and Engg. Examinations Sept. – Oct. 2023
Theory of Computation
Time: 3 Hours Max. Marks: 100
Note : 1. Revealing of Identity in any form in the answer book will be treated as malpractice.
2. Answer any five questions choosing one full question from each unit.

Unit - I M BL CO PO PSO

01 a) Define: i) Deterministic Finite Automata. ii) Epsilon-closure with an example. 6


b) Draw a DFA to accept the languages L={W/W has odd number of 0’s and
followed by even number of 1’s. 4
c) Convert the following NFA to its equivalent DFA.

10
OR
02 a) Define the following terms giving examples.
i) Alphabet ii) Language iii) Power of an alphabet iv) Empty string. 4
b) Let 𝐷 = (𝑄𝐷 , Σ, 𝛿𝐷 , 𝑞0 , 𝐹𝐷 ) is the DFA constructed from NFA
𝑁 = (𝑄𝑁 , Σ, 𝛿𝑁 , 𝑞0 , 𝐹𝑁 ) by the subset construction, then prove that L(D)=L(N). 10
c) An NFA with 5 states and input alphabet  = {a, b} has the following transition
table.
Q 𝛿(𝑞, 𝑎) 𝛿(𝑞, 𝑏)
 1 {1, 2} {1}
2 {3} {3}
3 {4} {4}
4 {5} {}
* 5 {} {5}
i) Draw transition diagram. ii) Calculate 𝛿 (1, 𝑎𝑏) iii) Calculate 𝛿 ∗ (1, 𝑎𝑏 𝑎𝑏)

6
Unit - II
03 a) Convert DFA to regular expression

8
b) Prove that every language defined by a regular expression is also defined by a
finite automata. 6
𝑛 𝑛+1
c) Prove that the language {𝑎 , 𝑏 , 𝑛 > 1} is not regular. 6
OR
04 a) Give the recursive definition of Regular expression. Write the regular expression
for the language of all strings of 0’s and 1’s such that the number of 0’s is odd. 6
b) Prove that of L=L(A) for some DFA A, then there is an equivalent regular
expression R such that L=L(R). 6

-1- Please Turn Over


-2- 4RCS04
c) Minimize the following DFA using table filing algorithm.
State A B *C D E F G H
0 B G A C H C G G
1 F C C G F G E C
Initial State A Final State C. 8
Unit - III
05 a) Define a context free grammar. Design a CFG for the following languages.
i) 𝐿 = {𝑊𝑎𝑛 𝑏𝑛 𝑊 𝑅 |𝑤 𝑖𝑠 𝑖𝑛 {𝑎, 𝑏}∗ } ii) 𝐿 = {𝑎2𝑛 𝑏𝑛 |𝑛 ≥ 1} 10
b) What are unit productions? Give an algorithm for eliminating unit productions for
a grammar. 5
c)Define CNF, obtain the CNF for the following grammar.
SASB AaAS|a BSbS|aAS|a|bb 5
OR
06 a) Define: i) language of the grammar. ii) Define sentential forms. iii) Left most
derivation. 6
b) What are useless symbols? Eliminate useless symbols and productions from the
following grammar.
SabA|bB AaA|d BbB Dab|Ea EaC|a 10
c) Write a short note on construction of a parse tree. 4
Unit - IV
07 a) What is deterministic PDA and non-deterministic PDA? With examples. 6
b) Obtain a PDA to accept the language 𝐿 = {𝑊|𝑊 ∈ (𝑎 + 𝑏)∗ , 𝑁𝑎 (𝑊) = 𝑁𝐵 (𝑤)}
by a final state. Draw the graphical representation of PDA. Also show the moves
for the string abbbaa. 10
c) Explain the terms i) Language of a PDA. ii) ID of a Turing machine. 4
OR
08 a) Obtain PDA equivalent to the grammar.
EE+E EE*E EE/E EE-E E(E)/a/b 4
b) Design a Turning machine to accept 𝐿 = {𝑊 𝐶𝑊 𝑅 /𝑊 ∈ (𝑎 + 𝑏)∗ . Show the
sequences of moves for the string abba. 10
c) Write a note on Tuning machines and halting problems. 6
Unit - V
09 a) What are recursive and recursively enumerable languages, illustrate with suitable
example. 8
b) Why few problems can not be solved using Turning machine. What are the
possible ways to solve this. 8
c)Write a note on undecidable problems for context free languages. 4
OR
10 a) Explain the Post Correspondence problem. 8
b) Write a note on un-decidable problems for recursively enumerable languages. 6
c) Define: i) Unrestricted grammars. ii) Context sensitive grammars. 6
________
USN 1 S I 4RCS04
Siddaganga Institute of Technology, Tumakuru – 572 103
(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Supplementary / Grade Improvement Examinations B.E. Computer Sc. & Engg. Oct. 2021
Theory of Computation
Time: 3 Hours Max. Marks: 100
Note : Answer any five full questions from Q. No. 1 to Q. No. 10.

01 a) Design DFA for the following languages over Ʃ = {a, b}


i) To accept strings with exactly three consecutive a’s.
ii) To accept strings not containing the substring “aab”. 8
BL: 3 CO: 5 PO: 2,3 PSO: 1

b) Convert the following NFA to DFA using subset construction method.

8
BL: 3 CO: 5 PO: 2,3 PSO: 1

c) List out the differences between DFA and NFA. 4


BL: 1 CO: 1 PO: 1 PSO: 1

02 a) Minimize the following automata

8
BL: 3 CO: 2 PO: 2 PSO: 1

b) Design a NFA to accept set of strings of 0’s and 1’s with substring 00 or 11. And convert that
into equivalent DFA using Lazy method. 8
BL: 3 CO: 1 PO: 2,3 PSO: 1

c) List out applications of NFA. 4


BL: 1 CO: 1 PO: 1 PSO: 1

03 a) Obtain the Regular Expression for the following automata using state elimination method.

8
BL: 3 CO: 3 PO: 2 PSO: 1

b) State and prove the pumping lemma for regular language. 6


BL: 3 CO: 3 PO: 2 PSO: 1

c) Mention the applications of regular expression. Explain any one in detail. 6


BL: 2 CO: 3 PO: 2 PSO: 1

-1- Please Turn Over


-2- 4RCS04
04 a) Obtain regular expression for the following:
i) Language of all strings 0’s and 1’s that have odd number of 1’s.
ii) Language of all strings of 0’s and 1’s that has atleast one pair of consecutive 0’s.
iii) The language of all strings of 0’s and 1’s that have no pairs of consecutive 0’s. 10
BL: 3 CO: 5 PO: 2,3 PSO: 1

b) Convert the following regular expressions to NFAs with Epsilon transitions.


i) (0 + 1)* / (0 + 1) ii) 01 + 101 iii) (01 + 1)* iv) 011(0 + 1)* 10
BL: 3 CO: 5 PO: 2,3 PSO: 1

05 a) Design a context free grammar for the languages


i) L = {0m 1m 2n | m  0, n  0}
ii) L = {ai bj | i  j, i  0, j  0}
iii) L = {an bn-3 | n  3} 8
BL: 4 CO: 3 PO: 2 PSO: 1

b) Show that the grammar shown below is ambiguous on string “aababb”.


S  aSbS
S  bSaS
S 6
BL: 4 CO: 3 PO: 2 PSO: 1

c) Define Chomsky Norm Form (CNF) and convert the following grammar into CNF.
S  aACa
A  a|B
BC|c
C  cC | 6
BL: 4 CO: 3 PO: 2 PSO: 1

06 a) Define ambiguity. Consider the grammar E  +EE | *EE | -EE | x | y.


Find the leftmost, rightmost derivations and parse trees for the string “+*-xyxy”. 8
BL: 4 CO: 3 PO: 2 PSO: 1

b) Convert the following grammar into CNF


S  ASB |
A  aAS | a
B  SbS | A | bb 6
BL: 4 CO: 3 PO: 2 PSO: 1

c) Mention the applications of CFG and explain any one in detail. 6


BL: 1 CO: 3 PO: 2 PSO: 1

07 a) Design a PDA to accept the following language: L = {wwR : w {a, b}*} 8


BL: 3 CO: 5 PO: 2,3 PSO: 1

b) Design Turing machine to accept the following language:


L = {anbn | n  1}
Show the Instantaneous Description for the string “aabb”. 8
BL: 3 CO: 5 PO: 2,3 PSO: 1

Contd…
-3- 4RCS04
c) Verify that the PDA to accept the language
L(M) = {w | w (a + b)*} and na(w) = nb(w) is deterministic. 4
BL: 3 CO: 5 PO: 2,3 PSO: 1

08 a) Design a Turing machine to accept strings of a’s and b’s ending with ab or ba. 8
BL: 3 CO: 5 PO: 2,3 PSO: 1

b) Design PDA to accept the language and show the graphical representation of the same.
L = {x3 yn zn | z  0} 8
BL: 3 CO: 5 PO: 2,3 PSO: 1

c) Briefly explain the technique for Turing machine construction. 4


BL: 1 CO: 5 PO: 2,3 PSO: 1

09 a) Define recursive and recursively enumerable languages. 6


BL: 1 CO: 4 PO: 2 PSO: 1

b) Show that for arbitrary CFGs G1 and G2, the problem


“L(G1)  L(G2)” is “context-free” is undecidable. 8
BL: 5 CO: 4 PO: 2 PSO: 1

c) Define unrestricted grammars and context sensitive grammars. 6


BL: 1 CO: 4 PO: 2 PSO: 1

10 a) Discuss halting problem and post correspondence problem with respect to Turing machine. 10
BL: 6 CO: 4 PO: 2 PSO: 1

b) Show that the problem of determining whether or not


L(G1)  L(G2) is undecidable for context free grammars G1, G2. 6
BL: 5 CO: 4 PO: 2 PSO: 1

c) Explain multitope Turing machine. 4


BL: 1 CO: 4 PO: 2 PSO: 1

________
USN 1 S I 4RCS04
Siddaganga Institute of Technology, Tumakuru-572 103
(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Special Supplementary Semester B.E. Computer Sc. and Engg. Examinations Dec. 2023
Theory of Computation
Time: 3 Hours Max. Marks: 100
Note : 1. Revealing of Identity in any form in the answer book/graph sheet will be treated as malpractice.
2. Answer any five questions choosing one full question from each unit.

Unit - I M BL CO PO PSO

01 a) Define the following terms:


i) Alphabet ii) String iii) Empty-string iv) Language 8 2 1
b) Let D = (QD, Σ, D, qo, FD) is a DFA constructed from NFA N = (QN, Σ,N, qo, FN)
by subset construction method, then prove that L(D)=L(N). 6 3 1
c)Design a DFA that accepts binary strings divisible by 6. 6 4 5
OR
02 a) Design a DFA that accepts the following languages.
i) Strings that either begins or ends or both with substring “01”, where Σ={0,1}
ii) Strings which do not end with “011”, where Σ={0,1} 8 4 5
b) Convert the following DFA to NFA.
 0 1
→ p {p,q} {p}
q {r} {r}
r {s} 
* s {s} {s} 6 3 2
c) Define epsilon closure of a state. Compute the epsilon closure of each state in the
following ∈-NFA.
∈ a b c
→ p  P {q} {r}
q {P} {q} {r} 
* r {q} {r}  {p} 6 3 2

Unit - II
03 a) Prove that every language defined by a regular expression is also defined by a
finite automation. 8 3 2
b) Give the recursive definition of regular expression. Obtain regular expressions for
the following languages, where Σ={a,b,c}
i) L = {an bm cp | n ≤ 4, m ≥ 2, p ≤ 2} ii) L = { | || mod 3 = 0} 6 4 3
c)State pumping lemma for regular languages and show that L = {  | t (0+1 } R *

is not regular 6 3 4
OR
04 a) With suitable example give the steps to minimize a DFA. 8 2 1
b) Discuss various applications of regular expressions. 6 2 1
c) Show that the following languages are not regular using concept of pumping
lemma.
i) L = {an bn} n>1} ii) Palindromes, where Σ = {a, b} 6 3 4

Unit - III
05 a) Define the following terms:
i) Context free grammar ii) Parse tree
iii) Yield of a parse tree iv) Left most derivation 8 2 1

-1- Please Turn Over


-2- 4RCS04
b) Construct a CFG for the language of binary strings containing even number of o’s
and even number of 1’s and using its products derive string “001001”. 6 3 3
c)Describe the applications of context free grammars. 6 2 1
OR
06 a) Define Chomsky Normal form. Convert the following grammar to Chomsky
Normal form.
S→X1Y|Z
X→0X|∈
Y→0Y|1Y|∈
Z→A 8 3 2
b) What are epsilon productions? Give an algorithm to eliminate epsilon productions
from the grammar. 6 2 1
c) Explain inherently ambiguous languages. Illustrate the ambiguity through a
suitable example. 6 2 1

Unit - IV
07 a) Design a PDA to accept the language L = {a n bm cn | n>1, 1 , m ≥ 1} by final state.
Give the instantaneous description for the string “aabcc”. 10 4 5
b) Design a Turing Machine for the Language L = {an bn | n ≥ 1}. Give the graphic
representation and show the moves made by the Turing machine for the string
“aabb” through instantaneous description. 10 4 5
OR
08 a) Describe the following.
i) The language of a Turing Machine ii) Turing machines and halting problems 8 2 1
b) Prove the if L = N(PN) for some PDA PN = (Q, Σ, Γ, N, qo, Zo) then there is a PDA
PF such that L = L(PF) 6 3 2
c) Define PDA. Define the languages accepted by PDA by final state and by empty
stack. 6 2 1

Unit - V
09 a) With a neat diagram explain the Chomsky hierarchy of languages. 8 2 4
b) Write a note on un-decidable problems for recursively enumerable languages. 6 2 4
c) Explain the post correspondence problem. 6 2 1
OR
10 a) Define :
i) Recursive language ii) Unrestricted grammars
iii) Context sensitive grammars iv) Recursively enumerable language 8 2 4
b) Prove that there exists no algorithm for deciding whether any given context free
grammar is ambiguous. 6 3 4
c) With a suitable example discuss about problems that cannot be solved by Turing
machines. 6 3 4
________
MOBILE PHONE
iSSN 1 SI PIOHBTED S4CCSIO2
Siddaganga Institute of Technology, Tumakuru-572 103
(An Autoomeus Institution affiliated to \/TLRelagavi Appronved hy AlCTE New Delh)

Fourth Semester Bachelor of Engineering Examinations July-Aug. 2024


Theory of Computations
Time: 3 Hours Common to CS, AD and CI
Max. Marks: 100
Note 1. Revealing of ldentity in any form in the answer book will be treated as malpractice.
2. Answer any five questions choosing one full qucstion from cach unit.

Unit -I M BL, CO PO PSO


1
a)
Design a NEA t0 accept strings of a's and b's ending with ab or ba. From
NFAobtain an cquivalent DFA. this
6 3 3
b) Convert the following &-NFA to
DFA.

Fig. lb 6 3 1
c) Design DFA to accept the 3
following languages:
i) L= {w|n,(w) = 2, n, (w) >= 3}
ii) L= (w||w|mod 5 0} on )= {a, b, c, d}}
8 3 3
OR
2 a) Convert the following
&-NFA to an equivalent DFA:
E -(Q, 2, 6, q0, F), Q={q0, q1, q2}, E{a, b, c},
q= q0,
S(q0.a) = q0, ô(q0,b) =0, ô(q0,c) = 0, 8(q0,[) = q!, F={q2},
Sql,a) = , ql,b) =ql, ql,c) = , öql,e) = q2,
S(q2,a) = 0, q2,b) =0, g2,c) = q2, ( q2,[) -.
6
b) Convert the following NFA into an 3 1 3
equivalent DFA:

Fig.2b 6 3 1
c) Design a DFAto accept the following languages: 3

i) L= {w |n,(w) >= 1,n,(w) =2}


ii) Language to accept strings of 0's and l's that either begins or ends or both with
substring 01.
3 3

Unit - II

3 a) Design the regular expression for the following.


J. The set of strings of 0's and l's beginning and ending with the same
symbol.
2 The set of strinps of a's andb's ending with b and has no substring aa.
3. The set of strings of 's and 1's having 0 (wo consecutive 0's.
2

-1 Please Turn Over


-2 S4CC
elimination techniquc:
Convert the following DFAt0 aregular expression by state

*p

6 3 2 3

c) Obtain the minimized DEA for the


following:
B A
B A
C D B
*D A
E D
F E
G
H G D
8 4 2 3

4 a) OR
Discuss the formal definition of regular expression
and list any two applications of
regular expressions.
b) 6 2 2
Obtain an [-NFA for the following regular 1

i) ab(a+b)* ii) a* +b* + c* expressions:


6 3
c) Write the table filling algorithm. and minimize the 2 3
following DFA:
A=({q0,ql,q2,q3,q4}, (a,b}, 6, q0,{q4})
S(q0, a) =ql q0, b) = q3 S(q1, a) = q2 S(q1, b) =q4
S(q2, a) =ql S(q2, b) = q4 S(q3, a) = q2 Sq3, b) = q4
ö(q4, a) =q4 (q4, b) = q4
3 2 3 1
Unit - III
5 a) With an example, give the formal definition of CFG. Also list any two uses of
CFG.
6 2 3 1
b) Obtain a LMD and parse tree for the string aaabbabbba with respect to the
following CFG.
S ’ aB|bA, A’ a<aS]bAA, B ’ b\bS|aBB 6 3 3 3

c) Define Chomsky normal form and convert the following grammar Chomsky
normal form.
S ’ aAla<B|C, A ’ aBl¬, B’ aA, C ’ cCD, D ’ abd 8 3 3 3
OR
6 a) Differentiate between sentence and sentential form. List the conditions that a tree
must satisfy to call it as aparse tree. 3

b) Obtain a CFGto generatethe following:


i) Strings of a's and b's having a substring ab
ii) L = {w: n,(w) mod 2 = 0, where w E {a, b} *
ii) /, = a"bn+2|n > 0; 3 3

Contd.
c) For the
following grammar: -3 S4CCSI02
S ’ ABC\BbB,
A -’ aA|BaClaaa, B ’ bBblalD,
i) Eliminate e-productions C’ CalAC, D-’ *
ii) Eliminate
111) unitproductions
Elininate any useless
symbols in the resulting
7
gramimar. 3 3 3

a) Unit - IV
With an example, discuss
b)
Convert the PDA P={ deterministic and non-deterministic PDA. 4 2 4

S(91,1,Zo) =(8(91,X {90,


Zo)} 91},S(91,0,
{0,1},(Z0,X},{(90,X)}
5,91,Zo)to a CFG, where Sis given by
S(91,1,X) ={(91,XX)} X) =
S(90,1, X) = {(90,e)} S(91,e, X) = (90,¬)}
c) Design a PDA S(90,0, Zo) ={(91,Zo)} 8
for the following 3 4 3

language accepted by final state. Also give its


graphical representation and instantaneous
descriptions on the string "aaabbbccc"
L=fa'b" ch :n2 0} 3 4 3 1
8 OR
a) Briefly discuss the
i) ID ofa PDA
following:
ii) Formal definition of PDA
b) Write the 6
algorithm to convert from the given PDA to a 2 4 1 1
CFG. 4
Obtain a PDA for the following language 4

graphical representation and sequence of accepted by final state. Also give its
"aaabbcccce". instantaneous description on the string
L= farHm c7+m : m>0, n > 0}
10 4 4 3

Unit - V
9 a) What is a Turing Machine? Discuss the formal
definition of a turing machine. 6 2
Design a Turing machine to accept the following language : 5 1 1

L= {0"1"| n> 1}
Also write its transition table and transition diagram.
10 4
c) Discuss the importance of multitape Turing machines. 3
4 2 1 1
OR
10 a) With a diagram, discuss the turing machine model. 6 2

b) Design a turing machine to accept the following language:


L= {0"1"2"| n 1}
Also write itstransition tableand transition diagram. 10 4 3
c) Discuss the importance of Multistack machines. 4
1
USN 1 S I N5IS03
Siddaganga Institute of Technology, Tumakuru-572 103
(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Even Semester B.E. Information Science and Engg. Examinations July-Aug. 2024
Theory of Computation
Time: 3 Hours Max. Marks: 100
Note : 1. Revealing of Identity in any form in the answer book will be treated as malpractice.
2. Answer any five questions choosing one full question from each unit.

Unit - I M BL CO PO PSO

01 a) Define the terms alphabet, power of an alphabet, Language and empty string. Give
one example for each. 4 2 1 1 1
b) Let 𝐷 = (𝑄𝐷, ∑ , 𝛿𝐷, 𝑞0 , 𝐹𝐷, ) is the DFA constructed from NFA
𝑁 = (𝑄𝑁, ∑ , 𝛿𝑁, 𝑞0 , 𝐹𝑁, ) by the suset construction, then prove that L(D)=L(N). 10 2 2 2 1
c)Design DFA to accept decimal strings divisible by 3. 6 2 2 2 1
OR
02 a) Consider the following  -NFA E:
𝐸 = (𝑄, , , 𝑞0 , 𝐹) where Q={p, q, r}, ={a, b, c}, q0= p, F={r},  is as follows:
(p, ) =  , (p, a) = p, (p, b) =q, (p, c) = r, (q, )= p, (q, a) = q, (q, b)=r,
(q, c) = , (r, ) = q, (r, a) = r, (r, b) = , (r, c) = p.
i) Give all the strings of length three or less accepted by the automata.
ii) Convert the automata to DFA. 10 3 2 3 1
b) Differentiate the extended transition function of DFA and NFA. 4 2 1 1 1
c) Construct DFA which accepts strings of 0’s and 1’s starting with even number of
1’s followed by 0’s which are multiples of 3. 6 3 2 2 1

Unit - II
03 a) Define regular expression. Write regular language for the following Languages.
i) L={𝑎𝑛 𝑏 𝑚 ∶ (𝑚 + 𝑛) is even }
ii) L={{𝑎𝑛 𝑏 𝑚 ∶ 𝑚 >= 1, 𝑛 > = 2, 𝑛𝑚 >= 3} 7 3 2 2 1
b) State and prove the pumping lemma of a regular language and Prove that the
language L={𝑎𝑛 𝑏 𝑛+1 𝑛 > 1} not regular. 8 2 2 1 1
c) Write regular expression for the following grammar:
𝑆 → 𝐴𝑎𝑏 | 𝐵𝑏𝑎 𝐴 → 𝑎𝐴 | 𝐵𝐴| 𝐵 → 𝑏𝐵 | 𝑎𝐵| 5 3 2 2 1

OR
04 a) Consider the following DFA D:
𝐷 = (𝑄, , , 𝑞0 , 𝐹) where Q={q1, q2, q3},  ={0,1}, q0=q1, F={q3},  is as
follows:
(q1, 0) = q2, (q1, 1) = q1, (q2, 0) = q3, (q2, 1) =q1, (q3, 0) = q3, (q3, 1) = q2.
(3)
Find the regular expression 𝑅13 and minimize the expression as much as possible.
8 3 2 2 1
b) Prove that for every language defined by a regular expression, there exists a Finite
Automata for it. 6 2 2 1 1
c) Prove that if R is a regular expression, then there exists a finite automata
M=(Q, , , 𝑞0 , F) which accepts L(R). 6 2 2 1 1

-1- Please Turn Over


-2- N5IS03
Unit - III
05 a) Construct a CFG for the following languages:
i)L={0𝑚 1𝑚 2𝑛 |𝑚 ≥ 1, 𝑛 ≥ 0} ‘
ii) L= L((010+11)*) on ={0,1} 6 3 3 2 1
𝑛 𝑛 𝑚
b) Construct a CFG for the Language L{𝑎 𝑏 𝑐 } where n and m are non- negative
integers and show that it is ambiguous. 8 3 3 3 1
c)If L1 and L2 are two CFL’s then Prove that L1 U L2, L1.L2 are CFL’s. 6 2 3 1 1
OR
06 a) Define context free grammar. Design CFG for the language
L={x {0,1}*, no(x) n1(x)}. What is ambiguous grammar? Check whether the
following grammar is ambiguous or not.
𝑆 → 𝑎𝐵 | 𝑏𝐴
𝐴 → 𝑎𝑆 | 𝑏𝐴𝐴|𝑎
𝐵 → 𝑏𝑆| 𝑎𝐵𝐵|𝑏 8 3 3 1 1
b) Define a CFG. Find CFG for the language L={𝑎𝑛 𝑏 𝑚 |𝑛 𝑚 − 1, 𝑛 ≥ 0, 𝑚 ≥ 0} 6 3 4 1 1
c) Eliminate Unit Productions from the following grammar
𝑆 → 𝐴𝑎 | 𝐵|𝐶𝑎
𝐵 → 𝑎𝐵 | 𝑏
𝐶 → 𝐷𝑏 | 𝐷
𝐷 →𝐸|𝑑
𝐸 → 𝑎𝑏 6 3 4 1 1

Unit - IV
07 a) Define a PDA. Design a PDA to accept the following language by final state.
L={w : w {a, b}* and 𝑛𝑎 (𝑤) ≠ 𝑛𝑏 (𝑤)} 10 4 5 3 1
𝑛 𝑚 𝑛
b)Design a PDA to accept the language L={𝑎 𝑐 𝑏 |𝑛 ≥ 1, 𝑚 ≥ 1} by final state.
Also give its graphical representation and instantaneous descriptions for the string
“aacccbb”. 10 4 5 3 1
OR
08 a) Give the formal definition of Pushdown Automata (PDA). Construct a PDA to
accept the language 𝐿 = {𝑎𝑛 𝑏 2𝑛 |𝑛 ≥ 1} 10 3 4 1 1
𝑛 𝑛
b) Design a Turing Machine that accepts the Language L={𝑎 𝑏 |𝑛 ≥ 1, }. Give the
graphical representation for the Turing Machine obtained and also show the moves
made by the Turing machine for the string aabb. 10 4 5 3 1

Unit - V
09 a) Explain Chomsky hierarchy method with your own example. 6 2 4 1 1
b) What is Context –Sensitive Grammars? Explain how context sensitive grammars
are different from CFG. 8 2 4 1 1
c)Explain the difficulties arise when we allowed the empty string as the left side of a
production in an unrestricted grammar. 6 2 1 1 1
OR
10 a) Difference between PDA and TM. 6 2 3 1 1
b) Describe the Context- Sensitive Grammars and unrestricted grammar with an
example. 6 2 3 1 1
𝑛 𝑛 𝑛
c) Design a TM for the Language L={{𝑎 𝑏 𝑐 |𝑛 ≥ 1}. 8 3 5 3 1

_______
USN 1 S I S4CCSI02
Siddaganga Institute of Technology, Tumakuru-572 103
(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Supplementary Semester Bachelor of Engineering Examinations Sept. 2024


Theory of Computations
[Common to CS, AD & ML]
Time: 3 Hours Max. Marks: 100
Note : 1. Revealing of Identity in any form in the answer book will be treated as malpractice.
2. Answer any five questions choosing one full question from each unit.

Unit - I M BL CO PO PSO

01 a) Design DFA to accept even number of a’s and odd number of b’s. 6 3 1 3
b) Convert the following NFA to DFA.
A=({ p, q, r}, {0, 1}, , p, r)  is given as follows:-
(p,0)={p,q} (p,1)={p}
(q,0) = (q,1)={r}
(r,0) =  (r,1) =  10 3 1 3
c) Give the formal definition of -NFA. 4 1 1 1

OR
02 a) Design DFA to accept the following languages.
(i) L(M)={w / |w| mod 5 0, ={a}}
(ii) L(M)={w (ab+ba)/w € (a+b)*} 6 3 1 3
b) Write the procedure to convert the -NFA to DFA by subset construction method
and convert the following -NFA to DFA.

10 3 4 3
c) Give the formal definition of DFA. 4 1 1 1

Unit - II
03 a) Prove that there exists a finite automata to accept the language L(R) corresponding
to the regular expression R. 6 4 2 3
b)Define regular expression. Obtain a regular expression for
(i) L={VUV |U, V  {a,b}* and |V|=2}
(ii) The set of strings of 0’s and 1’s beginning and ending with the same
symbol.
(iii) The set of strings of a’s and b’s ending with b and has no substring aa.
(iv) The set of strings of 0’s and 1’s having no two consecutive 0’s. 10 3 5 3
c) Write table filling algorithm. 4 2 2 3
OR
04 a) Convert the following DFA to a Regular Expression by State Elimination
Technique.
 0 1
 *p s p
q p s
r r q
s q r 6 4 2 3

-1- Please Turn Over


-2- S4CCSI02
b) Minimize the following DFA.
 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 10 3 2 3
c) Obtain a regular expression for the following languages
(i) L={an bm |n>=4, m<=3 (ii) L={an bm |m+n is even} 4 3 2 3

Unit - III
05 a) Give the formal definition of CFG. Obtain a grammar to generate the language.
L = {wcwR / w € (a+b)*} 8 3 3 3
b) What are useful and useless symbols in a CFG? Remove useless symbols from the
following CFG.
SaAa |aB, AaS |bD, BaBa | b, Cabb |DD, DaDa 6 4 3 3
c) Show that the following grammar is ambiguous?
SaB | bA AaS|bAA|a B bS | aBB |b 6 4 3 2

OR
06 a) For the following grammar:
S ABC | BbB, A  aA |BaC|aaa, B bBb |a|D, CCA|AC, D .
(i) Eliminate -productions (ii) Eliminate any unit productions in the resulting
grammar. (iii) Eliminate any useless symbols in the resulting grammar.
(iv) Put the resulting grammar in Chomsky Normal Form. 8 4 3 3
b) Consider the following productions of grammar G.
SaB |bA, Aa |aS|bAA Bb | bs | aBB
For the string aaabbabbba
Find (i) Leftmost Derivation (ii) Rightmost Derivation. 6 3 3 3
c) Obtain the grammar to generate:
(i) Strings of a’s and b’s having the substring ab (ii) L={anb2n |n>=0}
(iii) L={0n+1 1n | n>=0} 6 3 3 3

Unit - IV
07 a) Design PDA for the following language accepted by final state.
L={an bn+m cm : n=0, m 1} 8 3 4 3
b) Give the formal definition of PDA and define the following
(i) Instantaneous description of PDA. (ii) Acceptance of a language by PDA. 6 4 4 1
c) Is the PDA corresponding to the language L={a b | n>=1} by a final state is
n n

deterministic? 6 3 4 2

OR
08 a) Design PDA for the following language accepted by final state. Also write its
transition diagram and instantaneous description on the string “aacccbb”.
L ={ an cm bn : m1,n1} 10 3 4 3

Contd….
-3- S4CCSI02
b) Give the formal definition of DPDA. Is the PDA corresponding to the language
L={w |w €(a+b)* and na (w) =nb(w)} is deterministic? 10 3 4 2

Unit - V
09 a) Define a Turing Machine. With a neat diagram explain the working of a Turing
Machine. 6 3 5 1
b) Design a Turing Machine that accepts the language L={0 1 | n  1}. Give the
n n

graphical representation for the Turing Machine obtained and also show the moves
made by the Turing machine for the string 000111. 10 3 5 3
c) Write a note on Multitape Turing Machine. 4 4 5 2

OR
10 a) Obtain a Turing Machine to accept the language containing strings of 0’s and 1’s
ending with 011. 6 3 5 3
b) Obtain a Turing machine to accept the language L={w |w is even and {a, b}.
Show the moves made by the Turing machine for the string 0101. 10 4 5 3
c) Define the following :
- ID of a Turing machine
- Language accepted by a TM 4 2 5 2

________
USN 1 S I S4CCSI02
Siddaganga Institute of Technology, Tumakuru-572 103
(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Supplementary Semester Bachelor of Engineering Examinations Sept. 2024


Theory of Computations
[Common to CS, AD & ML]
Time: 3 Hours Max. Marks: 100
Note : 1. Revealing of Identity in any form in the answer book will be treated as malpractice.
2. Answer any five questions choosing one full question from each unit.

Unit - I M BL CO PO PSO

01 a) Design DFA to accept even number of a’s and odd number of b’s. 6 3 1 3
b) Convert the following NFA to DFA.
A=({ p, q, r}, {0, 1}, , p, r)  is given as follows:-
(p,0)={p,q} (p,1)={p}
(q,0) = (q,1)={r}
(r,0) =  (r,1) =  10 3 1 3
c) Give the formal definition of -NFA. 4 1 1 1

OR
02 a) Design DFA to accept the following languages.
(i) L(M)={w / |w| mod 5 0, ={a}}
(ii) L(M)={w (ab+ba)/w € (a+b)*} 6 3 1 3
b) Write the procedure to convert the -NFA to DFA by subset construction method
and convert the following -NFA to DFA.

10 3 4 3
c) Give the formal definition of DFA. 4 1 1 1

Unit - II
03 a) Prove that there exists a finite automata to accept the language L(R) corresponding
to the regular expression R. 6 4 2 3
b)Define regular expression. Obtain a regular expression for
(i) L={VUV |U, V  {a,b}* and |V|=2}
(ii) The set of strings of 0’s and 1’s beginning and ending with the same
symbol.
(iii) The set of strings of a’s and b’s ending with b and has no substring aa.
(iv) The set of strings of 0’s and 1’s having no two consecutive 0’s. 10 3 5 3
c) Write table filling algorithm. 4 2 2 3
OR
04 a) Convert the following DFA to a Regular Expression by State Elimination
Technique.
 0 1
 *p s p
q p s
r r q
s q r 6 4 2 3

-1- Please Turn Over


-2- S4CCSI02
b) Minimize the following DFA.
 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 10 3 2 3
c) Obtain a regular expression for the following languages
(i) L={an bm |n>=4, m<=3 (ii) L={an bm |m+n is even} 4 3 2 3

Unit - III
05 a) Give the formal definition of CFG. Obtain a grammar to generate the language.
L = {wcwR / w € (a+b)*} 8 3 3 3
b) What are useful and useless symbols in a CFG? Remove useless symbols from the
following CFG.
SaAa |aB, AaS |bD, BaBa | b, Cabb |DD, DaDa 6 4 3 3
c) Show that the following grammar is ambiguous?
SaB | bA AaS|bAA|a B bS | aBB |b 6 4 3 2

OR
06 a) For the following grammar:
S ABC | BbB, A  aA |BaC|aaa, B bBb |a|D, CCA|AC, D .
(i) Eliminate -productions (ii) Eliminate any unit productions in the resulting
grammar. (iii) Eliminate any useless symbols in the resulting grammar.
(iv) Put the resulting grammar in Chomsky Normal Form. 8 4 3 3
b) Consider the following productions of grammar G.
SaB |bA, Aa |aS|bAA Bb | bs | aBB
For the string aaabbabbba
Find (i) Leftmost Derivation (ii) Rightmost Derivation. 6 3 3 3
c) Obtain the grammar to generate:
(i) Strings of a’s and b’s having the substring ab (ii) L={anb2n |n>=0}
(iii) L={0n+1 1n | n>=0} 6 3 3 3

Unit - IV
07 a) Design PDA for the following language accepted by final state.
L={an bn+m cm : n=0, m 1} 8 3 4 3
b) Give the formal definition of PDA and define the following
(i) Instantaneous description of PDA. (ii) Acceptance of a language by PDA. 6 4 4 1
c) Is the PDA corresponding to the language L={a b | n>=1} by a final state is
n n

deterministic? 6 3 4 2

OR
08 a) Design PDA for the following language accepted by final state. Also write its
transition diagram and instantaneous description on the string “aacccbb”.
L ={ an cm bn : m1,n1} 10 3 4 3

Contd….
-3- S4CCSI02
b) Give the formal definition of DPDA. Is the PDA corresponding to the language
L={w |w €(a+b)* and na (w) =nb(w)} is deterministic? 10 3 4 2

Unit - V
09 a) Define a Turing Machine. With a neat diagram explain the working of a Turing
Machine. 6 3 5 1
b) Design a Turing Machine that accepts the language L={0 1 | n  1}. Give the
n n

graphical representation for the Turing Machine obtained and also show the moves
made by the Turing machine for the string 000111. 10 3 5 3
c) Write a note on Multitape Turing Machine. 4 4 5 2

OR
10 a) Obtain a Turing Machine to accept the language containing strings of 0’s and 1’s
ending with 011. 6 3 5 3
b) Obtain a Turing machine to accept the language L={w |w is even and {a, b}.
Show the moves made by the Turing machine for the string 0101. 10 4 5 3
c) Define the following :
- ID of a Turing machine
- Language accepted by a TM 4 2 5 2

________
USN 1 S I S4CCSI02
Siddaganga Institute of Technology, Tumakuru-572 103
(An Autonomous Institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi)

Even Semester Bachelor of Engineering Makeup Examinations September 2024


Theory of Computations
Time: 3 Hours Max. Marks: 100
Note : 1. Revealing of Identity in any form in the answer book will be treated as malpractice.
2. Answer any five questions choosing one full question from each unit.

Unit - I M BL CO PO PSO

01 a) Define (i) Power of an Alphabet (ii) NFA. 4 1 1 1 1


b) Define DFA. Construct a DFA for the language � = {�|� has odd number of 1’s
and is followed by even number of 0’s } 8 3 1 3 1
c) Obtain an NFA to accept the language consisting of a’s and b’s ending with string
ab or ba and convert it into equivalent DFA. 8 2 1 3 1

OR
02 a) Mention the differences between DFA, NFA and -NFA. 6 2 1 1 1
b) Obtain a DFA to accept the language � = {�|��(� + �) ; |�| mod 3 = 0 } ∗
6 3 1 3 1
c) Convert the following -NFA to equivalent DFA:
 a b c
p {q,r} ∅ {q} {r}
Q ∅ {p} {r} {p,q}
*r ∅ ∅ ∅ ∅ 8 3 1 3 1

Unit - II
03 a) Define regular expression. Write the regular expression for the following
languages:
(i) Strings of a’s and b’s having odd length.
(ii) Strings of a’s and b’s with at most one pair of consecutive a’s
(iii) L={anbm : m  2, n  2}. 8 2 2 3 1
b) Build a regular expression for the shown in Fig.3b, finite automata using state
elimination method:

Fig. 3b 6 3 2 3 1
c) Convert the following Regular expressions to -NFA:
(i) (0+1)* 1(0+1) (ii) 00(0+1)* 6 2 2 3 1

OR
04 a) Minimize the following DFA by identifying distinguishable and Non-
distinguishable states:
 0 1
 A B F
B G C
*C A C
D C G
E H F
F C G
G G F
H G C 10 3 2 3 1

-1- Please Turn Over


-2- S4CCSI02
b) Prove that every language defined by a regular expression is also defined by a
finite automaton. 6 2 2 3 1
c) Obtain regular expression for the following languages:
(i) L={an bm cp | n  4, m  2, p  2} (ii) L={an bm | m+n B even} 4 2 2 3 1

Unit - III
05 a) Define Context Free Grammar(CFG). Write CFG for the following language:
L={0m 1m 2n : m  1, n  0} 5 2 3 2 1
b) When the language is said to be inherently ambiguous? Show that the following
grammar is ambiguous:
S  AB | aaB Aa |Aa B b 7 2 3 2 1
c) Simplify the following grammar:
S AB |AC Aa Ab |  BbA c b Ca DAB 8 3 3 3 1

OR
06 a) Design a CFG for the following languages:
(i) L={an bm ck | n+2m =k for m0 and n0}
(ii) L={w wR | w  (a,b)* and wR is the reverse of w}
(iii) L={an bn | n  m}
(iv) L ={an b2n over = {a,b}, n1} 10 2 3 3 1
b) Define Chomsky Normal Form(CNF). Convert the following CFG into CNF:
S A SB | Aa AS|a BSbS |A|bb 10 3 3 3 1

Unit - IV
07 a) Define Put Down Automata (PDA). Design PDA to accept the language by final
state method: L(m) ={wcwR| w  (a,b)* and wR is reverse of w}. Draw generated
transition diagram. 10 3 4 3 1
b) Write the procedure to convert CFG to PDA. Convert the following CFG to PDA:
S  aAA Aas |bs|a 10 2 4 1 1

OR
08 a) Design PDA’s to accept each of the following languages:
(i) { 0n |n : n  1} (ii) The set of all strings of 0’s and 1’s with an equal
number of 0’s and 1’s. 10 3 4 3 1
b) Convert the following PDA to CFG:
(q0,a ,Z) = (q0, A,Z), (q0,a ,A) = (q0, A), (q0,b ,A) = (q0,),
(q1, ,Z) = (q2,) 6 3 4 3 1
c) Differentiate between deterministic PDA and non-deterministic PDA. 4 2 4 2 1

Unit - V
09 a) Design a Turing Machine™ to accept strings formed on {0,1} and ending with
000. Write transition diagram on ID for w=101000. 12 3 5 3 1
b) Write a note on restricted Turing machines. 8 1 5 1 1

OR
10 a) Define Turing machine with its tuples. 4 1 5 2 1
b) Write a note on multitape TM. 6 1 5 1 1
c) Construct a TM that accept the language 0 1 , where n>1 and draw transition
n n

graph for TM. 10 3 5 3 1

________

You might also like