Refer to the insert for the list of pseudocode functions and operators. A program uses many complex algorithms. One algorithm is repeated in several places. The code for the algorithm is the same wherever it is used, but the calculations within the algorithm may operate on different data. The result of each calculation is used by the code that follows it. It is decided to modify the program and implement the algorithm as a separate module.
- (a)(i)State two benefits of this modification to the existing program.[2]
- (a)(ii)Describe how the modification would be implemented.[3]
- (b)Four of the expressions used in the program are represented by pseudocode in the table. Complete each pseudocode expression with a function or operator so that it evaluates to the value shown. Any functions and operators used must be defined in the insert. Pseudocode expression | Evaluates to ---|--- ...("Random", 2, 3) | "and" 5 + ...(10/11/2023) | 15 ...("45000") | TRUE (20 ... 3) + 1 | 3[4]
Mark scheme
Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.
- [1] (a)(i) The code can be called when needed
- [1] (a)(i) Any subsequent change to the algorithm / calculation needs to be made once only // Easier to manage / maintain (the program)
- [1] (a)(i) Less code / no code duplication
- [1] (a)(i) The algorithm / code / calculation can be designed / coded / tested once
- [1] (a)(ii) Create a module / function / procedure / subroutine using the (old) code / algorithm
- [1] (a)(ii) Replace the old code / algorithm wherever it appears with a call to the module / function / procedure / subroutine
- [1] (a)(ii) Pass the data as parameter(s) // Use of global variable(s)
- [1] (a)(ii) Return the result (of the calculation) // Assign result to global variable(s) / BYREF parameter(s)
- [1] (a)(ii) Create local variables as needed (to perform the calculation)
- [1] (b) MID ("Random", 2, 3) // Evaluates to "and"
- [1] (b) 5 + DAY (10/11/2023) // Evaluates to 15
- [1] (b) IS_NUM("45000") // Evaluates to TRUE
- [1] (b) (20 MOD 3) + 1 // Evaluates to 3
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 →