Components are weighed during manufacture. Weights are measured to the nearest whole gram. Components that weigh at least 3 grams more than the maximum weight, or at least 3 grams less than the minimum weight, are rejected. A component is rechecked if it weighs within 2 grams of either the maximum or minimum weight. The final outcome of weighing each component is shown below: [Figure X.X] Outcome Weight Reject Max + 2 Max Max – 2 Maximum weight Accept Recheck Min + 2 Min Min – 2 Minimum weight Reject A function Status() will be called with three parameters. These are integers representing the weight of an individual component together with the minimum and maximum weights. The value returned from the function will be as follows: Outcome Return value Accept 'A' Reject 'R' Recheck 'C'
- (a)Complete the following test plan for five tests that could be performed on function Status(). The tests should address all possible outcomes. Test number Component weight Min Max Expected return value 1 'A' 2 3 4 5[5]
- (b)Write pseudocode for Status().[6]
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 2022). The mark or mark type is shown in brackets.
- [5] One mark per row Examples: Test number Component weight Min Max Expected return value 1 300 290 315 'A' 2 > 317 290 315 'R' 3 317 290 315 'C' 4 288 290 315 'C' 5 < 288 290 315 'R'
- [6] One mark per point: 1 Function heading and ending including parameters 2 Declaration of local variable for Result / alt mechanism 3 Check for Reject 4 Check for Accept 5 Check for Recheck (or just default to third option) 6 Return Result following a reasonable attempt Function Status(Actual, Min, Max : INTEGER) RETURNS CHAR DECLARE Result : CHAR CONSTANT Accept = 'A' CONSTANT Reject = 'R' CONSTANT ReCheck = 'C' Result ← ReCheck //Check if reject IF Actual > Max + 2 OR Actual < Min – 2 THEN Result ← Reject ENDIF //Check if acceptable IF Actual < Max – 2 AND Actual > Min + 2 THEN Result ← Accept ENDIF RETURN Result ENDFUNCTION
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 →