CS (2)
CS (2)
CS (2)
Counter ¨ 0
Accept ¨ 0
Reject ¨ 0
INPUT
Length,
Breadth
no
no
Size ¨
Length * Breadth
no
Accept ¨ Reject ¨
Accept +1 Reject +1
Counter ¨
Counter +1
no Counter
>= 10?
yes
OUTPUT
Accept,
Reject
STOP
296
a Use this data and the following trace table to dry run the algorithm:
15, 10, 20, 17, 32, 10, 30, 35, 30, 15, 30, 28, 25, 25, 20, 15, 40, 20, 12, 10
Counter Length Breadth Volume OUTPUT
[5]
b State the processes included in this algorithm. [3]
c Identify the rules required to accept a parcel. [3]
7 The following algorithm written in pseudocode adds up 10 positive
numbers and outputs the total. It contains several errors.
Counter ← 1
FOR Counter ← 1 TO 10
REPEAT
OUTPUT "Enter a positive whole number "
INPUT Number
UNTIL Number < 0
Total ← Total + Counter
Counter ← Counter + 1
OUTPUT Total
NEXT Number
297
[3]
b Show how you could improve the algorithm written in pseudocode
by writing an alternative type of conditional statement in
pseudocode.[3]
Cambridge IGCSE Computer Science (0478) Paper 22 Q3, June 2018
9 A programmer has written a routine to store the name, email address and
password of a contributor to a website’s discussion group.
a The programmer has chosen to verify the name, email address and
password.
Explain why verification was chosen and describe how the
programmer would verify this data. [4]
b The programmer has also decided to validate the email address
and the password.
Describe validation checks that could be used. [2]
Cambridge IGCSE Computer Science (0478) Paper 22 Q4, June 2018
298