0% found this document useful (0 votes)
74 views3 pages

Cosc 340

This document contains instructions and questions for an exam on Theory of Computation. Section A contains one compulsory question with parts asking students to define key terms like alphabets, strings, languages, regular expressions, context-free grammars, Turing machines, and pumping lemma. It also asks about NP-complete problems. Section B contains four optional questions, with parts asking students to explain concepts like regular expressions, grammars, Turing machines, finite automata, and Chomsky hierarchy. Students are instructed to answer the compulsory question and any two others.

Uploaded by

Nancy Juma
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)
74 views3 pages

Cosc 340

This document contains instructions and questions for an exam on Theory of Computation. Section A contains one compulsory question with parts asking students to define key terms like alphabets, strings, languages, regular expressions, context-free grammars, Turing machines, and pumping lemma. It also asks about NP-complete problems. Section B contains four optional questions, with parts asking students to explain concepts like regular expressions, grammars, Turing machines, finite automata, and Chomsky hierarchy. Students are instructed to answer the compulsory question and any two others.

Uploaded by

Nancy Juma
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/ 3

THARAKA COSC 340 UNIVERSITY

COLLEGE
(A Constituent College of Chuka University)
UNIVERSITY EXAMINATIONS

EXAMINATION FOR THE AWARD OF DEGRE OF


BACHELOR OF SCIENCE IN COMPUTER SCIENCE

COSC 340: THEORY OF COMPUTATION

STREAMS: BSC (COSC) TIME: 2 HOURS

DAY/DATE: WEDNESDAY 08/04/2020 11.30 AM – 1.30 PM

INSTRUCTIONS:

• Answer QUESTION 1 and any other TWO QUESTIONS from section B.


• This is a CLOSED BOOK EXAM, No reference materials allowed in examination room. Mobile
phones must be switched off.
• Do not write on this question paper
• Write your answers legibly and use your time wisely.
• Scientific, non-programmable Calculators may be used.

SECTION A: COMPULSORY
QUESTION 1[30MKS]

a) Explain what theory of computation deals with (2 marks)


b) Define the following terms giving an example of each
i. Alphabet(Σ) (2 marks)
ii. String over an alphabet Σ (2 marks)
iii. Empty strings(ε) (2 marks)
iv. Power of an alphabet Σ* (3 marks)
v. Language over an alphabet (L) (3 marks)
c) What is an NP Complete problem? Give an example of an NP Problem? (4 marks)
d) Write the regular expression for the language accepting all combinations of a's, over the set
∑ = {a} (4 marks)

Page 1 of 3
COSC 340

e) What is a derivation tree? Draw a derivation tree for the string "bab" from the CFG given by
S → bSb | a | b (4 marks)
f) Construct the CFG for the language having any number of a's over the set ∑= {a}. (4 marks)

SECTION B: ATTEMPT ONLY TWO QUESTIONS FROM THIS SECTION

Question 2 (20 marks)

a) What do you understand from the following terms as used in theory of computation? (6 marks)
(i) Regular expression
(ii) Context free grammar
(iii) Ambiguous grammar
b) Construct a TM machine for checking the palindrome of the string of even length. The string is
ababbabaΔ. (9 marks)
c) Using a diagram if necessary, explain the FIVE operations of Turing machine. (5 marks)

Question 3 (20 marks)

a) Give a formal definition of a Deterministic Finite Automata (DFA) (5 marks)


b) Convert the given NFA to DFA. (10 marks)

c) Explain the pumping lemma for regular and non-regular languages (5 marks)

Question 4 (20 marks)

a) Using a suitable diagram discuss Chomsky Hierarchy. (10 marks)

b) Write the regular expression for the language starting and ending with a and having any having any
combination of b's in between. (5 marks)
c) Write the regular expression for the language starting with a but not having consecutive b's.
(5 marks)

Page 2 of 3
COSC 340

Question 5 (20 marks)

a) Briefly describe the following terms as used in theory of computation. (10 marks)
(i) P Problem
(ii) Non-deterministic Finite automata
(iii) Turing machine
(iv) Push Down Automata
(v) Deterministic Finite automata
b) Draw a state diagram to show how the machine responds to the following input

(i) abbab (5 marks)

(ii) baabba (5 marks)


---------------------------------------------------------------------------------------------------------

Page 3 of 3

You might also like