100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS3701 Questions and Answers Exams Merged (Easily Searchable)

Beoordeling
5,0
(1)
Verkocht
1
Pagina's
148
Cijfer
A+
Geüpload op
09-10-2023
Geschreven 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!

Meer zien Lees minder
Instelling
Vak











Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
9 oktober 2023
Aantal pagina's
148
Geschreven in
2023/2024
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

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
€18,94
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
ExamMasteryHub
5,0
(1)

Beoordelingen van geverifieerde kopers

Alle reviews worden weergegeven
2 jaar geleden

5,0

1 beoordelingen

5
1
4
0
3
0
2
0
1
0
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
ExamMasteryHub University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
2
Lid sinds
2 jaar
Aantal volgers
1
Documenten
6
Laatst verkocht
1 jaar geleden
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!

Lees meer Lees minder
5,0

1 beoordelingen

5
1
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen