0% found this document useful (0 votes)
26 views

UCS701 (3)

This document outlines the End Semester Test for the BE Third Year Computer Science and Engineering students at Thapar Institute, scheduled for May 13, 2023. It includes various questions on topics such as grammar transformations, context-free languages, finite automata, flowcharts, and Turing machines. The test consists of multiple questions requiring justification and construction of grammars and machines.

Uploaded by

Anant Singla
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)
26 views

UCS701 (3)

This document outlines the End Semester Test for the BE Third Year Computer Science and Engineering students at Thapar Institute, scheduled for May 13, 2023. It includes various questions on topics such as grammar transformations, context-free languages, finite automata, flowcharts, and Turing machines. The test consists of multiple questions requiring justification and construction of grammars and machines.

Uploaded by

Anant Singla
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:

Thapar Institute of Engineering and Technology Patiala


Computer Science and Engineering Department
End Sem Test
BE Third Year (6"' Semester) 13" May, 2023 9:00AM UCS701: Theory of Computation
Time: 3 Hours, Max Marks:40 Coordinators: Dr. Sunita Garhwal, Dr.
Nitigya Sambyal
Instructors: Sunita Garhwal, Nitigya Sambyal, Chinmaya Panigrahy, Nidhi Kalra, Shashank
Sheshar, Javed Imran

Note: Attempt all questions with proper justification. Assume missing data, if, any, suitab y.

Q1 a) Consider the following grammar G: 2+4


S -.) (L)la
L -0 L,S I S

Remove the left recursion from the above grammar G.

b) Consider a context-free grammar G:


S -) XY
X -0 YS I 1
Y -) SX I 0
Convert the context-free grammar into Greibach Normal Form(GNF).

Q2 a) Construct a context-free grammar over (0, 1 } for the languages 3+2+2


i) Li = {w I w starts and ends with the same symbol}
ii) L2 = {w I length of w is odd}

b) Construct deterministic finite automaton which accept a string containing "ing" at


the end of a string over (a-z.), e.g., "anything" but not "anywhere."

c) Given the regular expression r = 1*( I 0)*1*. Convert the given r into NFA using
Thompson's construction.

a) Draw the flowchart for the language L=1,.anb2mcomd p


I n>o, m> 0, p>n) Write down
Q3
the transition diagram for the above-designed flowchart. 5+2

b) Design a CFG for the language L over (0, 1) to generate all strings having alternate
sequence of 0 and 1.

Q4 a) Consider the CFLs Li=(anb" I n>1) and Li =(aPbq I p,q>1), then intersection of Li
and L2 is a CFL or not. Justify your answer.
2+4
b) Given the context-free grammar
S -) XY
X -) alblX A
Y -, alAY
A -, a
Apply CYK algorithm to determine whether the string w=babaa belongs to the
language generated by the above given grammar.

[P.T.0.]
a) Prove that L=ta"b"c" I n>0) is not context-free language using Pumping Lemma. 3+4
Q5

b) Design a Mealy machine that recognises the double occurrence of symbol 'a ' in
the input string w e(a,b }*. Show the output sequence for the string w= aahahha.
[Hint: input: aba then ouput: 000, input: aaab then output: 0110 ]

Q6 a) Design a Post machine for the language L=(anb" I n>0 ). 3+4

b) Write down the logic for design of a Turing machine over 10, 1} for the language
L---{w I w contains equal number of 0's and l's in any order, and Iwi>=2}. Design
the Turing machine for L.

You might also like