Course Code : CST 257 / CCT 207 / MQNR/RS – 23 / 1161
CDT 209
Fourth Semester B. Tech. ( Computer Science and Engineering /
Cyber Security / Data Science ) Examination
FORMAL LANGUAGES AND AUTOMATA THEORY /
THEORY OF COMPUTATION
Time : 3 Hours ] [ Max. Marks : 60
Instructions to Candidates :—
Each question carries the marks as indicated.
1. (a) Explain the Chomsky hierarchy and classify the following grammar to identify
its type :
S u 0S1 | 0A1
A u 1A | 11 2(CO1)
(b) Prove that the string "aaabbabbba" is valid for the grammar using leftmost
derivation and also draw parse tree :
S u aB / bA
A u a / aS / bAA
B u b / bS / aBB 2(CO1)
(c) Design DFA to accept :
(i) Language, L = {w : Na(w) mod 3 > Nb(w) mod 3}. Σ = {a, b}.
(ii) All strings for {0, 1} not containing 011 as a substring.
(iii) All strings of (0, 1) with no more than three 0's.
6(CO2)
MQNR/RS-23 / 1161 Contd.
2. (a) Convert following NFA with R - transitions to NFA without R - transitions.
δ R 0 1
uA {B, D} A ϕ
B ϕ C E
C ϕ ϕ B
D ϕ E D
*E ϕ ϕ ϕ 3(CO2)
(b) Design the Deterministic finite automata for the following NFA. Also apply
the optimization algorithm to optimize the resultant DFA.
δ 0 1
p {q, s} {q}
q {r} {q, r}
r {s} {p}
s – {p} 5(CO2)
(c) Construct a Mealy machine from Moore Machine.
2(CO2)
3. (a) Construct a NFA for the Regular Expression : (0*1*)*000(0 + 1)*.
2(CO2)
(b) Obtain an equivalent right linear grammar for the left linear grammar given
below :
S u Abc / c
A u Acc / bc. 3(CO1)
MQNR/RS-23 / 1161 2 Contd.
(c) Convert the following grammar to Chomsky Normal Form :
S u a | aA | B
A u aBB | ε
B u Aa | b 3(CO1)
(d) Write regular expression for :
(i) All strings of {a, b, c} with no more than 3 a.
(ii) All strings of 0 and 1 with even nos. of 0. 2(CO1)
4. (a) Obtain PDA for following CFG :
S u 0BB
B u 0S | 1S | 0 3(CO3)
(b) Convert the given Push Down Automata to Context Free Grammar.
M = ({q0, q1}, {0, 1}, {Z0, X}, δ, q0, Z0, Φ} where δ is given below :
δ(q0, 1, Z0) u {(q0, XZ0)}
δ(q0, 1, X) u {(q0, XX)}
δ(q0, 0, X) u {(q1, X)}
δ(q0, ε, Z0) u {(q0, ε)}
δ(q1, 1, X) u {(q1, ε)}
δ(q1, 0, Z0) u {(q0, Z0)} 3(CO3)
(c) Construct a Pushdown Automata for the language :
L = {0n 1m 0n+2m / m, n >= 1} 4(CO3)
5. (a) Design Turing Machine that recognizes the presence of substring '101' and
replace it with '110'. 5(CO3)
(b) Design Turing machine for
L = {ai b j ck | i, j, k >= 1 and i = k + j}. 5(CO3)
MQNR/RS-23 / 1161 3 Contd.
6. (a) Prove that the function f (x, y) = x y is primitive recursive function.
3(CO4)
(b) Prove the following Ackerman function : A(2, y) = 2y + 3. 3(CO4)
(c) Prove that the language is not regular using Pumping Lemma :
L = {an b n cn | n >= 1}. 4(CO4)
MQNR/RS-23 / 1161 4 305