P13CS43 JB
P13CS43 JB
1
U.S.N
{
i) L = w(ab + ba ) | w ∈ {a, b }* } ii) L = {w | w mod 5 ≠ 0 where w ∈ {a, b }* }
10
10
c. Show that regular languages are closed under compliment and difference. 6
Contd…2
P13CS43 Page No... 2
UNIT - III
5 a. Define CFG. Obtain the CFG for the following languages :
i ) L = {a n b n | n ≥ 0} ii) L = {ww R | w ∈ {a, b }*}
5
b. Obtain the leftmost and rightmost derivation for the string ‘abababa’ from the grammar
5
S →SbS | a
c. Define the term ambiguity and show that E → E + E | E * E | a is ambiguous. 5
d. Show that CFL are not closed under intersection. 5
6 a. Eliminate epsilon unit and useless production from the following grammar :
S → ABC | BaB
A → aA | BaC | aaa 10
B → bBb | a | D
C → CA | AC
D→C
b. Define CNF and GNF. Convert the following grammar into CNF :
S → aBa |abba 10
A → ab |AA
B → aB | a
UNIT - IV
7 a. Construct a PDA for the language L= {wwR | w ∈ {a, b }*} and show the string acceptance. 10
b. Construct a PDA for the language L = {a n b 2 n | n ≥ 1} and show the string acceptance. 10
8 a. Convert the following grammar:
S → aSa | aa
10
S → bSb | bb
to PDA that accepts the same language by empty stack.
b. Check whether the PDA for the language L = {w ⊂ wR | w ∈ {a, b }*} is deterministic or not. 10
UNIT - V
9 a. Design a Turing machine to accept the language :
10
L = {na ( w) = nb ( w), where w ∈ {a, b }*} .
****