1A Answer
Any two from:
● Quantity of milk
● Quantity of cream
● Type of milk/cream
● Quantity/type of sugar
● Type of ice cream [sorbet, gelato, gluten free, sugar]
● Flavour
More help here -
● Quantity of milk
● Quantity of cream
● Type of milk/cream
● Quantity/type of sugar
● Type of ice cream [sorbet, gelato, gluten free, sugar]
● Flavour
More help here -
1B answer
● Real/float/double
● Integer
More help here -
● Integer
More help here -
1C answer
Any one from:
● (n hours * 60 min per hour) – 20 min
● Division by (10 + 5 + 30 + 5 + 15)
Any one from:
● FLOOR, INTEGER, ROUNDDOWN only if used as part of an expression as per the first or second example
● DIV only if used in the correct location in an expression as per the third example
only if used as part of an expression as per the fourth example
Examples:
● Batches = ROUNDDOWN (((n * 60) – 20) / 65)
● INT ((n * 60) – 20 / (10 + 5 + 30 + 5 + 15))
● Batches = ((n * 60) – 20) DIV 65
(n×60)−20
----------------------
10+5+30+5+15
More help here -
● (n hours * 60 min per hour) – 20 min
● Division by (10 + 5 + 30 + 5 + 15)
Any one from:
● FLOOR, INTEGER, ROUNDDOWN only if used as part of an expression as per the first or second example
● DIV only if used in the correct location in an expression as per the third example
only if used as part of an expression as per the fourth example
Examples:
● Batches = ROUNDDOWN (((n * 60) – 20) / 65)
● INT ((n * 60) – 20 / (10 + 5 + 30 + 5 + 15))
● Batches = ((n * 60) – 20) DIV 65
(n×60)−20
----------------------
10+5+30+5+15
More help here -
2a answer
● Sell-by date/sell-by date and today’s date (1)
● Yes, reorder this type of cookie/No, do not reorder cookies (1)
● Do calculation 10 – number of packs in stock (1)
More help here -
● Yes, reorder this type of cookie/No, do not reorder cookies (1)
● Do calculation 10 – number of packs in stock (1)
More help here -
2b answer
● [11]
● [21]
First character index: 11 (1)
Last character index: 21 (1)
Correct use of square brackets on both (1)
More help here -
● [21]
First character index: 11 (1)
Last character index: 21 (1)
Correct use of square brackets on both (1)
More help here -
2ci answer
WHILE (True) (1)
More help here -
More help here -
2cii answer
Any one from:
● Crashing it / breaking it / interrupting it from the console / killing the process (1)
● Ctrl-Z / Ctrl-C / Ctrl-break / break key / using the task manager to stop it (1)
More help here -
● Crashing it / breaking it / interrupting it from the console / killing the process (1)
● Ctrl-Z / Ctrl-C / Ctrl-break / break key / using the task manager to stop it (1)
More help here -
3a answer
● Do not open (1)
● 12:00 to 18:30 (1)
● 13:00 to 18:00 (1)
More help here -
● 12:00 to 18:30 (1)
● 13:00 to 18:00 (1)
More help here -
4A answer
● This pseudo-code is not suitable for humans to read and understand / running all the individual instructions together on a single line makes this pseudo-code difficult for humans to read but algorithm is short and understandable in this form
● Use of English command words makes it easier to understand for humans
● To make this pseudo-code easier for humans to read and understand:
o the variable name ‘w’ could be changed to something more meaningful, such as ‘week’
o comments could be used to explain what the code is doing / using # or // for comments
o each instruction could be placed on a new line
o indentation could be used to show the blocking of the constructs / ending words could show blocking of the code
o additional white space / lines could be used to show blocks of code
More help here -
● Use of English command words makes it easier to understand for humans
● To make this pseudo-code easier for humans to read and understand:
o the variable name ‘w’ could be changed to something more meaningful, such as ‘week’
o comments could be used to explain what the code is doing / using # or // for comments
o each instruction could be placed on a new line
o indentation could be used to show the blocking of the constructs / ending words could show blocking of the code
o additional white space / lines could be used to show blocks of code
More help here -
4bii answer
To identify the minimum/lowest number and the maximum/highest number (1)
More help here -
More help here -
5a answer
An explanation that makes reference to the following point:
● This is a runtime error (1)
Plus one from:
● Because it occurs when the computer tries to execute the code (1)
● Because the (translated) code cannot be executed (1)
● Because it crashes/stops (1) (the computer when attempting to execute)
● Occur intermittently, depending on the data that is encountered (1)
● Can be caused when a user inputs data of the wrong type (1)
More help here -
● This is a runtime error (1)
Plus one from:
● Because it occurs when the computer tries to execute the code (1)
● Because the (translated) code cannot be executed (1)
● Because it crashes/stops (1) (the computer when attempting to execute)
● Occur intermittently, depending on the data that is encountered (1)
● Can be caused when a user inputs data of the wrong type (1)
More help here -
5b answer
Line 6
● Error: Only one short side is needed/two added to width (1)
● Correction: SET totalWidth TO width (1)
Line 8
● Error: Lengths of the sides are multiplied (1)
● Correction: SET total TO totalWidth + totalLength (1)
More help here -
● Error: Only one short side is needed/two added to width (1)
● Correction: SET totalWidth TO width (1)
Line 8
● Error: Lengths of the sides are multiplied (1)
● Correction: SET total TO totalWidth + totalLength (1)
More help here -
6a answer
● The constants TAX and PROFIT cannot be changed by accident or error (1) so code that uses them should be more robust (1) than using the numbers instead.
● The constants TAX and PROFIT use meaningful names (1) instead of numbers, which make their purpose more clear (1) when used in the code.
● If the value of a constant, such as VAT, does have to be altered (1) only one change is required. (1)
More help here -
● The constants TAX and PROFIT use meaningful names (1) instead of numbers, which make their purpose more clear (1) when used in the code.
● If the value of a constant, such as VAT, does have to be altered (1) only one change is required. (1)
More help here -
6bi answer
● Subprogram identified as PROCEDURE on 3 lines;
o Line 8: PROCEDURE calcProfitAndTax (…, …, …)
o Line 9: PROCEDURE
o Line 26: PROCEDURE
● Input parameters use local variable names
o Line 8: calcProfitAndTax (inProd, inProfit, inTax)
● Calling subprogram by name
o Line 36: calcProfitAndTax (…)
● Three parameters with names matching main code
o Line 36: calcProfitAndTax (costProd, reqProfit, rateTax)
● Order of parameters in call match order of parameters in definition
Both lines in the correct order for 1 mark
o Line 8: (inProd, inProfit, inTax)
o Line 36: (costProd, reqProfit, rateTax)
More help here -
o Line 8: PROCEDURE calcProfitAndTax (…, …, …)
o Line 9: PROCEDURE
o Line 26: PROCEDURE
● Input parameters use local variable names
o Line 8: calcProfitAndTax (inProd, inProfit, inTax)
● Calling subprogram by name
o Line 36: calcProfitAndTax (…)
● Three parameters with names matching main code
o Line 36: calcProfitAndTax (costProd, reqProfit, rateTax)
● Order of parameters in call match order of parameters in definition
Both lines in the correct order for 1 mark
o Line 8: (inProd, inProfit, inTax)
o Line 36: (costProd, reqProfit, rateTax)
More help here -
6bii answer
● Message on line 21 is a local variable / has local scope (1) because it is declared inside the subprogram (1) on line 10.
More help here -
More help here -
7b answer
Type (one from):
● Count controlled loop (1)
● For loop (1)
Justification (one from):
● The number of loop passes is known in advance (1)
● The loop executes for a known number of times (1)
● The loop executes for exactly the number of members (1)
More help here -
● Count controlled loop (1)
● For loop (1)
Justification (one from):
● The number of loop passes is known in advance (1)
● The loop executes for a known number of times (1)
● The loop executes for exactly the number of members (1)
More help here -
7c answer
● Nested ifs / if else / if elseif (1) should be used so that the tests stop executing (1) as soon as a true one is encountered (1).
More help here -
More help here -
9a answer
Pseudo-code example:
SET freezers TO [-20, -19, -18, -17, -16, 0, 1]
SET index TO 0
WHILE (index < length (freezers)) DO
SET temperature TO freezers [index]
IF ((temperature < -19) OR (temperature > -17)) THEN
SEND ("Freezer" & index & " is out of tolerance: " & temperature)
END IF
SET index TO index + 1
END WHILE
More help here -
SET freezers TO [-20, -19, -18, -17, -16, 0, 1]
SET index TO 0
WHILE (index < length (freezers)) DO
SET temperature TO freezers [index]
IF ((temperature < -19) OR (temperature > -17)) THEN
SEND ("Freezer" & index & " is out of tolerance: " & temperature)
END IF
SET index TO index + 1
END WHILE
More help here -
Pseudo-code example:
SET freezers TO [-20, -19, -18, -17, -16, 0, 1]
SET reqTemp TO -18
SET index TO 0
FOR EACH temp FROM freezers DO
IF (temp > reqTemp + 1) OR (temp < reqTemp – 1) THEN
SEND ‘Freezer ‘ & index & ‘ is out of tolerance: ‘ & temp
END IF
SET index TO index + 1
END FOR EACH