Chap 8 Marking Scheme
Chap 8 Marking Scheme
&+$37(5
0$5.,1*
6&+(0(
3$*(
3$*(
1(a)(i) Many correct answers, the name must be meaningful. Must relate to Task 1 3
1 mark per bullet point
e.g.1
Array BusA
Data type integer
Purpose storing the minutes late
e.g.2
Array Day
Data type string
Purpose storing the code for the day of the week
1(a)(ii) Many correct answers, the name must be meaningful. Names shown are 6
examples only.
1 mark per bullet point
Taskk 3 va variable
ariab e name
ble SearchDay
Data
D ata
at a type
t y pe
ty string
stri
st r ng
g
Purpose
P urpo
ur pose
po to iinput
n utt tthe
np day
he d ay tto
o be ssearched
ea
arc
rch
hed
d fo
for
1(b) 1 mark
mar
arkk for
for each
e ch point::
ea 6
MP1
MP1 Conditiona
n l statement to identify when a bus is late (punctuality
na
Conditional
< 0)
MP
MP2P2 Count the e number of late days for at least one bus route
MP3 e late minutes for at least one bus route
Total the
MP4 Calculation
Calculatioon of average minutes late
Three from:
MP1 The input stored as a variable
MP2 The method used to find the position of the day in the Day
array that matches the input
MP3 The array index is stored as a variable
MP4 The index variable used as the array index for each bus array
MP5 «and the contents of each array stored/output.
2 Many possible
possibl
ble
bl e answers,
an
a nswerrs, those given are examples only. 6
1 mark
rk for
for
o each
eac
a h correct
correcct description
desc
scri
sc rip
ptio
on and
a d 1 mark
an m rk
ma r for
for each
eac
ach
ac h correct
co
orr
rre
ectt example
exxam
ample
e
Cha
Ch ar
ar
Char
D
De s ri
sc ript
ptio
pt ion:
io
Description: n: A single ccharacter
haracter (from the keyboard)
Ex
xampl
am
mplple:
Example: e
e: A/#/2
Stri
St ring
ri
Stringng
g
D escription: An (ordered)
Description: (orde
ered) sequence of characters
Example: world
orld / #123?Y / 234 78963
Hello wo
or
Boolean
Description: A data type
p with two possible values
Example: TRUE / FALSE
Example answer:
IF X < 0
THEN
PRINT "Negative"
ELSE
PRINT "Not negative"
ENDIF
OR
Example answer:
CASE X OF
1: PRINT ("ONE")
("
"ON
O E")
2: PRINT
PRINNT ("TWO")
("
"TWWO")
OTHERWISE
OTHER
ERWI
ER WI SE PRINT
ISE PRIINT ("Less
("L
"Leess than
t an
th an ONE
E or
ONE or more
mo than
n TWO")
than TWO
TW O")
)
ENDCASE
ENDC
EN DC
D CAS
A E
3(b) T
Too al
a low diffe
allow erent routes through a program
different 2
d ep
pendent on
dependent n meeting certain criteria
Section A
Sample answer
REPEAT
PRINT "Enter Buyer Number"
INPUT BuyerNumber
UNTIL BuyerNumber >= BuyerLow and BuyerNumber <=
BuyerHigh
REPEAT
PRINT "Enter Bid B d -99 to exit"
Bi
INPUT Bid
IF Bid > HighestBid(item)
High
ghe
gh estBid(item)
THEN
Hig
ighe
ighe tBid(item) ĸ Bid
h st
HighestBid(item)
Num
umberBBids(s(
(it
item)
NumberBids(item) ) ĸ NumberBids(item)
Num
u beerB
rBid
i s(
(it
i em
em)) + 1
END
N IF
ENDIFF
UN
NTI
TIL Bid
TIL
UNTIL Bid > HighestBid(item)
Highes
estBBid
id(i
(ite
(i t m) OR
te OR Bid
Bi
id = -99
-9
99
F Bid
IF Bidd <>
<> -99
THEN
HE
THEN
Buye
Bu yerItem((item) ĸ BuyerNumber
BuyerItem(item)
ENDI
ENDI
DIF
ENDIFF
possib
ble correct answers, this is an example only.
There are many possible
Five from:
MP1 Method to search item arrays
MP2 Conditional statement used to check for the successful bids
MP3 « equal to / greater than reserve price
MP4 Method used to calculate 10% percent of successful bid (for each
item)
MP5 «and add to auction company total fee
MP6 Method used to display total fee with a suitable message
4 4
Statements Selection Repetition
FOR A ĸ 1 TO 100
B ĸ B + 1 9
NEXT A
CASE A OF
100: B ĸ A
9
200: C ĸ A
ENDCASE
IF A > 100
THEN
9
B ĸ A
ENDIF
REPEAT
A ĸ B * 10 9
UNTIL A > 100
Question Answer
Answ
An wer Marks
Marks
5 Validation
V
Vaaliidatitiion
on 6
Two
Tw o from:
fro
fr om
om:
x a automated
u omated checking
ut che
hecking
he
x cchecking
hecking thatt data
data is reasonable / of a certain type
x checking thatt data data meets certain criteria
Example 1 mark
x range check //
// length check // type check // check digit etc.
Verification
Two from:
x checking that data has not changed«
x « during input to a computer
x « during transfer between computers / devices
Example 1 mark
x double entry // checking against original // visual check // use of
checksum etc.
Section A
Additional data structure description using the same data structure type
maximum one mark
x Two or more full descriptions of the data structure including name, data
type and use
Sample answer
REPEAT
PRINT "Enter Number of slabs to purchase"
INPUT Number
UNTIL Number >= 20 and Number <= 100
PurchaseNo Number
IF Number > 20 AND D Number <= 40 THEN PurchaseNo 40
ENDIF
IF Number > 40 AND D Number <= 60 THEN PurchaseNo 60
AND
ENDIF
IF Number > 60 D Number <= 80 THEN PurchaseNo 80
60 AND
ND
ENDIF F
IF Number
IF Num
um er > 80 THEN
umbe THE
HE
EN PurchaseNo
Purc
Pu rcha
rc hase
seNo
se o 100
No 100
0 ENDIF
END
NDIF
IF
F
Baatc
tchN
hNo
hN
BatchNo o PurchaseNo
Purchas
seNo / 20
Prric
ceT ToP
oPay
PriceToPay y BatchNo
ay Batch
c No * BatchPrice //BatchPrice
ch
c
calc
alc
lcul
ulat
ul ated
calculatedted in Task k 1
PRRIN
INT
PRINT T "Price
"Pri
"P rice for ",
", PurchaseNo, " Slabs is $", PriceToPay
4 3
5 Totalling:
Tota
To t lllin
ta ing:
g: 4
x A Adding
d in
dd the
ng th off ea
he weight o each basket
ach b asske o tthe
et to total
he tot
ota
ot al w
al weight
eiigh each
ht as e ach
ac weight
h we
weig
ight
ht iss
entered
ente
en tere
red
re d
x To Total
T tal = Total + Weight
tal
Counting:
C
Co unti
un ting
ti ng::
ng
x A Adding
dding one to/incre
to/incrementing
ementing the number of baskets as each weight is
entered
x BasketCount = BasketCount
BasketCount + 1
6 Constants 6
Two from:
x The value cannot be changed accidentally «
x « during the execution of the program
x Value only needs to be changed once if circumstances change/during the
initialisation process
Variables
Two from:
x Stores a value that can change «
x « during the execution of the program
x Can use a variable without knowing its value
Arrays
Two from:
x A list of items of the same data type «
x « stored under a single name
x To reduce the num
number
mber of variables used
x Any item can be foundund using an index number to show its place in the list
fou
Questio Answer
A
An sw
wer
e Mark
Mark
M
n s
7(a) x N umbe
um be
b
Number er is repeated/not
repeate
ed/not unique 1
7(b)
b)) x IItem
tem number
tem
te numb
nu displayed/Amount
mber not dis
mb splayed/Amount column not required 5
x NNot
ot Like
Likke ‘Delivered’’ will
will also show cancelled items
Sort:
Show:
; ;
Criteria: Like "Not
started"
1(b) Any meaningful name for a variable related to Task 2 – one mark, e.g. 4
NumberOfWalls
TotalArea
TotalCost
Relevant data type for the variable related to Task 2 – one mark, e.g.
« Integer
« Real
One
O
On emmark
ark fo
ar for
or a ccorrect reason,
orrect re
reaso e.g.
on,, e .g.
V Variables
aria
ar ia
iabl
abl es allow the storage
bles storage of values within a program that may change as
the
th
he prprogram
prog
ogra
og raam runs // VVariables
ariables are used to store values that are input or
calculated
callc
ca lcul
lcul
ulat
a edd
Example algorithm
REPEAT
OUTPUT "Please enter height of wall "
INPUT Height
UNTIL Height > 0
REPEAT
"Pleasse enter
OUTPUT "Please enter width of wall "
INPUT Width
h
UNTIL Width > 0
REPE
RE PEAT
PE
REPEATAT
T
Found
ound
Found d m FALSE
Cou
o nt
nter
Countererr m 0
REEP
PEA
EAT
REPEAT T
OUT
UTPU
PUT "Please
OUTPUT "Pleas
ase enter tile identification code "
as
INPUT MyTileId
INPUT MyTileI
e d
eI
IF MyTileId = TileCode(Counter)
THEN
t m TilePrice(Counter)
MyCost
Found m TRUE
ENDIF
Counter m Counter + 1
UNTIL Found OR Counter = 10
UNTIL Found
2 Two from 2
Sub-program / system not the whole program / system
To perform a frequently used operation within a program
That can be called when needed
That can be reused by another program
3 FOR (… TO … NEXT)loop 3
WHILE (… DO … ENDWHILE) loop
REPEAT (… UNTIL) loop
0 16 FALSE
0 16 10 8 FALSE
0 7 10 3 FALSE
4 7 10 5 TRUE TRUE
on
ne m
Correct purpose for each array related to Task 1 – one ark
ar
rk (m
mark (max
ax
a two) e.g.
…to store the item codes
…to store the descriptions of the items for sale
1(a)(ii) Any meaningful variable related to Task 1 – one mark (max two)) e.
e
e.g.
g. 4
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 off the transaction
Example answer
OUTPUT "Which type of phone or tablet would you like?
like
ke?
ke ? Input
I put the Item Code"
In
DeviceFlag ← False
WHILE DeviceFlag = False
INPUT DeviceCode
Count ← 0
WHILE Count<10 DO
IF DeviceCode = ItemCode[Count]
THEN
IF Count < 6
THEN
3$*(
DeviceType ← "Phone"
ELSE
DeviceType ← "Tablet"
ENDIF
DeviceFlag ← True
Count ← 10
ENDIF
Count ← Count + 1
ENDWHILE
IF DeviceFlag = False
THEN
Question Answer
An swer
wer Marks
2 2
True False
Statement
(9) (9)
3(a) One mark for each correct validation check (max two)) 4
• Range
• Length
• Type
• Check Digit
e.g.
One mark for each correct related purpose (max two)) e.
e g.
spec
pecciffic
• To make sure the data entered falls within a specific i set
et of
of values
valu
va l es
specified
• To make sure the data entered is no longer than specifi ed
d
whether
• To make sure the data entered follows rules related to whethe herr it iis
he s numbers of letters
• To make sure an identification code entered is ge g
genuine
nuine or possible
possiblele
Question Answer
An swer
wer Marks
4(b) 4
Count ĸ 0
REPEAT
INPUT Number
IF Number >= 100
THEN
Values[Count] ĸ Number
ENDIF
Count ĸ Count + 1
UNTIL Count = 50
Variable hourArrived
Data type integer
Use to calculate the price based on the
e number
numb
nu m er of
of hours
hour
ho u s parking
Variable priceToPay
Data type real
Use store result of price
e calculation
calc
calcul
lc ulat
ul atio
at ion
io n
Day
3$*(
Hour
Check range check
Justification need to check hour is between 8 and 23
1(e) Explanation 4
Any fourr from:
• Add number of hours selected to arrival hour
• Check if this is greater than 16
• True – calculate price up to 16 …
• … using current price in force
• … and add in evening charge
• False – calculate price as usual
explained.
Programming statements can be used but must be exp
pla
lained.
2 Real 5
Integer
Char/String
String
Boolean
6(a) One mark for field and one mark for reas
reason
asson 2
Field Juice code
Reason only unique identifier
6(b) 4
Field: Fruit 1 Fruit 2 Size Stock level
Sort:
Show: ; ;
or:
Pseudocode description P
Ps
Pseudocode
eudocode statement
FOR…TO…NEXT
IF…THEN…ELSE…ENDIF
IF …T
THE
HEN…
N ELSE…ENDIF
WHILE…DO…ENDWHILE
WHIL
WH I E…DO…ENDWHILE
CASE…OF…OTHERWISE…ENDCASE
CASE
SE
E…O
…OF…
OF OTHERWISE…ENDCASE
3$*(
REPEAT…UNTIL
R
RE PEAT…UNTIL
sam
ame
am
Note: reading and the output MUST be within the same lo
oop
o .
e loop.
For example:
Count m 0
WHILE Count < 50 DO
OUTPUT Name[Count]
Count m Count + 1
ENDWHILE
Question An swer
wer
e
Answer Marks
2 Validation check 4
x spec
A range check tests that data entered fits within specified valu
lues
ues
e .
eccifified values.
Verification check
Question Answer
An sw
weerr Marks
4 One mark for a hierarchical structure. 4
One mark for suitable names for the sub-systems.
One mark for identifiable inputs.
One mark for identifiable outputs.
For example:
Satellite
Sate
tellllititite
enna
navigation
avi
viga
gatit on
on ssystem
yysste
t m
Question Answer
Answ
wer
e Marks
5(a) One mark for each error identified and correction: 4
x Numbers should be Number
x IF Number > 100 should be IF Number >= 100 00 0
x INPUT Number is missing from inside the loop, inse ert INPUT
insert Nu
umb
T Number
m er after the ENDIF statement.
x The final OUTPUT Number is not needed, remove it. t
t.
5(b) inequality
One mark for both ends of the range and correct inequ allitity symbols.
ty symbol
o s. 2
One mark for the AND // nested IFs.
The test should be IF Number >= 100 AND Number <= < 200200
0
Note: Repeated values do not need to be written unless a value iss rrewritten.
ewritten.
ew
w
7(b) x bubble sort / sorting the names 2
x eti
ascending order / A to Z / lowest to highest / alphabe tical orde
alphabetical de
er
order
Question Answer
An swer
wer Marks
8 One mark for each. 3
10.00ERXQGDU\DEQRUPDOGDWDWKHSULFHVKRXOGEHUH
0
10.00ERXQGDU\DEQRUPDOGDWDWKHSULFHVKRXOGEHUHMHFWHGYDOXHLVRXWRIUDQJH
UHMH
UH MHFWHGYDO
MH DOXH
X LVRXWRIUDQJH
9.99ERXQGDU\H[WUHPHQRUPDOGDWDWKH
9.99ERXQGDU\H[WUHPHQRUPDOGDWDWKHSULFHVKRXOGEHDFFHSWHGYDOXHLVZLWKLQQRUPDOUDQJH
SULFHVKRRXO
X G EHDFF
F HSW
FF S HGYDOXHLVZLWKLQQRUPDOUDQJH
tenDEQRUPDOGDWDLQSXWVKRXOGEHUHMHFWHGYDO
tenDEQRUPDOGDWDLQSXWVKRXOGEHUHMHFWHGYDOXHLVZURQJW\SH
XH
H LV
V ZURQJJ W\S\SHH