Automata May 2021
Automata May 2021
DATE: 6th May 2021 TIME: 2.00 - 4.00PM INSTRUCTIONS: Answer all
(COMPULSORY)
a) Give a recursive definition for the language L defined over the alphabet Σ = {a,b} and whose
words are described by the regular expression aa* + bb* + (ab)(ab)* + (ba)(ba)*. (3 marks)
b) Find the regular expressions describing the following languages defined over the alphabet Σ =
{0,1}:
i. L1 = {0n1m: n ≥ 2, m ≥ 1, n+m ≥ 4} (2 marks) ii. L2 = {x : |x| mod 3 = 0} (2 marks)
iii. L3 = {pqp : p,q ∈ {0,1}* and | p | = 3} (2 marks) c) Consider the following Moore
machine.
i. Describe the string processing task being performed by this Moore machine.(2 marks)
ii. Provide a regular expression that describes the language defined by the Moore machine given in (i)
above. (2 marks) d) Define a CFG that generates the language over the alphabet Σ = {α,β,θ} defined
by the regular expression: β(α + β)*αθα(α + β + θ)*β. (5 marks)
1
e) Define a Regular Expression that describes the language accepted by the following finite
automaton. (2 marks)
SECTION B (ANSWER TWO QUESTIONS FROM THIS SECTION)
b) Provide the regular expression for the language L(r) defined over the alphabet Σ = {a,b} that is
accepted by the following DFA. (4 marks)
c) Obtain Right-linear and Left-linear grammars for the language L defined over the alphabet Σ =
{0,1} whose words contain the substring 101. Show your working step by step to demonstrate how
you obtain the linear grammars. (5 marks)
2
c) Give the regular expression that defines the complement of L where L is defined over the alphabet
Σ = {a,b} and whose strings start and end with an a and have any number of a’s and b’s in the
middle. (5 marks)
d) The table below defines regular expressions for international telephone numbers and associated
output codes defined over the input alphabet Σ = {0,1,2,3,4,5,6,7,8,9} and output alphabet Γ =
{X,K,U,B} respectively. Define a Mealy machine that accepts the given telephone numbers and
outputs the corresponding code. (4 marks)
Dialling Mealy output
code code
254* XXK(X)*
256* XXU(X)*
44* XB(X)*
3
d) Provide a regular expression that defines the language accepted by this NFA. (2 marks)
4