Refer to the insert for the list of pseudocode functions and operators. (a) An algorithm includes a number of complex calculations. A programmer is writing a program to implement the algorithm and decides to use library routines to provide part of the solution. State three possible benefits of using library routines in the development of the program.
- (a)State three possible benefits of using library routines in the development of the program.[3]
- (b)(i)The following pseudocode is part of a program that stores names and test marks for use in other parts of the program. DECLARE Name1, Name2, Name3 : STRING DECLARE Mark1, Mark2, Mark3 : INTEGER INPUT Name1 INPUT Mark1 INPUT Name2 INPUT Mark2 INPUT Name3 INPUT Mark3 The pseudocode needs to be changed to allow for data to be stored for up to 30 students. Explain why it would be good practice to use arrays to store the data.[3]
- (b)(ii)The following pseudocode statement includes array references: OUTPUT "Student ", Name[Count], " scored ", Mark[Count] State the purpose of the variable Count and give its data type. Purpose Data type[2]
- (c)The pseudocode statements in the following table may contain errors. State the error in each case or write 'NO ERROR' if the statement contains no error. Assume that any variables used are of the correct type for the given function. Statement Error IF EMPTY "" THEN Status <- IS_NUM(-23.4) X <- STR_TO_NUM("37") + 5 Y <- STR_TO_NUM("37" + "5")[4]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2022). The mark or mark type is shown in brackets.
- [1] (a) They are tried and tested so free from errors
- [1] (a) They perform a function that you may not be able to program yourself (for example encryption)
- [1] (a) They are readily available / speed up development time
- [1] (b)(i) Algorithm to process / search / organise the data is easier to implement // Values may be accessed via a loop-controlled variable / iterated through using index
- [1] (b)(i) Makes the program easier to design / code / test / understand
- [1] (b)(i) Multiple instances referenced via a single identifier / so fewer identifiers needed // Easier to amend the program when the number of students increases
- [1] (b)(ii) Purpose: It identifies / references an individual array element // provides the index to the array
- [1] (b)(ii) Data type: Integer
- [1] (c) IF EMPTY "" THEN Should be "=" not <-
- [1] (c) Status <- IS_NUM(-23.4) Parameter should be a string (or char) // should not be a real
- [1] (c) X <- STR_TO_NUM("37") + 5 NO ERROR
- [1] (c) Y <- STR_TO_NUM("37" + "5") Wrong operator – should be & or Parameter is not a string
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 →