Professional Documents
Culture Documents
a) L1 is the language over the alphabet {a, b} of strings which do not contain double b. L2 is
the language over the alphabet {a, b} of strings that end with letter a.
i. Give the transition diagram of a deterministic finite automaton for L1. [3]
ii. Give a regular grammar for L1. [2]
iii. Give the transition diagram of a deterministic finite automaton for L2. [1]
iv. Give transition diagram of a deterministic finite automaton L2*. [3]
v. Give the transition diagram of a deterministic finite automaton for L1 L2. [5]
vi. Give the transition diagram of a deterministic finite automaton for L1 L2. [1]
vii. Give the transition diagram of a deterministic finite automaton for L2 L1. [8]
viii. Give the transition diagram of a deterministic finite automaton for L1 L2. [5]
ix. Give the transition diagram of a deterministic finite automaton for L2 L1. [5]
x. Hence or otherwise show that L2 L1 ≠L1 L2 [2]
i. Create a rightmost derivation to show that the following string is a legal assignment
statement: C = (A - C) * ((A * C)-B) [10
Marks]
ii. Create a parse tree to show that the following string is a legal assignment statement: C
= (A - C) * ((A * C)-B) [10 Marks]
7. L is the language over alphabet {a, b, c} in which every string has the same number of as and
bs, all the as come before the bs, and arbitrarily many cs can be in front, behind or
among the as and bs. For example, L includes the strings abc, caabcb,
ccacaabcccbcbcc and so on.
i. Give a context-free grammar for L. [5]
8. Using the pumping lemma, prove that the Language L= {0n110n for n = 0, 1, 2, 3, E}
is not regular. [5]