0% found this document useful (0 votes)
31 views5 pages

Automata May 2021

This document is an examination paper for the University of Nairobi's CSC 222 Automata Theory course for the academic year 2020/2021. It includes questions on recursive definitions, regular expressions, finite automata, context-free grammars, and Turing machines, requiring students to demonstrate their understanding of automata theory concepts. The exam consists of a compulsory section and additional questions from which students must choose to answer.

Uploaded by

Jay D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views5 pages

Automata May 2021

This document is an examination paper for the University of Nairobi's CSC 222 Automata Theory course for the academic year 2020/2021. It includes questions on recursive definitions, regular expressions, finite automata, context-free grammars, and Turing machines, requiring students to demonstrate their understanding of automata theory concepts. The exam consists of a compulsory section and additional questions from which students must choose to answer.

Uploaded by

Jay D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

UNIVERSITY OF NAIROBI

UNIVERSITY EXAMINATIONS 2020/2021

SECOND YEAR EXAMINATIONS FOR THE DEGREE OF BACHELOR OF SCIENCE IN


COMPUTER SCIENCE

CSC 222 : AUTOMATA THEORY

DATE: 6th May 2021 TIME: 2.00 - 4.00PM INSTRUCTIONS: Answer all

questions in Section A, and any two questions from Section B. SECTION A

(COMPULSORY)

Question 1 (20 Marks)

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)

Question 2 (15 Marks)


a) Using Kleene's theorem, build a FA that defines the language L over the alphabet Σ = {0,1}, as
given by the regular expression L = J + K, where J is the language of strings that do not contain
the substring 10, and K is the language of strings that contain an even number of 1's.
(6 marks)

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)

Question 3 (15 Marks)


a) Describe the language that is accepted by the following PDA. (3 marks)

b) Define a CFG that


accepts the language accepted by the above PDA. (3 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)*

Question 4 (15 marks)


a) Consider the Turing Machine defined as follows:
(q0,0,q0,0,R), (q0,1,q1,0,R), (q0,B,q2,B,R), (q1,0,q1,0,R), (q1,1,q0,1,R) and (q1,B,q2,B,R). Describe
what this TM does when presented with bit strings defined over the alphabet Σ = {0,1} as
input. (Note: B = Blank). (5 marks)
b) Define a CFG for the following fragment of TIME language. (5 marks)

c) Construct an NFA for the state table given below. (3 marks)


∂01
- q0 {q0,q1} {q3}
q1 {q0} {q1,q3}
+ q2 Ø {q0,q2}
+ q3 {q1,q2,q3} {q1}

3
d) Provide a regular expression that defines the language accepted by this NFA. (2 marks)
4

You might also like