Data is a 1D array of integers, containing 30 elements. All element values are unique.
- (a)An algorithm will output the index of the element with the smallest value. Draw a program flowchart to represent the algorithm. [Figure showing START and END boxes for flowchart][5]
- (b)The 30 data values could have been stored in separate variables rather than in an array. Explain the benefits of using an array when designing a solution to part (a).[2]
- (c)The requirement changes. Array Data needs to hold 120 elements and each value may include a decimal place. Write a pseudocode statement to declare the modified array.[2]
This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- 5 (a) MP1 Initialise Min to first value in Data and MinIndex to 1
- 5 (a) MP2 Loop through 29 more values (or 30 values in total)
- 5 (a) MP3 Compare element from Data [] with Min
- 5 (a) MP4 Set new Min AND save MinIndex when element value < Min in a loop
- 5 (a) MP5 Output MinIndex
- 2 (b) MP1 Simplifies the algorithm // easier to write / understand / test / debug
- 2 (b) MP2 It is possible to iterate through the values // can use a loop // allows the storage of many values using a single identifier
- 2 (c) One mark per underlined section
- 2 (c) DECLARE Data : ARRAY[1:120] OF REAL
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →