Final Term Paper Spring2018
Final Term Paper Spring2018
_________
Instructions:
Attempt all questions.
Q2: Write regular expressions for the following languages defined over = {0, 1}:
(Marks: 1x4=4)
a) {w | w contains a single 1}
b) {w | w has at least one 1}
c) {w | every 0 in w is followed by at least one 1}
d) {w | the length of w is a multiple of three}
Q4: Obtain the language generated by each of the following production rules. Also write down
their RE (Regular Expression). (Marks: 1x2=2)
a) S aS
S ε
b) S aS
S bS
S a
Page 1 of 3
Name: ____________________________ Seat No. _________
Q6: Here is a context-free grammar G = ({S, A, B}, {0, 1}, P, S), where P is the set of
productions: (Marks: 1x3=3)
S 0A | 1B| ε
A 1S | 0AA
B 0S | 1BB
Intuitively, A generates strings with one more 1 than 0, B generates strings with one more
0 than 1, and S generates the strings with equal numbers of 0's and 1's.
Q7: Show the ID’s of the following Turing Machine that accepts {0n1n | n≥1}, If the input tape
contains: (Marks: 2x3=6)
a) 00
b) 000111
c) 00111
Symbol
State 0 1 X Y B
q0 (q1 , X, R) - - (q3 , Y, R) -
q1 (q1 , 0, R) (q2 , Y, L) - (q1 ,Y, R) -
q2 (q2 , 0, L) - (q0 , X, R) (q2 , Y, L) -
q3 - - - (q3 , Y, R) (q4 , B, R)
q4 - - - - -
Page 2 of 3
Name: ____________________________ Seat No. _________
M = ({q1, q2, q3, q4}, {0, 1}, {$, 0, 1}, d, q1, {q4})
Starting from the initial ID (q1, ω , e), show all reachable ID’s when the input ω is 000111.
b) Given that the PDA P= ({q, p}, {0, 1}, {Z0, X}, δ, q, Z0, {p}) has the following transition
function:
Starting from the initial ID (q0, ω, Z0), show all the reachable ID’s when the input ω is 1111.
Good Luck
Page 3 of 3