Computer Science · May / June 2016 · Paper 22 · Question 1
2210
As printed in the paper
Show the answer and mark scheme
1(a)(i)[3]
Many correct answers, they must be meaningful. This is an example only. – NumSacks, integer, number of sacks – SacksAccepted, integer, number of sacks accepted – TotalWeight, real, total weight of all sacks [3]
1(a)(ii)[3]
Any three from – TopWeight, 50.1 – BottomWeight 49.9 – TopWeightCement 25.1 – BottomWeightCement 24.9 [3]
1(b)[5]
Any five from:
– initialise total weight of order – input number of sacks for each type outside loop(s) – loop for order completion – input weight inside loop(s) – add weight of accepted sack to total weight – output total weight outside all loop(s) – appropriate prompts for input number of sacks for each type and input weight [5]
Max 5 marks Sample Answer 1 INPUT 'Number of sand sacks ordered ' num_sand_ordered INPUT 'Number of cement sacks ordered ' num_cement_ordered INPUT 'Number of gravel sacks ordered ' num_gravel_ordered total_weight ← 0 FOR Counter ← 1 TO num_sand_ordered INPUT 'weight of sack of sand ' sack_weight total_weight ← total_weight + sack_weight NEXT Counter FOR Counter ← 1 TO num_cement_ordered INPUT 'weight of sack of cement ' sack_weight total_weight ← total_weight + sack_weight NEXT Counter FOR Counter ← 1 TO num_gravel_ordered INPUT 'weight of sack of gravel' sack_weight total_weight ← total_weight + sack_weight NEXT Counter Print 'Total weight of sacks is ' total_weight Sample Answer 2 INPUT 'Number of sand sacks ordered ' num_sand_ordered INPUT 'Number of cement sacks ordered ' num_cement_ordered INPUT 'Number of gravel sacks ordered ' num_gravel_ordered total_sacks_ordered ← num_sand_ordered + num_cement_ordered + num_gravel_ordered total_weight ← 0 FOR Counter ← 1 TO total_sacks_ordered INPUT 'weight of sack ' sack_weight total_weight ← total_weight + sack_weight NEXT Counter Print 'Total weight of sacks is ' total_weight
1(c)(i)[2]
1 mark for value reason, all values and reasons must be different. There are many possible correct answers these are examples only. Data value 49.95 Reason – normal data sand should be accepted Data value 50.1 Reason – boundary data sand should be rejected [2]
1(c)(ii)[2]
Data value 25 Reason – normal data cement should be accepted Data value 26.7 Reason – abnormal data cement that should be rejected [2]
1(d)[5]
Maximum 5 marks in total, maximum 3 marks if only programming statements used Description (may include reference to program statements) – use of prices for calculation of regular price either numbers, variables or constants (sand and gravel 2, cement 3) – description of calculation of regular price, multiply no of sand sacks by 2, multiply no of gravel sacks by 2, multiply no of cement sacks by 3 – output of regular price – description of calculating the number of special packs using the pack information (2 sacks of sand, 2 sacks of gravel and 1 sack of cement) – …….repeat until there are no more packs in the order (less than 2 sacks of sand or less than 2 sacks of gravel or no sacks of cement – calculation of discount price and/or amount saved – output discount price and/or amount saved [5]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

