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

COS2601 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Rating
-
Sold
-
Pages
55
Grade
A+
Uploaded on
27-12-2024
Written in
2024/2025

COS2601 EXAM PACK 2025 {DETAILED QUESTIONS AND ANSWERS }

Institution
Course











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

Written for

Institution
Course

Document information

Uploaded on
December 27, 2024
Number of pages
55
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

lOMoAR cPSD| 49343224




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




Question 1 [15 marks]

A recursive definition for the language ODDnotAB over
the alphabet ∑ = {a b} must be compiled where
ODDnotAB has as elements all words that are of odd
length and do not contain the ab-substring.

Give (i) an appropriate universal set,
(ii) the generator(s) of ODDnotAB, and
(iii) an appropriate function on the universal
set, and then
(iv) use these concepts to write down a
recursive definition of the language ODDnotAB.

Answer

(i) The set {a b}* will be suitable because it contains,
along with other words, all the words that are in the
language ODDnotAB.

(ii) The generators are a and b. Note that the
generator(s) is/are always the shortest word(s) in a
language.

(iii) The function CONCAT as defined in learning unit
3, will be suitable. You can see how this function
has been used in Activity 3.1 in learning unit 3.

(iv) We give two possible recursive definitions. Note
the words in ODDnotAB have an odd number of
letters. Both generators have an odd number of
letters; therefore, to keep the length of new
generated words odd, we concatenate two letters at
a time. We also need to ensure that when we
concatenate strings to form new words that we do




Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




not add a word that starts with a b to a word that
ends with an a – this would result in words that
contain an ab-substring, and these words are not in
ODDnotAB. We will also not attempt to
concatenate the ab-substring to any existing words
in ODDnotAB as these words would also not be in
ODDnotAB.

ODDnotAB is the smallest
subset of {a b}* such that a,
b ODDnotAB

and if w ODDnotAB, then also
CONCAT(bb, w), CONCAT(w, aa)
ODDNOTAB, and

if w ODDNOTAB and w does not
end on a, then CONCAT(w, ba),
CONCAT(w, bb) ODDNOTAB,

if w ODDNOTAB and w does not begin with b, then
CONCAT(aa, w), CONCAT(ba, w) ODDNOTAB.
(this mark only once)

OR

Rule 1: a, b ODDNOTAB.
Rule 2: If w ODDNOTAB then
CONCAT(bb,w), CONCAT(w,aa)
ODDNOTAB, and if w
ODDNOTAB and w does not end on a,
then CONCAT(w,ba), CONCAT(w,
bb) ODDNOTAB, if w
ODDNOTAB and w does not begin with
b, then CONCAT(aa,w),
CONCAT(ba,w) ODDNOTAB.



Downloaded by Vincent master ()

, lOMoAR cPSD| 49343224




Rule 3: Only words generated by rules 1 and 2 are in
ODDNOTAB.


Question [15 marks]
2

This question has three parts and tests mathematical
induction.

(i) Give a recursive definition of the set P of all
positive integers greater than 0,
(ii) formulate the appropriate induction principle, and
then
(iii) use mathematical induction to prove that

11 + 15 + 19 + … + (4n + 7) = 2n2 + 9n

for all positive integers n > 0.

Answer

(i)P is the smallest subset of ę such that 1 P and if k
P then also k+1 P.
Another correct recursive definition for P is:

Rule 1: 1 P
Rule 2: If k P, then also k+1 P
Rule 3: Only elements generated by the above rules are in
P.

(ii) The applicable induction principle is:

If a subset A of P is such that 1 A and if k A
then also k+1 A, then A = P.



Downloaded by Vincent master ()

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.
Jennifer2024 University of South Africa
Follow You need to be logged in order to follow users or courses
Sold
1255
Member since
2 year
Number of followers
347
Documents
1235
Last sold
1 week ago
Jennifer2024

On this page, you find all documents, package deals, and flashcards offered by seller Jennifer2024.

3.7

123 reviews

5
54
4
18
3
30
2
7
1
14

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