End Semester Examination: Thapar University, Patiala

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Roll Number:

Thapar University, Patiala


Department of Computer Science and Engineering
END SEMESTER EXAMINATION
B. E. (Third Year): Semester-I (2019/20) Course Code: UCS701
(COE) Course Name: Theory of Computation
December 07, 2019 Saturday, 14:00 - 17:00 PM
Time: 3 Flours, M. Marks: 100 Name of Faculty: AKU, AA, RAH, ST, SSH
Note: Attempt all questions in sequence. Do not write answers with pencil. Answers written
with pencil will not be evaluated. Assume missing data, if any, suitably.

Q1 Digital computers represent all information by bit strings, using some type of
encoding. For example, character information can be encoded using the well-known
ASCII system. For this question, consider the two alphabets fa,b,c,d) and {0,1),
respectively, and an encoding from the first to the second, defined by a -0 00,
b -> 01, c -> 10, d -> 11.
(a) Construct a Moore machine for decoding strings on {0, 1) into the original message. (5)
For example, the input 010011 should generate as output bad.
(b) Construct a Mealy machine equivalent to the Moore Machine obtained in the above (5)
step.

Q2(a) Consider the NFA M having the transition table shown by Table 1. The NFA M has set (5)
of states, Q = {go , q1, q3, q3). The initial state is qo and the accepting state is q3. The
alphabet is fa, b). Determine the equivalent minimized DFA M', such that
L(M') = L(M).

Table 1: Transition table of NFA M

a
a
q0 0 (q1) fq2)
ql [q2) {q3) 0

0 0 b 41,
q2 (q1)
q3 0 0 0
(Figure 1)

(b) Derive a regular expression for the language recognized by the DFA shown in Figure (5)
1 using Arden's method.

Q3 Given the CFG grammar G having following productions (10)

S -0 AYI BZIalb, X AY I BZIalb, Z->XB, Y -> XA, B b, A -ea


Using the CYK algorithm, determine whether the strings abbba and aaaba can be
generated from G. Draw the CYK tables for both the strings.

P.T.O
Q4(a) Explain the Chomsky classification of grammars and relationship between different
types of grammars and automata with the help of a suitable diagram.

(b) Design a minimized DFA for the language over E = {a, b) such that it contains the set
of all strings that begin with a but do not contain aab as a substring.

Q5 Design a pushdown automaton (PDA) for the language L = {a3" 002" ri 01 . Write
down your logic clearly. Write down the transition function for the same. Write down
the context-free grammar for the language L.

Q6 Convert the following CFG into Chomsky Normal Form (CNF) grammar. (10)
S AB, A aAAIE, B bBBIE

Q7(a) What do you mean by recursive and recursive enumerable languages? Give examples (5)
of both. What is the relation between them?

(b) Write short note on the Universal Turing Machine (UTM). (5)

Q8(a) Explain what a Pushdown Automaton (PDA) is. Illustrate the different ways in which (5)
a PDA can accept a string.

(b) Design the regular expressions (RE) for the following regular languages (L) defined (5)
over E = {a, b)

i) L = (wiw do not end with ab}


ii) L = (wlw contains no more than one occurrence of substring aa}
iii) L = (wlw contains odd number of a's)
iv) L = (wlw does not contains aba as substring}
v) L = (wlevery pair of adjacent b's appears before any pair of adjacent a's)

Q9 Design a Turing machine which compares two positive integers m and n and (10)
produces output Y as follows:

{A, if in > n
Y= B, if 171 < 71
C, if m = n

Q10(a) Using the pumping lemma, show that L = {wwlw E fa, br} is not a context free (5)
language.
(2+1+2)
(b) Write a CFG for the following languages

i) L = {w E (a, WI n" (w) = 2nb (w))


ii) L tanbmck I n,m, k>Oandn+ 2m= k}

iii) L is the set of all palindrome over (a, b}` that do not contain the substring aa

The schedule of showing the evaluated answer sheets will be shown on the course
website at https://sites.google.com/a/thapar.edu/ucs-701/

P.T.O

You might also like