Computer systems June 2023, Question 2 22 marks
Sundip writes an algorithm to carry out addition and subtraction. The algorithm will use an initially empty stack with the identifier numbers and will take input from the user.
The action the algorithm takes depends on the value input by the user. These actions are listed in
Complete the pseudocode here to implement Sundip’s algorithm.
Reveal mark scheme
Reveal mark scheme
Complete the following table to give the output from this algorithm when the following set of inputs are entered by the user. The letters will complete an action stated in Fig. 2
Reveal mark scheme
If the user enters 4 2 S A E, the algorithm will not work correctly.
Explain what problem this input data will cause and why the problem occurs.
Reveal mark scheme
A stack is one data structure that is available for Sundip to use. She could also use a queue, list, linked list, array or tuple.
Describe one difference between a stack and a queue.
Reveal mark scheme
Describe one difference between an array and a list.
Reveal mark scheme
State how a tuple is different to a list.
Reveal mark scheme
Describe how the second item in a linked list would be accessed using pointer values.
Reveal mark scheme