0% found this document useful (0 votes)
55 views2 pages

UCS701

Uploaded by

aaggarwal4be21
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)
55 views2 pages

UCS701

Uploaded by

aaggarwal4be21
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/ 2

Roll Number: Number of Pages: 02

Thapar Institute of Engineering & Technology, Patiala


Department of Computer Science and Engineering
END SEMESTER EXAMINATION
BE(COE Third Year): Semester-V(2020/21) Course Code: UCS701
Course Name: Theory of Computation
Jan 25, 2021 Monday, 14.30 - 16.30 Hrs
Time: 2 Hours, M. Marks: 50 Name Of Faculty: Dr Ajay Kumar, Dr
Rohit Ahuja

Note: Attempt all questions with propec Justification. Without justification Zero marks
will be awarded. Assume missing data, if any, suitably. Attempt any 5 out of 7 questions.

Q1(a) Convert the Regular expression 1*(10)*1* into E-NFA by using (2+2
Thompson's Construction. Employ e-closure to convert E-NFA into an +2)
equivalent DFA. Finally convert DFA into an minimized DFA.

Q1(b) Consider the unrestricted grammar over the singleton alphabet E = {a} , (4)
having the start symbol S, and with the following productions.
S —> AS aT
Aa —> aaaA
AT —> T
T -->
Generate the string w= aaaaaaaaa using above grammar.
Q2(a) Prove that the language L = I i, j z 0 and jl is a prime } is not a (6)
regular language using pumping lemma. (Note: 1 is not treated as a prime
number.
Q2(b) Design a minimal DFA corresponding to the following diagram. (4)
(Consider A as starting and C as final state)

8
Q3(a) Explain the mechanism of implementing a machine equivalent to Turing (3)
Machine using Queue data structure with the help of any example.
Q3(b) Write down the logic to design the Turing Machine for the language (7)
L3 = {W I W E {0 + 1+ 2}* and no(w) = n,(w) = n2(w))
no(w): number of 0's in the Turiang Machine

1
ni (w): number of l's in the Turing Machine
n2 (w) : number of 2's in the Turing Machine
Design the Turing machine for language L3 and explain the processing of
string acbbca .
Q4 (a) Consider the context-free grammar G over {a, b}, with start symbol S, and (4)
with the following productions.
S —> aaB I Abb
A —> a I aA
B —> b I bB
Check whether the given grammar G is ambiguous or not. If it is
ambiguous prove it with the help of an example.
Q4(b) Design a Moore Machine to count the number of times substring "raj" (6)
appears in a string over alphabet I = {p,r,a, j} and convert the Moore
machine into an equivalent Mealy Machine.
Q5 (a) Convert the following grammar over E = {a,b,c,d} to the Greibach Normal (7)
Form (GNF).
S —> aSd IT
T—*bTcI e
Q5 (b) Prove that context-free languages are not closed under intersection with (3)
the help of an example.
Q6 Design regular expression, deterministic finite automaton and regular (10)
grammar for the following languages:
a) L6a = {w I w E {a, b}* and w has b at every odd position and length of
w is odd).
b) L66 = {w I w e fa ,b}. and w has both bb and aba as substring}.

Q7(a) Design context-free grammar and pushdown automata for the language (7)
L= {amb' c" dk In,m,k 0} . Also write the transition function for the
pushdown automata.
Q7(b) Write down the Pumping lemma statement for context-free language and (3)
i0
specify various conditions used in the Pumping lemma.
e

You might also like