Computer Science · May / June 2020 · Paper 21 · Question 1
0478
As printed in the paper
The question as text
All variables, constants and other identifiers must have meaningful names.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
1(a)(i)[4]
Any meaningful array related to Task 1 – one mark (max two) e.g.
ItemCode
Description
Correct purpose for each array related to Task 1 – one mark (max two) e.g.
…to store the item codes
…to store the descriptions of the items for sale
1(a)(ii)[4]
Any meaningful variable related to Task 1 – one mark (max two) e.g.
PurchaseItem
TotalPrice
Correct purpose for each variable related to Task 1 - one mark (max two) e.g.
… to allow input of an item/code for purchase
… to store/calculate the total price of the transaction
1(b)[2]
Any one correct statement e.g.
The Code data is made up of letters/alphabetic characters/not numbersReal data must have numerical value/would not be used in calculationsOne mark for:
String1(c)[5]
Any five from
Input with message to allow choice of mobile deviceAttempt to validate input to check for valid item codeAccurate validation of input to check for valid item codeDetermination of whether device is phone or tabletRestriction to only allow input for SIM card required if mobile device is a phoneInput with message to find out if a SIM card is requiredExample answer
OUTPUT "Which type of phone or tablet would you like? Input the Item Code"
DeviceFlag ← False
WHILE DeviceFlag = False
INPUT DeviceCode
Count ← 0
WHILE Count<10 DO
IF DeviceCode = ItemCode[Count]
THEN
IF Count < 6
THEN
DeviceType ← "Phone"
ELSE
DeviceType ← "Tablet"
ENDIF
DeviceFlag ← True
Count ← 10
ENDIF
Count ← Count + 1
ENDWHILE
IF DeviceFlag = False
THEN
OUTPUT "Your code doesn’t exist, please try again"
ENDIF
ENDWHILE
IF DeviceType ← "Phone"
THEN
OUTPUT "Would you like a SIM Card? (Answer Y or N)"
INPUT SimRequired
ENDIF
1(d)[5]
Any five from
Explanation of finding if more than one device is purchasedExplanation of application of device discountExplanation of calculating the discount(s) and finding the new priceExplanation of outputting new totalExplanation of outputting amount savedExplanation of messages used
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

