An exam paper has a maximum of 75 marks. One of five pass grades (A to E) is assigned, depending on the mark obtained. The lowest mark for a given grade is known as the grade boundary. For example, if the grade boundary for an A grade is 65 marks, then any candidate who achieves a mark of 65 or above will be awarded an A. A grade of U is awarded for marks below the E grade boundary. The five grade boundaries are stored in a global 1D array GradeBoundary of type integer. For example: Element | Value | Comment ---|---|--- GradeBoundary[1] | 65 | The minimum mark for an A grade. GradeBoundary[2] | 57 | The minimum mark for a B grade. GradeBoundary[3] | 43 | The minimum mark for a C grade. GradeBoundary[4] | 35 | The minimum mark for a D grade. GradeBoundary[5] | 27 | The minimum mark for an E grade. A global 2D array Result of type integer contains candidate marks for the exam. Each row relates to one candidate. Column 1 contains the candidate mark and column 2 contains the unique candidate ID. For example, for the fourth and fifth candidates: Element | Mark | Element | ID ---|---|---|--- Result[4, 1] | 56 | Result[4, 2] | 1074832 Result[5, 1] | 54 | Result[5, 2] | 2573839 There are more rows in the array than candidates who sit the exam. Any unused rows will be at the end of the array. Candidate papers that are given a mark within two marks of any grade boundary must be checked. For example, given the values in the example grade boundaries above, any paper that was awarded between 41 and 45 marks (inclusive) would need to be checked. A program is being written to identify papers that need to be checked. The programmer has defined the first program module as follows: Module | Description ---|--- CheckMark() | • called with a parameter of type integer representing a candidate mark | • returns TRUE if the mark is within 2 of any of the five grade boundaries, otherwise returns FALSE
- (a)Write pseudocode for module CheckMark().[6]
- (b)A second module is defined: Module | Description ---|--- CheckAll() | • called with a parameter of type integer representing the number of candidate marks in the Result array | • uses CheckMark() to check each candidate mark | • for each paper that needs to be checked, write the corresponding candidate ID on a separate line in a new file named GRList.txt | • outputs a message with a count of how many papers need to be checked Write pseudocode for module CheckAll(). CheckMark () must be used to check each individual mark.[8]
- (c)The requirement changes. Instead of a new file, the module described in part (b) needs to add the corresponding candidate ID for each paper that needs to be checked to an existing file. Explain the change that will need to be made to CheckAll().[1]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.
- [1] (a) Loop through all elements in GradeBoundary array
- [1] (a) Attempt to calculate range, both Lower and Upper, in a loop
- [1] (a) Completely correct range calculation in a loop
- [1] (a) Test if given mark / parameter, is within range in a loop
- [1] (a) Set variable / immediate RETURN if recheck required in a loop
- [1] (a) Return Boolean in both cases following a reasonable attempt
- FUNCTION CheckMark(Mark : INTEGER) RETURNS BOOLEAN
- DECLARE Index, Lower, Upper : INTEGER
- FOR Index ← 1 TO 5
- Lower ← GradeBoundary[Index] – 2
- Upper ← GradeBoundary[Index] + 2
- IF Mark >= Lower AND Mark <= Upper THEN
- RETURN TRUE
- ENDIF
- NEXT Index
- RETURN FALSE
- ENDFUNCTION
- [1] (b) Procedure heading, parameter and ending.
- [1] (b) Open file in write mode and subsequently close
- [1] (b) Loop through all CNum candidates
- [1] (b) Extract candidate mark from Result array in a loop
- [1] (b) Use of CheckMark() with candidate mark as parameter in a loop
- [1] (b) Test return value and if TRUE then increment Count in a loop
- [1] (b) write ID to file
- [1] (b) after conversion to a string in a loop
- [1] (b) Final output of message giving number of papers to check not in a loop
- PROCEDURE CheckAll(CNum : INTEGER)
- DECLARE Index, Count, ThisMark: INTEGER
- Count ← 0
- OPENFILE "GRList.txt" FOR WRITE
- FOR Index ← 1 to CNum
- ThisMark ← Result[Index, 1]
- IF CheckMark(ThisMark) = TRUE THEN
- WRITE "GRList.txt", NUM_TO_STR(Result[Index, 2])
- Count ← Count + 1
- ENDIF
- NEXT Index
- CLOSEFILE "GRList.txt"
- OUTPUT "There are ", Count, " papers to check"
- ENDPROCEDURE
- [1] (c) The file will need to be opened in APPEND mode
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 →