Skip to main content
O-LevelComputer ScienceProgramming2210/22 · May/June 2015 · Q120 Marks

You are advised to spend no longer than 40 minutes answering this section. Here is a copy of the pre-release material. DO NOT attempt Tasks 1, 2 and 3 now. Use the pre-release material and your experience from attempting the tasks before the examination to answer Question 1. Pre-release Material Write and test a program to complete the three tasks. TASK 1 A school keeps records of the weights of each pupil. The weight, in kilograms, of each pupil is recorded on the first day of term. Input and store the weights and names recorded for a class of 30 pupils. You must store the weights in a one-dimensional array and the names in another one-dimensional array. All the weights must be validated on entry and any invalid weights rejected. You must decide your own validation rules. You may assume that the pupils' names are unique. Output the names and weights of the pupils in the class. TASK 2 The weight, in kilograms, of each pupil is recorded again on the last day of term. Calculate and store the difference in weight for each pupil. TASK 3 For those pupils who have a difference in weight of more than 2.5 kilograms, output, with a suitable message, the pupil's name, the difference in weight and whether this is a rise or a fall. Your program must include appropriate prompts for the entry of data. Error messages and other outputs need to be set out clearly and understandably. All variables, constants and other identifiers must have meaningful names. Each task must be fully tested.

  1. (a)(i)Declare the array to store the pupils' names.[1]
  2. (a)(ii)Declare the array to store the pupils' weights.[1]
  3. (a)(iii)It has been decided to record the weights for the whole school of 600 pupils rather than one class. Write suitable new declarations for these two arrays.[1]
  4. (b)Write an algorithm to complete Task 2, using either pseudocode, programming statements or a flowchart. Use weights for the whole school. You should assume that Task 1 has already been completed.[5]
  5. (c)(i)Describe suitable validation rules for Task 1.[2]
  6. (c)(ii)Give two pupil weights that you could use to check the validation used in Task 1. Explain why you chose each weight. Weight 1 Reason for choice Weight 2 Reason for choice[4]
  7. (d)Explain how you select the pupils with a fall in weight of more than 2.5 kilograms (part of Task 3). You may include pseudocode or programming statements as part of your explanation.[6]

Mark scheme

Marking points from the official mark scheme (May/June 2015). The mark or mark type is shown in brackets.

  1. [1] (i) Many correct answers, they must be meaningful. This is an example only. PupilName[1:30] or PupilName[0:29] or PupilName [30] or PupilName[29] or PupilName[]
  2. [1] (ii) Many correct answers, they must be meaningful. This is an example only. StartWeight[1:30] or StartWeight[0:29] or StartWeight[30] or StartWeight[29] or StartWeight[]
  3. [1] (iii) Answers, must match (i) and (ii) above and the upper bound should have been changed from 30 to 600 or 29 to 599 or no change if not used. StartWeight[1:600] or StartWeight[600] PupilName [1:600] or PupilName [600]
  4. [5] (b) any four from prompt for entry of final weight that includes pupil's name input final weight validation check for final weight calculation of difference in weight ......using the initial weight stored in the array store difference in weight (Max 4 marks) - loop for 600 pupils (1 mark) sample algorithm: FOR Count ← 1 TO 600 REPEAT PRINT 'Please enter weight for ', PupilName [Count] INPUT FinalWeight UNTIL FinalWeight < 120 AND FinalWeight > 20 WeightDifference[Count] ← FinalWeight - StartWeight [Count] NEXT Count
  5. [2] (c) (i) any two from check that the weights are within a given range check that the weights are numeric check that the weights are given to one decimal point character/type check on name length check on name
  6. [4] (ii) 1 mark for the data and 1 mark for the matching reason. There are many possible correct answers this is an example only. Weight 1 35.2 Reason normal data that should be accepted Weight 2 twenty Reason abnormal data that should be rejected
  7. [6] (d) Maximum 6 marks in total for question part Explanation (max 6) loop 30 or 600 times to check each difference in weight check for a difference in weight less than -2.5 (final weight – start weight) or greater than 2.5 (start weight – final weight) ... If so output pupil's name ...if so output difference in weight - ...if so output message that it is a fall in weight Sample algorithm (max 4) FOR Count ← 1 TO 30 IF WeightDifference [Count] < -2.5 THEN PRINT PupilName[Count], 'The weight loss was ', WeightDifference [Count] ENDIF NEXT Count If pseudocode or programming only and no explanation, then maximum 4 marks

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 →

About this question

Topic
Programming, O-Level Computer Science (syllabus 2210). Structured question, 20 marks.
Source
O-Level Computer Science, May/June 2015 Paper 2 Variant 2, question 1.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep