0% found this document useful (0 votes)
4 views

TOC_ImpQuestion

TOC

Uploaded by

dd5675596
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

TOC_ImpQuestion

TOC

Uploaded by

dd5675596
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Theory Of Computation (BCS503)

Module 3,4 and 5 Important Questions


1) Discuss Types of grammars based on Chomsky Hierarchy.
2) Define Context Free Grammar (CFG). Design CFG for the following language
i) L = {a n b m | n ≥ 0, m > n}
ii) L = {0 m 1 m 2 n | m ≥ 1, n ≥ 0}
iii) L = {0 i 1 j | i≠j , i ≥ 0, j ≥ 0 }
iv) L = {a n b m c k | m = n+k , n ≥ 0, k ≥ 0}
v) L = {w | Na(w) = Nb(w) }
vi) L = { 0 n 12n , n ≥ 0 }
vii) Generate a string of balanced parantheses.
viii) L = {w : |w| mod 3 = 0} on ∑={a}
ix) L = {w | Na(w) > Nb(w) } on ∑={a,b}
x) L = L1 U L2 , where L1 = {a n b m | n ≥ 0, m > n}, L2 = { 0 n 12n , n ≥ 0
}
3) Define i) Ambiguity ii) CFG iii) CNF iv) GNF v) PDA vi) Leftmost derivation vii)
Rightmost derivation viii) Parse tree

4) Consider the following grammars and find the leftmost, rightmost derivations and parse
trees for the given string and show that the following grammars are ambiguous.
a) E-> E+E | E*E | (E) | id. Given string is “id + id * id”

b) S -> aB | bA A-> aS | bAA | a , B -> bS | aBB | b. Given string is “aaabbabbba”


c) S -> iCtS | iCtSeS | a , C -> b. Given string is “ibtibtaea”
d) E -> E+E | E*E | E – E | E / E | a/b . Given string is “a + b * a – b”
e) E -> * EE | -EE | +EE | x | y. Given string is “- + * xyxy”

5) Design a PDA to accept the following language by final state method and show the
moves made by PDA for the given string.
a) L= { w C wR | w ϵ (a+b)* where wR is reverse of w} . Given strings are
“aabCbaa’’ and “aabCbab”
b) L= {anbn | n>=1}, Given string is “aaabbb”
c) L = {w | w ϵ (a,b)* and Na(w) > Nb(w) }, Given string is “aaabb”
d) A string of balanced parentheses. Parentheses considered are ( , ) , [ , ]. Given
string is “ [ ( ) ( [ ] ) ] “
e) L= {anb2n | n>=1}, Given string is “aabbbb”

6) Conversion of CFG to CNF .(refer class notes)


7) Conversion of CFG to GNF.(refer class notes)
8) State and prove pumping lemma theorem for Context Free languages.
9) If L1 and L2 are context free languages (CFLs), then prove that L1 U L2, L1.L2 and
L* are CFLs.
10) Define Turing Machine. Explain the working of TM with a neat diagram.
11) Design a Turing machine to accept the following and draw the transition diagram.
a) language containing strings of 0’s and 1’s ending with 011
b) L= {0n1n | n >=1} and Show the moves made for string 0011.
c) language containing strings of 0’s and 1’s ending with 011
d) L= {0n1n 2 n | n >=1}
e) L = { w | w is even and ∑ = {a,b} }
12) Prove that the following languages are not context free.
i) L= { a n b n c n | n ≥ 0 }
ii) L= {a n! | n ≥ 0 }
iii) L = { a i b j | j = i 2 }
iv) L= { a p | p is a prime number }
v) L = { w | w ϵ {a,b,c}* where Na(w) = Nb(w) =Nc(w) }
vi) L= {ww | w ϵ ( a + b)* }
vii) L= { a p b q | p = q2 }

You might also like