TFCS 2016 Exam
TFCS 2016 Exam
Department of Computing
EXAMINATION
Semester 2 & Trimester 3B, 2016
Exam Conditions:
For Examiner Use Only
This is a CLOSED BOOK exam - no text books or written materials permitted
Q Mark
Students are permitted to write notes during reading time in the margins of the exam
paper 1
The students exam paper can be released to students after the exam 3
none 6
7
Materials To Be Supplied To Students:
8
1 x 16 page answer book
9
Instructions To Students:
10
11
12
13
14
15
16
17
18
Total ________
Page 1 of 5
Semester 2 & Trimester 3B, 2015
COMP5001 Theoretical Foundations of Computer Science
Section 1 - Classification
1. Classify the problem into the appropriate category: Regular, Context-Free, Turing
Decidable, or Undecidable (T1-T4). (2 marks)
2. For a problem that is Regular, prove that this is the case by constructing either a
DFA, a NFA, or a Regular Expression that accepts the language of the problem.
(4 marks)
3. For a problem that is Context-Free, do both of the following:
a. Prove that the problem is not Regular using the pumping lemma, and
(5 marks)
b. Prove that the problem is Context-Free by constructing either a PDA or
CFG that accepts the language of the problem. (5 marks)
4. For a problem that is Turing Decidable do all of the following:
a. Prove that it is not Context-Free using the pumping lemma for Context-
Free grammars, and (7 marks)
b. Prove that the problem is Turing Recognizable by constructing a Turing
Machine, and (7 marks)
c. Prove that the Turing Machine constructed is a decider. (4 marks)
Alternatively, instead of a-c above you may choose to prove that a problem is
Turing Decidable by reduction to and from a known Turing Decidable
problem. (18 marks)
Also, some problems don’t lend themselves to Pumping Lemma proofs as
required for a. above. In that case you can argue why the problem is not
context free AND why a pumping lemma proof isn’t appropriate.
5. For a problem that is Undecidable, prove this using reduction from ATM.
(18 marks)
Page 1 of 5
Semester 2 & Trimester 3B, 2015
COMP5001 Theoretical Foundations of Computer Science
Problem 1:
The language of binary strings that consist of aibjck where i>k>0, j>2.
Problem 2:
After getting some strange results from a computer program, a research student realises
that the program may be having problem with a method that is supposed to categorize
an input by either membership or non-membership of a set. Every input she tries is
accepted, including ones that aren’t supposed to be. Curious, she decides to determine
whether every possible input is accepted but also has problem with this.
Your job is to create a general way of checking a method that returns true or false based
on classifying an input (for the sake of generality consider the input to be simply a binary
string and ignore what that string may represent). You test should return true if the
method always returns true, irrespective of input. If there is even a single input for which
the method would return false, your test should return false.
Problem 3:
An insurance company plans to install a dashcam with built-in GPS in customer cars in
order to make insurance claims less taxing for their legal division. Part of these devices
will monitor the car’s location, the speed limit at that location and the speed of the car.
Practically speaking, the device has a component that will receive a 1 if the car is
currently travelling over the speed limit or a 0 if travelling at the speed limit or below,
with a new bit of information sent every second. If the car accelerates abruptly enough
(e.g., has an accident) the device will record whether the driver has been detected to be
speeding for at two of the last three seconds. In this case the device should accept. If the
driver was speeding for one or less of the last three seconds, the device should reject.
Problem 4:
The Transport Authority is planning to upgrade a traffic light controlling a crossing of two
major roads so that its timing more accurately reflects accurate traffic flow. They plan to
install two devices to check on traffic flow. Device A will return true if the number of cars
passing along road A is at least two times as much as the number of cars passing along
road B. Device B will return true if the number of cars passing along road B is at least two
times as much as the number of cars passing along road A. The inputs to the devices are
pressure plates on the road, that register a 0 if cars pass along road A and a 1 if cars pass
along road B.
Page 2 of 5
Semester 2 & Trimester 3B, 2015
COMP5001 Theoretical Foundations of Computer Science
Problem 5:
A conspiracy theorist has decided that Garfield cartoons form a secret code. The idea is
that each panel in each cartoon is assigned a ‘character number’, which is the number of
main characters (Garfield, Odie, Jon, and Nermal) who are clearly visible in that panel.
The character numbers then form a string, which is then translated into binary and
hence into English.
A linguistics expert has pointed out that if such a code were to exist, certain groupings
would naturally occur more than any other. In particular, the sequence 001 would occur
roughly four times as often as 013, while the sequence 102 occurs roughly three times as
often as 013.
The problem is to write a program that checks a string of ‘character numbers’ to see if
the expected frequency is upheld.
Problem 6:
A property developer wishes to design an innovative three-sided high-rise building. As
such he asks you to develop software that searches the map of a city (he hasn’t decided
which one yet) and returns a possible location. Such a location is determined by three
streets that form a triangle. He is willing to provide the map as a graph file - when he
decides on the city.
END OF SECTION
Page 3 of 5
Semester 2 & Trimester 3B, 2015
COMP5001 Theoretical Foundations of Computer Science
Section 2 - Complexity.
Choose one of the problems in this section. For this problem, classify it as being a member of P,
NP, NP-Complete or NP-Hard and then prove this classification. When proving membership of
NP-Complete or NP-Hard by reduction, use SAT, 3-SAT or 3-COLOR as the problem to reduce to
and/or from.
Attempt only one of the questions in this section. If you attempt more than one, only the first
question attempted will be marked and any others will be ignored. (20 marks)
Problem 1:
The government is making plans for enacting martial law in the case of a serious
occurrence such as riots by theoretical mathematicians arguing over the nature of pi.
They plan to station army or police vehicles at intersections such that they have visibility
over every street in the area to be locked down. Your task is, given a street map of the
area and the number of vehicles available, to check whether there are sufficient vehicles
to have every street watched.
Problem 2:
A student is working on a final-year project involving an online gaming scenario called
‘Wumpus World’. In this scenario, an intelligent agent must explore a world (which can
be modelled as a graph with each graph node representing one location in the world and
each legal movement being an edge in the graph) to locate gold that is visible from only
one location away. The first part of the project – identifying dangers – has been
completed, and all parts of the world that are to be avoided have been removed from
the world (i.e., the graph). The next step is to write a function that plots a course for the
agent through the world. Because reducing the amount of moving that the agent needs
to do is a requirement, the agent should visit as few locations as possible. Because the
gold is visible from one location away, not all locations remaining need to be visited.
Your task is to first check the remaining graph for connectivity (in particular, find all
locations connected by a path of one or more moves to the starting point, forming what
is called a “connected sub-graph”) and then finding a path through the connected area
such that as few locations as possible are actually visited by the agent, but that every
location in the connected area is viewed.
END OF SECTION
Page 4 of 5
Semester 2 & Trimester 3B, 2015
COMP5001 Theoretical Foundations of Computer Science
If asked whether a statement is true or false, state this clearly. You should
specifically use one of these two words. If you believe that the statement is both
(perhaps with conditions) write “both true and false” or if you believe that it is
neither write “neither true nor false”.
Question 1:
An eager theoretical mathematician has an idea while struck in the head during a riot.
He creates a new machine by combining an NFA with a tape – due to the head injury he
is a little shaky on exactly how long the tape actually is, but it’s definitely finite. When he
wakes up in the morning, he contacts you to ask your opinion on what Tier of problems
can be solved by this machine.
(4 marks)
Question 2:
A researcher has proved that a problem is in both P and NP. Does this mean that P=NP?
(2 marks)
Question 3:
A computing student has developed software that uses heuristic measures and advanced
memory monitoring techniques to detect whether a program that is running is caught in
an infinite loop or not. She demonstrates the software in a presentation and shows that
it catches three types of infinite loops almost as soon as the program gets “stuck”. She
claims that this provides proof that computability theory is incorrect, although she uses
somewhat stronger and more colourful vocabulary.
Can you determine whether her claim is true of false, assuming the demonstrations were
not faked? If it is not possible to be certain, what is more likely? Explain your reasoning.
(4 marks)
END OF EXAMINATION
Page 5 of 5