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

COS3701 Questions and Answers Exams Merged (Easily Searchable)

Rating
5.0
(1)
Sold
1
Pages
148
Grade
A+
Uploaded on
09-10-2023
Written in
2023/2024

Hello, I'm excited to share a valuable resource for your COS3701 exam preparation - a merged and easily searchable PDF of Questions and Answers. This tool is especially useful if your exam allows open-book format, as it enables you to quickly navigate and find the information you need. I personally utilized this guide during my own exam and achieved a remarkable 70% score. I highly recommend you consider purchasing it for your review. It's a great investment in your exam success and can significantly ease the stress of preparation. Good luck with your studies, and feel free to reach out if you have any questions!

Show more Read less
Institution
Course











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

Written for

Institution
Course

Document information

Uploaded on
October 9, 2023
Number of pages
148
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS3701 exam - Jan 2001
Question 1
(a) Find a CFG for the language consisting of words of odd length over
the alphabet ∑={a,b} that start and end with different letters.

(b) Convert the following CFG to Chomsky Normal Form (CNF):
S 🡪 AA
A 🡪 B | BB
B 🡪 abB | b | bb

Question 2
Draw a deterministic PDA that accepts the language
L = { (ba) (ab) | n 0 } over the alphabet ∑={a,b}

Question 3
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(w) > 2 can be broken into 5 parts:
w = uvxyz
such that
length(vxy) ≤ 2
length(x) > 0
length(v) + length(y) > 0
and such that all words uvⁿxyⁿz with n {2,3,4,…} are also in the
language L.

Use the pumping lemma with length to prove that the language
L = { a b a b | n, m = 1, 2, 3...}
over the alphabet ∑={a,b} is NOT context-free.

Question 4
Give an informal justification by means of grammars to show that the
context-free languages are closed under product.

Question 5
Draw a TM that accepts all words ending in aaa, crashes on all words
ending in baa, and loops on all other words over the alphabet Σ = {a,
b}.

Question 6
Consider the non-context-free language L over the alphabet Σ = {a, b},
which is defined as
L = { a b a | n = 1, 2, 3...}

(i) Explain in words how you would build a 2PDA that accepts the
language L. Do NOT draw a machine.

,(ii) Can you build a 3PDA that accepts L? Justify your answer without
attempting to give a 3PDA or an algorithm.

(iii) Can you build a TM that accepts L? Justify your answer without
attempting to give a TM or an algorithm.

(iv) Can you build a PDA that accepts L? Justify your answer without
attempting to give a PDA or an algorithm.

Question 7
What are Accept(T), Loop(T), and Reject(T) of the following TM T?




Question 8
a) When is a language regular? Give your answer in terms of
machines.
b) When is a language context-free? Give your answer in terms of
machines.
c) When is a language recursively-enumerable? Give your answer in
terms of TMs.
d) When is a language recursive? Give your answer in terms of TMs.
e) Explain the idea of the encoding of a TM.

Question 9
(a) What does it mean for a function to be computable?

(b) Prove that the predecessor function defined by
PREDECESSOR(N) = n - 1 for all n ≥ 1
is computable. Use unary encoding.

, Solutions
Question 1a




Assuming that the FA is correct, Cohen’s Theorem 21 can be applied,
which results in the following CFG:

S 🡪 aX | bP
X 🡪 aY | bY
Y 🡪 aX | bZ
Z 🡪 aY | bY | /\
P 🡪 aQ | bQ
Q 🡪 aR | bP
R 🡪 aQ | bQ | /\

Question 1b
Step 1 - Kill all /\ productions:

There are no /\ productions, so none of the non-terminals is nullable.
The CFG remains unchanged.

Step 2 - Kill all unit productions:

The only unit production is A 🡪 B, where the B can be replaced with
all B’s non-unit productions (i.e. all of them).

The new CFG, without unit productions, is:

S 🡪 AA
A 🡪 BB | abB | b | bb
B 🡪 abB | b | bb

Step 3 - Replace all mixed strings with solid nonterminals.

, Create extra productions that produce one terminal, when doing the
replacement.

The new CFG, with a RHS consisting of only solid nonterminals or one
terminal is:

S 🡪 AA
A 🡪 BB | XYB | b | YY
B 🡪 XYB | b | YY
X 🡪 a
Y 🡪 b

Step 4 - Shorten the strings of nonterminals to length 2.

Create new, intermediate nonterminals to accomplish this.

The new CFG, in CNF is:

S 🡪 AA
A 🡪 BB | RB | b | YY
B 🡪 RB | b | YY
R 🡪 XY
X 🡪 a
Y 🡪 b

Question 2
$22.71
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
ExamMasteryHub
5.0
(1)

Reviews from verified buyers

Showing all reviews
2 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
ExamMasteryHub University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
2
Member since
2 year
Number of followers
1
Documents
6
Last sold
1 year ago
Exam Mastery Hub

Welcome to Exam Mastery Hub, your premier source for top-notch exam materials tailored for your academic journey. Here, we specialize in offering high-quality exam papers to aid your preparation for crucial degree examinations. Utilize our resources, meticulously designed to enhance your learning efficiency and propel you towards success. At Exam Mastery Hub, our collection of papers is carefully curated by a dedicated team of students from UNISA and myself, ensuring the highest quality and relevance. We are confident in our materials, with a proven track record of helping students achieve scores of 70% and above. Many have leveraged our answers as a foundation, achieving excellent results by effectively expanding and adapting the provided insights to their specific needs. Join the community of successful learners at Exam Mastery Hub and elevate your academic performance today!

Read more Read less
5.0

1 reviews

5
1
4
0
3
0
2
0
1
0

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