Algorithmics Exam Guide 2023
Algorithmics Exam Guide 2023
Year
Letter
STUDENT NUMBER
ALGORITHMICS (HESS)
Written examination
E
Day Date
L
Reading time: *.** to *.** (15 minutes)
Writing time: *.** to *.** (2 hours)
P
Section
A MNumber of
questions
Structure of book
Number of questions
to be answered
Number of
marks
S
A 20 20 20
B 10 10 80
Total 100
• Students are permitted to bring into the examination room: pens, pencils, highlighters, erasers,
sharpeners, rulers and one scientific calculator.
• Students are NOT permitted to bring into the examination room: blank sheets of paper and/or
correction fluid/tape.
Materials supplied
• Question and answer book of 29 pages
• Answer sheet for multiple-choice questions
Instructions
• Write your student number in the space provided above on this page.
• Check that your name and student number as printed on your answer sheet for multiple-choice
questions are correct, and sign your name in the space provided to verify this.
• All written responses must be in English.
At the end of the examination
• Place the answer sheet for multiple-choice questions inside the front cover of this book.
Students are NOT permitted to bring mobile phones and/or any other unauthorised electronic
devices into the examination room.
© VICTORIAN CURRICULUM AND ASSESSMENT AUTHORITY 2023
March 2023
ALGORITHMICS (SAMPLE) 2 March 2023
n
aT knc if n 1
T (n) b where a > 0, b > 1, c ≥ 0, d ≥ 0, k > 0
d if n 1
Question 1
An abstract data type (ADT) has the following partial signature specification.
Operation_1: element × Y → Y
The ADT Y could be
A. a list ADT, where Operation_1 is the ‘add’ operation.
B. an array ADT, where Operation_1 is the ‘lookup’ operation.
C. a queue ADT, where Operation_1 is the ‘dequeue’ operation.
D. a stack ADT, where Operation_1 is the ‘pop’ operation.
Question 2
Consider the following algorithm.
Algorithm numberbox(n)
a 1
b 1
For each digit in n Do
If digit is even Do
a a + b
b b + 1
If digit is odd Do
a a × b
b b – 1
Return a
What does the algorithm numberbox output when n = 2023?
A. 3
B. 11
C. 12
D. 28
SECTION A – continued
March 2023 3 ALGORITHMICS (SAMPLE)
Question 3
Which one of the following descriptions of an array is correct?
A. An array is ordered alphabetically by key.
B. An array can have an unlimited number of elements.
C. An array allows only sequential access to its elements.
D. An array allows access to each element based on the element’s index.
Question 4
At one Victorian school, a student is allowed to enrol in advanced studies in a subject if they satisfy all of the
following requirements:
• They are not studying a language outside of school.
• They are achieving high marks in the subject.
• They are not failing any other subjects.
do not write in this area
Which one of the following conditions would be suitable for testing whether a student can study an advanced
subject?
A. NOT (studying a language outside of school AND failing other subjects) AND (getting high marks in
the subject)
B. NOT (studying a language outside of school OR failing other subjects) AND (getting high marks in the
subject)
C. NOT studying a language outside of school OR NOT failing other subjects OR getting high marks in
the subject
D. NOT (studying a language outside of school OR failing other subjects) OR (getting high marks in the
subject)
Question 5
The design pattern that best describes Prim’s algorithm is
A. brute force, as Prim’s algorithm is required to check every edge in a graph.
B. brute force, as Prim’s algorithm exhaustively compares each potential spanning tree and chooses the
minimum cost spanning tree.
C. greedy, as Prim’s algorithm expands its edge set by selecting the locally optimal edge at each step.
D. divide and conquer, as Prim’s algorithm divides the graph into two sets of vertices at each step, those
connected and those not connected.
SECTION A – continued
TURN OVER
ALGORITHMICS (SAMPLE) 4 March 2023
2 4
5 3
Question 6
It is certain that Hamed’s results are incorrect because
A. the PageRanks of Node 1 and Node 2 are unchanged after the first iteration but convergence should not
happen until much later.
B. the PageRank of Node 1 is increasing, yet Node 1 has more outbound links than incoming links.
C. the PageRank algorithm needs to be amended in the presence of cycles.
D. the sum of PageRanks after the first iteration is less than 1.
Question 7
The correct PageRank for Node 3 after two iterations is
A. 0.1150
B. 0.1259
C. 0.1457
D. 0.1639
SECTION A – continued
March 2023 5 ALGORITHMICS (SAMPLE)
Question 8
Which one of the following graph algorithms repeatedly iterates over the set of all edges in its input?
A. Bellman-Ford algorithm
B. Dijkstra’s algorithm
C. Floyd’s algorithm
D. Floyd-Warshall algorithm
Question 9
Which one of the following statements is true?
A. All connected graphs are trees.
B. All trees are connected graphs.
C. All connected graphs are cyclic graphs.
D. All cyclic graphs are connected graphs.
do not write in this area
Question 10
Which one of the following recurrence relations describes the worst case for the number of comparisons
made by the quicksort algorithm on an input of n elements?
n
A. T (n) 2T O(n)
2
C. T (n) T (n 1) O(n)
D. T ( n) T ( n 2 ) O ( n)
SECTION A – continued
TURN OVER
ALGORITHMICS (SAMPLE) 6 March 2023
Question 11
Which one of the following correctly completes the algorithm above?
A. minimum(minCoins(x-1)+1, minCoins(x-3)+1, minCoins(x-4)+1)
B. minimum(minCoins(x+1)-1, minCoins(x+3)-1, minCoins(x+4)-1)
C. minimum(minCoins(x-1)-1, minCoins(x-1)-3, minCoins(x-1)-4)
D. minimum(minCoins(x-1)+1, minCoins(x-1)+3, minCoins(x-1)+4)
Question 12
Why is it infeasible to run this algorithm on large values of x?
A. This approach is greedy and would not return an optimal value when the value of x gets large.
B. Recursive algorithms will necessarily take longer to execute than iterative algorithms.
C. A very large number of repeated recursive calls would mean the algorithm is unlikely to terminate in a
reasonable amount of time.
D. The minimum function is likely to be slow, so calling it repeatedly will mean the algorithm is unlikely
to terminate in a reasonable amount of time.
Question 13
An algorithm has a double nested loop that compares each pair of items from a collection of n items.
This structure is characteristic of algorithms with a time complexity of
A. O(1)
B. O(n)
C. O(n2)
D. O(2n)
SECTION A – continued
March 2023 7 ALGORITHMICS (SAMPLE)
Question 14
Consider the recurrence relation
n
5T 2n if n 1
T (n) 2
2 if n 1
Question 15
do not write in this area
Which one of the following is a characteristic of the instruction table of a Turing machine?
A. There must be instructions for every state of the Turing machine.
B. The instructions for each state, other than the halt state, must include conditions for each possible
symbol.
C. The instructions for each state, other than the halt state, must transition the Turing machine to a different
new state.
D. The instructions cannot direct that the Turing machine write a ‘blank’ symbol.
• an associated dictionary that stores the names of the students in each class
Question 16
Which one of the following operations could not be performed in O(1) time?
A. Set the first item in the array for ‘Ms Algo’ to ‘7 English D’.
B. Determine whether a given teacher teaches at the school.
C. Determine which maths class a given student is enrolled in.
D. Determine if there is a class called ‘7 History G’ at the school.
SECTION A – continued
TURN OVER
ALGORITHMICS (SAMPLE) 8 March 2023
Question 17
Let c be the number of classes in the school and let s be the number of students in the school.
An algorithm iterates over each class to find the number of classes with 25 or more students.
The time complexity of this algorithm is
A. O(c)
B. O(s)
C. O(c + s)
D. O(c × s)
Question 18
Which of the following statements describes an aspect of Church’s and Turing’s resolutions to the
Entscheidungsproblem?
A. They defined what constituted a valid mathematical statement.
Question 19
A small multi-layer perceptron neural network is shown below.
i0
2
i1 1 a0
−1
i2
What is the activation of node a0 when the input nodes i0 , i1 and i2 are set to output 1, 0 and 0.5 respectively?
A. 1
B. 1.5
C. 2
D. 2.5
SECTION A – continued
March 2023 9 ALGORITHMICS (SAMPLE)
Question 20
The A* algorithm attempts to minimise f (n) = g(n) + h(n), where h(n) is a heuristic for the distance between
node n and the goal.
For the algorithm to always find the shortest path, the function h(n) must
A. evaluate to the true cost from n to the goal.
B. not underestimate the true cost from n to the goal.
C. overestimate the true cost from n to the goal.
D. not overestimate the true cost from n to the goal.
do not write in this area
END OF SECTION A
TURN OVER
ALGORITHMICS (SAMPLE) 10 March 2023
SECTION B
n
aT knc if n 1
T (n) b where a > 0, b > 1, c ≥ 0, d ≥ 0, k > 0
d if n 1
O ( n c ) if a bc
and its solution T (n) O(nc log n) if a bc
log b a
O(n ) if a bc
4
A B
6 5 −2 6
−2 2
C D E
−1 5 −2 6
F G
5
a. Write a definition for the graph abstract data type (ADT). 2 marks
c. Consider running Dijkstra’s algorithm, starting from node A, to find the shortest distance to all
other nodes.
i. What property of this graph would make Dijkstra’s algorithm unsuitable? 1 mark
ii. Find a node for which the distance from node A that Dijkstra’s algorithm returns is
incorrect. State the distance found by Dijkstra’s algorithm and the true shortest distance,
respectively, in your response. 2 marks
do not write in this area
SECTION B – continued
TURN OVER
ALGORITHMICS (SAMPLE) 12 March 2023
Question 2 (5 marks)
Alex is developing a computer simulation to model a chemical reaction. In the simulation, the
reactor is initially empty and the reaction starts when one or more chemicals are added. More
chemicals may be added while the reaction is in progress. A chemical reaction is characterised
by what chemicals are added, how much of them are added and when they are added.
a. To store a description of a chemical reaction for simulation, Alex needs the following
information about each addition into the reactor:
• the name of the chemical added
• the time the chemical was added, in seconds, after the reaction begins
• the amount of the chemical added, in milligrams
Describe a combination of ADTs that Alex could use to store a description of a chemical
reaction. Justify your answer. 3 marks
SECTION B – continued
March 2023 13 ALGORITHMICS (SAMPLE)
Key
normal border
do not write in this area
river border
mountain border
X
Samarth would like to write a program that determines how to win the game.
a. Describe an ADT that appropriately models a board of the HexaQuesta game. 2 marks
b. Write an algorithm, in pseudocode, that Samarth could use to efficiently find a winning path
from the start to the finish on any board. 5 marks
c. Samarth would like to find the best starting region on a given board. He decides that the best
starting region is the one with the lowest average number of moves to travel to every other
region on the board.
Describe how Samarth could efficiently find the best starting region on the board and derive a
running time for your solution. Do not provide pseudocode in your answer. 3 marks
do not write in this area
SECTION B – continued
TURN OVER
ALGORITHMICS (SAMPLE) 16 March 2023
Question 4 (3 marks)
Describe the characteristics of problems in the P time complexity class and give an example of one problem
in this class.
SECTION B – continued
March 2023 17 ALGORITHMICS (SAMPLE)
Question 5 (3 marks)
A ring graph is a graph with at least three nodes, in which a single cycle exists containing all vertices.
An example of a ring graph with five vertices is shown below.
Consider the algorithm shown below that takes one integer input n ≥ 3.
Algorithm RingGraphMaker(n):
do not write in this area
1 If n = 3 Then
2 Return a complete graph with three nodes
3 Else
4 G = RingGraphMaker(n-1)
5 Add a new node u to G
6 Randomly select an edge (p,q) in G
7 Create the edges (p,u) and (q,u) in G
8 Delete the edge (p,q)
9 Return G
10 EndIf
Demonstrate the correctness of the RingGraphMaker algorithm for n ≥ 3.
SECTION B – continued
TURN OVER
ALGORITHMICS (SAMPLE) 18 March 2023
0 1 5 27
b. Explain whether the brute-force algorithm described in part a. is feasible. Do not attempt to
derive an exact time complexity. 2 marks
An alternative approach involves installing towers one by one, exactly r kilometres further from
the lighthouse than the next house currently without mobile phone reception, until all houses are
provided with reception.
For example, if the position of the houses was given by the array [3, 8, 11, 13] and r = 2, the towers
would be installed as follows:
• The first tower would be installed 2 km further from the lighthouse than the nearest house, so it
would be installed 5 km away from the lighthouse.
• The next house without reception is 8 km away from the lighthouse, so the second tower would
be installed 10 km away from the lighthouse.
• The next house without reception is 13 km away from the lighthouse, so the third tower would
be installed 15 km away from the lighthouse.
do not write in this area
0 3 5 8 10 11 13 15
c. State the algorithm design pattern that this approach uses. 1 mark
d. Write an algorithm, in pseudocode, for the approach stated in part c. Your pseudocode should:
• take as input two parameters – the first an array named houses and the second an
integer r
• return the smallest number of towers required to provide each house along the road with
mobile phone reception. 4 marks
SECTION B – continued
TURN OVER
ALGORITHMICS (SAMPLE) 20 March 2023
Question 7 (8 marks)
A tennis club keeps information on its members in an array named members. The element at
index i of the array is the number of matches played by Member i.
For example, members = [12, 15, 9] would indicate that Member 0 has played 12 matches,
Member 1 has played 15 matches and Member 2 has played 9 matches.
The club would like to reward the member who has played the most matches and has decided to
use the following algorithm to do this.
Algorithm MaxTennis(Lower, Upper)
Begin
If Lower = Upper Then
Return Lower
Else
Midpoint = Lower + floor((Upper – Lower)/2)
b.
n
2T 1 n 1
T (n) 2
if
1 n 1
if
Assuming that the number of members of the club is a power of two and that comparison
of two integers can be done in constant time, explain why the time complexity of the club’s
algorithm can be obtained using the recurrence relation above. 3 marks
d. Compare the running time of the club’s algorithm to that of a brute-force search of the
members array for its maximum value. 2 marks
do not write in this area
SECTION B – continued
TURN OVER
ALGORITHMICS (SAMPLE) 22 March 2023
ii. State a terminating condition that could be used for this algorithm. 1 mark
iii. Describe one advantage and one limitation of using a simulated annealing algorithm to
solve the travelling salesman problem. 2 marks
SECTION B – continued
TURN OVER
ALGORITHMICS (SAMPLE) 24 March 2023
Question 9 (7 marks)
The Two Bays Shire is a rural local council responsible for the maintenance of 3000 km of local
roads. The council has asked for submissions from local businesses to maintain the roads. Each
submission states how many kilometres of road the business will maintain and how much it will
charge the council per year. More than a hundred businesses apply.
A summary of some of the submissions is shown in the table below.
⋮ ⋮ ⋮
The Chief Operating Officer of the council needs to determine which businesses should be awarded
the work so that the cost for the council is minimised.
a. Explain whether or not the problem of finding the optimal collection of businesses to maintain
the roads is tractable. 3 marks
b. Describe a greedy algorithm that will decide which businesses should be selected. State
whether or not your algorithm would return the optimal selection of businesses for the council. 4 marks
SECTION B – continued
March 2023 25 ALGORITHMICS (SAMPLE)
ii. Would a support vector machine (SVM) that selects scholarship recipients be considered
strong AI or weak AI? Justify your response. 1 mark
b. Academic merit is scored on a scale between 0 and 1. The graph below shows data from
a sample of 16 scholarship applications. Academic merit values are shown by the scale, and
the success of each scholarship application is indicated by a symbol, as shown in the key.
Key
0.6 0.7 0.8 0.9 1.0 successful
unsuccessful
academic merit
Describe for the panel of judges what an SVM is and how it could be applied to the
classification problem of determining whether a student is awarded a scholarship based on
their academic merit. 3 marks
c. Students may live in major cities, rural areas or remote areas. While it is harder for both rural
and remote students to access university education, the charity focuses on students in rural
areas only, because students in remote areas have other supports available to them. Each
student is scored on their ruralness (whether they live in a rural area) on a scale between −1
and 1, with −1 indicating that the student lives in a major city and 1 indicating that the student
lives in a remote area.
A small sample of ruralness data of past scholarship applicants is shown in the graph below.
Key
−1.0 −0.5 0.0 0.5 1.0 successful
unsuccessful
ruralness
If an SVM classifier is going to be trained on this data, explain why it would be useful to
do not write in this area
create a second dimension from the ruralness data by squaring each value, as shown in the
graph below. 2 marks
1.0
Key
successful
unsuccessful
(ruralness)2 0.5
0.0
−1.0 −0.5 0.0 0.5 1.0
ruralness
d. The charity has academic merit data and ruralness data from applications for the last 20 years,
covering over 20 000 students. A criterion of socio-economic status was only introduced in the
last five years, so data for this criterion is only available for about 1000 applications.
It has been observed in the data from the last five years that all scholarship applications were
either clearly successful or clearly unsuccessful and that there were no close decisions. In
contrast, in prior years there were often instances in which it was difficult to decide who
should be awarded a scholarship because applications were similar to each other.
Ethical decision-making is one of the charity’s values and it is important to the charity that the
process for awarding scholarships is fair, unbiased and transparent.
As an adviser to the charity, consider the options of using an SVM-based system, using a
neural-network-based system or of continuing to use a panel of human judges for selecting
scholarship recipients. Provide a recommendation to the charity as to which system for
awarding scholarships would be most suitable. To do this:
• evaluate the three options that are being considered and the possible choices of training
data
Question Answer
1 A
2 D
3 D
4 B
5 C
6 D
7 A
8 A
9 B
10 C
11 A
12 C
13 C
14 C
15 B
16 C
17 A
18 B
19 B
20 D