0% found this document useful (0 votes)
44 views7 pages

Final

The document outlines a computer science theory final exam with 6 problems. Problem 1 involves analyzing an NFA diagram and regular expressions. Problem 2 uses the pumping lemma and context-free grammars. Problem 3 describes a Turing machine that decides a language involving binary XOR. Problem 4 involves Turing machines that decide properties of numbers and machine halting. Problem 5 proves a language is undecidable via reduction. Problem 6 discusses a self-referential enumerator language.

Uploaded by

ynkitap
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)
44 views7 pages

Final

The document outlines a computer science theory final exam with 6 problems. Problem 1 involves analyzing an NFA diagram and regular expressions. Problem 2 uses the pumping lemma and context-free grammars. Problem 3 describes a Turing machine that decides a language involving binary XOR. Problem 4 involves Turing machines that decide properties of numbers and machine halting. Problem 5 proves a language is undecidable via reduction. Problem 6 discusses a self-referential enumerator language.

Uploaded by

ynkitap
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/ 7

Computer Science Theory Final Exam

COMS W3261, Summer B 2021

This exam will be available from 12:01 AM EST on Tuesday, 8/10/2021 until Wednesday,
8/11/2021, at 11:59PM EST. You have 12 hours to complete this exam from the time you down-
load it; you can use any 12 hours in the 48-hour window to work on the exam. The exam is due
Wednesday, 8/11/2021, at 11:59PM EST with NO EXTENSIONS. Submit to GradeScope
(course code: X3JEX4).
Grading policy reminder: LATEX is preferred, but neatly typed or handwritten solutions are
acceptable. Your TAs may dock points for indecipherable writing. Proofs should be complete; that
is, include enough information that a reader can clearly tell that the argument is rigorous.
If a question is ambiguous, please state your assumptions. This way, we can give you credit for
correct work. (Even better, post on Ed so that we can resolve the ambiguity.)
You can consult the following resources during the exam:

1. Your notes and class notes posted on the course webpage.

2. Lecture recordings on YouTube and in-class recordings in the Zoom recordings folder on
CourseWorks.

3. Past homework problems, your homework answers, and solutions posted on the course web-
page.

4. The textbook.

5. Past questions posted on Ed. (You may post on Ed during the exam, but please do not
answer other student’s questions or provide any details that might help others solve a problem.
Answers from instructors will be limited to basic typo correction and clarifications only.)

6. Resources for LATEX formatting that are unrelated to the course material.

Any resources not listed here, including all reference sources beyond the textbook, are not permitted.

1
1 Problem 1 (10 points)
For this problem, consider the NFA state diagram pictured below.
0

q2 q3 q4
0 1


q0 q1 


b
 q5 q6

1. (3 points.) Does this NFA accept the empty string ε? What about the string 00101? What
about the string ba0011?

2. (2 points.) In class, we showed that the class of regular languages was closed under Kleene star
(∗ ) by demonstrating that, given an NFA N that recognizes any language A, we can convert
N into a new NFA N 0 that recognizes A∗ . The NFA pictured above was created by this
conversion process. Which transition(s) or state(s) may have been added during conversion?

3. (5 points.) Write a regular expression that evaluates to the same language that the NFA
recognizes. Explain in a few sentences why the expression and the NFA represent the same
language. (Hint: begin by reverse-engineering the conversion process for ∗ .)

2
2 Problem 2 (14 points)
For this problem, consider the language

L1 = {0i 1i+j 0j | i, j ≥ 0}.

1. (7 points.) Use the pumping lemma for regular languages to prove that L is nonregular.

2. (7 points.) Prove that L is context-free by creating a context-free grammar that generates L.


Explain in a few sentences why your CFG generates exactly the strings in L.

3
3 Problem 3 (8 points)
Recall that the XOR operator ⊕ evaluates to 1 if exactly one of its inputs is 1: thus 0 ⊕ 0 = 0,
0 ⊕ 1 = 1, 1 ⊕ 0 = 1, 1 ⊕ 1 = 0. Given two binary strings w, v ∈ {0, 1}∗ that have the same length,
the binary XOR of w and v, written w ⊕ v, is the string x such that wi ⊕ vi = xi for all i. For
example,
01001 ⊕ 11000 = 10001.
Consider the language

L2 = {a#b#c | a, b, c ∈ {0, 1}∗ and a ⊕ b = c}.

1. (8 points.) Prove that L2 is decidable by writing an implementation-level description of a


Turing machine that decides L2 . (Don’t forget to check that your input is correctly formatted.)

4
4 Problem 4 (8 points)
1. (4 points.) Prove that the language

L3 = {a | a is a prime number that is also the sum of two square numbers}

is decidable by writing a high-level description of a Turing machine that decides L3 .

2. (4 points.) Prove that the language

L4 = {hAi | A is a Turing machine that halts on any input string w ∈ Σ∗ }

is recognizable by writing a high-level description of a Turing machine that recognizes L4 .

5
5 Problem 5 (10 points)
1. Prove that the language

L5 = {hA, Bi | A and B are Turing machines and L(A) ⊆ L(B)}

is undecidable by reducing another undecidable language to L5 . You may not use Rice’s
theorem. (Hint: it suffices to show that if you could build a decider for L5 , you could build a
decider for a language that is proved undecidable in lecture, in homework or in the textbook.)

6
6 Problem 6 (3 extra credit points)
1. (3 points). Consider the following language:

SELFEN U M = {hEi | E is an enumerator that never prints out its own description hEi}.

Recall that a language is Turing-recognizable if and only if some enumerator enumerates it.
Show that SELFEN U M is not Turing-recognizable by finding a paradox.

You might also like