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

ToC Sample Questions Module 2 and 3

Uploaded by

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

ToC Sample Questions Module 2 and 3

Uploaded by

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

Theory of Computation

1. Write Regular expression for the following


a. L = { an bm : m, n are even}
b. L = { an,bm : m>=2,n>=2}.
c. L={w: |w| mod 3=0}
d. L = { an b2n | n>=0}
e. Strings of a’s and b’s having two consecutive a’s
f. Strings of a’s and b’s whose 3rd symbol from right end is a
g. L = { a2n b2m+1 | n>=0,m>=0}
2. Conver the following to RE

3. Convert following RE’s into FSM’s


a.(ab*)* b. (a U b)* c. a*U b* d. (aUb)ab
4. State and prove pumping lemma for regular languages.
5. Closure properties of regular languages with examples. Learn all problems solved in
class.
6. Prove the following:
a. Language L = {WWR: W∈(0,1)*} is not regular.
b. Language L = {anbn | n≥0} is not regular.
c. Language L = {ap | p is prime} is not regular.
7. Define Context Free Grammar. Define CFG for the following languages:
a. L1 = {w: |w| mod 3 = 0}over Σ={a}
b. L2 = {anbmck: m = n+k} overΣ={a, b, c}
c. L3 = {anbmcp: n ≤ 4, m ≥ 2, p ≤ 2 }overΣ={a, b, c}
d. L4 = {w: |w| mod 3 = 0}over Σ={a, b}
e. L5 = {anbm: m + n is even} over Σ={a, b}
f. L6 = {0m1m2p: m ≥ 1, p ≥ 0 }Σ={0, 1, 2}
g. L7 = {anbmck: n+2m = k, m ≥ 0, n ≥ 0 }Σ={a, b, c}
h. L8 = {anb2n: n ≥ 1 }Σ={a, b}
i. L9 = {a2n+3bn: n ≥ 0 }over Σ={a, b}
j. L10 = {anbn: n ≥ 0 } over Σ={a, b}
k. L11= {WWR: W∈ {a,b}*}
l. L12 = {w: na(w) = nb(w) where w∈ {a,b}*}
8. Obtain a grammar to generate the following languages
m. L={an bn : n≥ 0}
n. L={an+1bn : n≥ 0}
o. L={an bn+1 : n≥ 0}
p. L={an bn+2 : n≥ 0}
q. L={an b2n : n≥ 0}
9. Obtain a grammar to generate set of all palindromes over ∑={a,b}
10. Define ambiguity.
Consider the grammar
EE+E | E*E | (E) | id
Find the leftmost and rightmost derivations and parse tree for the string id + id * id,
show that thegrammar is ambiguous.
11. What is ambiguity in grammar? Eliminate ambiguity from balanced parenthesis
grammar.
12. Define the following terms and give example for each :
a) Derivation tree (parse tree) b) yield of a tree c) ambiguous grammar d) sentential
form
13. Write LMD and RMD with respective parse trees for the following production,
considering the string aabbab
SaB | bA
AaS | bAA | a
BbS | aBB | b

You might also like