Model Question ToC
Model Question ToC
MODEL EXAMINATION
YEAR& SEMESTER: II & IV BRANCH: AIML, Cyber Security
DATE&SESSION: 17.05.2025 & FN TIME: 3 HOURS
COURSE CODE & NAME: CS3452-THEORY OF COMPUTATION
11.a) Construct PDA for the language L = { wwᴿ | w ∈ {a, b}* }. L4-AP CO1 13
OR
11.b) Explain the design and working of a PDA for L2-UN CO1 13
L = { aⁿbᵐcⁿ⁺ᵐ | n, m ≥ 0 }
12.a) Convert the following Pushdown Automaton (PDA) to an equivalent L3-AP CO2 13
Context-Free Grammar (CFG):
Given the PDA with the following transitions:
States: {q₀, q₁, q₂}
Start state: q₀, Accepting state: q₂
Input alphabet: {a, b}
Stack alphabet: {Z, A, B}
Transitions:
q₀ → (a, Z → AZ)
q₀ → (a, A → AA)
q₀ → (b, A → ε)
q₀ → (ε, Z → ε)
OR
12.b) (i). Let G = (V, E, R, S) be the CFG, where V = {A, B, S}, E = {a, b}, L3-AP CO2 6+7
S is the start variable and R consist of the rules:
S aB / bA, A a / aS / BAA, B b / bS / ABB, Prove that ababba
∑ L(G). Prove that L(G) is the set of all non-empty strings w over the
alphabet {a, b} such that the number a’s in w is equal to the number of
b’s in w
(ii). Design the PDA to accept the language L={anbmcmd(n/2) | n,m
>=1}
13.a) Convert the following Context-Free Grammar (CFG) into Chomsky L3-AP CO2 13
Normal Form (CNF):
S → AB | a
A→a|ε
B → bB | ε
OR
13.b) Convert the following Context-Free Grammar (CFG) into Greibach L3-AP C02 13
Normal Form (GNF):
S → aAb | bB
A → aA | b
B → aB | ε
OR
14.b) Consider the following CFG: 13
S → SS | aSb | ab
i. Derive the string aabb using the grammar.
ii. Identify whether the grammar is ambiguous. If it is, provide
two different derivations for the string aabb and explain why
the grammar is ambiguous.
iii. Discuss the implications of ambiguity in this context-free
grammar.
iv. Convert the CFG to Greibach Normal Form (GNF) and show
the conversion steps.
Prepared by Verified By
Name: Dr. Deepalakshmi R Name: Dr. Deepalakshmi R
Designation: Professor&Head Designation: Professor&Head
Signature: Signature: