100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

COS3701 EXAM PACK 2026

Rating
-
Sold
-
Pages
163
Grade
A+
Uploaded on
14-01-2026
Written in
2025/2026

Theoretical Computer Science III - COS3701 Latest exam pack questions and answers and summarized notes for exam preparation. For assistance call or W.h.a.t.s.a.p.p us on +/ 2/ 5/ 4 /7 /7 /9 /5 /4 /0 /1 /3 /2 .

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Course

Document information

Uploaded on
January 14, 2026
Number of pages
163
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS3701
EXAM PACK

, lOMoARcPSD|18222662




COS3701 Oct/Nov 2024


Question 1 [16]


a) Determine a regular expression for the language L over the alphabet {a; b} that
consists of all words that have at least one a but contain exactly one bb substring (and
no other as). Example of words in the language are bba, aaabbaaa, aaaabbaaaaaa
etc. Examples of words that are not in the language are b, a, bab, ab, aaabbbb,
abaaabaaaaa etc. (2)
b) Design a deterministic finite automaton (DFA) that will recognise all of the words in
L as defined above. (4)
c) Use Theorem 21 to develop a context-free grammar (CFG) for the language L.
(4)
d) Convert the following CFG to Chomsky Normal Form (CNF):
S -> aXY | Yb
X -> XZYZ | a
Y -> bY | Λ
Z -> a | Λ (6)

Question 2 [12]

Build a deterministic pushdown automata (DPDA) that accepts the language L =
{(ab)n(aa)m(ba)n-1 | n ≥1;m ≥1} over the alphabet ∑ = {a; b}.

Question 3 [10]

The pumping lemma with length for context-free languages (CFLs) can be stated as follows:
Let L be a CFL generated by a CFG in CNF with p live productions.
Then any word w in L with length > 2 p can be broken into five parts:
w = uvxyz
such that
length(vxy) ≤ 2p
length(x) > 0
length(v) + length(y) > 0
and such that all the words uv nxynz with n ∈{2, 3, 4,…} are also in the language L.
Use the pumping lemma with length to prove that the language

L = {(a)n(b)2n+2(a)n-1 |n ≥ 1}

over the alphabet ∑ = {a, b} is non-context-free.




2

, lOMoARcPSD|18222662




COS3701 Oct/Nov 2024


Question 4 [6]

Use the reformulated version of Theorem 42 to decide whether the grammar given below
generates any words:
S -> XY
X -> SY
Y -> SX
X -> a
Y -> b

Question 5 [6]

Consider the Turing Machine (TM) T (over the input alphabet ∑ = {a; b}) given below.




a) What is the shortest word that would be accepted by T ? (1)
b) What is accept(T )? (2)
c) What is reject(T )? (2)
d) What is loop(T )? (1)


Question 6 [14]
Build a Turing Machine (TM) that
• accepts all words in {(b)n+2an | n ≥ 1},
• loops forever on all words starting with a, and
• rejects all other words.
Assume that the alphabet is ∑ = {a; b}.




3

, lOMoARcPSD|18222662




COS3701 Oct/Nov 2024


Question 7 [12]

Build a 2PDA that accepts the language

L = {anb2na2nbn| n >0}
over the input alphabet ∑ = {a; b}

Question 8 [4]

Draw a summary table for the TM below




@unisa
2024





4

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LIBRARYpro University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
10544
Member since
2 year
Number of followers
4904
Documents
4833
Last sold
10 hours ago
LIBRARY

On this page, you find all documents, Package Deals, and Flashcards offered by seller LIBRARYpro (LIBRARY). Knowledge is Power. #You already got my attention!

3.7

1461 reviews

5
684
4
237
3
243
2
79
1
218

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions