A procedure Count() will: 1. input a value (all values will be positive integers) 2. count the number of odd values and count the number of even values 3. repeat from step 1 until the value input is 99 4. output the two count values, with a suitable message. The value 99 must not be counted.
- (a)Write pseudocode for the procedure Count().[6]
- (b)The procedure Count() is to be tested. Typical test data would consist of odd and even values, for example: 23, 5, 64, 100, 2002, 1, 8, 900, 99 The purpose of this test would be to test a typical mix of even and odd values and check the totals. Give three test data sequences that may be used to test different aspects of the procedure. Do not include invalid data. Sequence 1: Test data Purpose of test. Sequence 2: Test data Purpose of test. Sequence 3: Test data Purpose of test.[3]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- [6] Mark as follows Max 6 marks:
- 1 Procedure heading and ending
- 2 Local COdd, CEven and ThisNum declared as integers
- 3 Conditional loop while ThisNum <> 99
- 4 Input ThisNum in a loop
- 5 Check ThisNum is odd or even in a loop
- 6 Increment appropriate count in a loop, both counts must have been initialised before loop
- 7 After the loop output COdd and CEven with a suitable message following a reasonable attempt at counting
- [3] One mark per set, including stated purpose. Max 3 marks
- Example answers:
- 1 data set with (only) odd values, terminated with 99
- 2 data set with (only) even values, terminated with 99
- 3 data sets with same number of odd and even values, terminated with 99
- 4 data sets with all even / all odd with just one odd/even value, terminated with 99
- 5 data sets with no values just final 99
- 6 data sets without (terminating) 99 // missing or incorrectly placed 99
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 →