Professional Documents
Culture Documents
Paper 2 - Sample
Paper 2 - Sample
b The description of the analysis stage of the program development life cycle.
investigating to provide the specification of what a program is required to do
testing of the program to make sure that it works under all conditions
writing of the program or suite of programs
using the program specification to show to how the program should be developed
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
[2]
152 Cambridge IGCSE™ and O Level Computer Science Study and Revision Guide Second Edition
318489_Practice_Paper_2A_152-162.indd Page 153 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
.............................................................................................................................................................
2
.............................................................................................................................................................
.............................................................................................................................................................
3
.............................................................................................................................................................
.............................................................................................................................................................
[3]
b Describe, using an example, the use of counting as a standard method of solution.
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
[3]
3 The table below shows ticked (✔) boxes relating to validation and verification checks.
The following five descriptions have been missed out of the table:
● data must be eight characters long
● data must be entered twice and match
● data is displayed on the screen to be confirmed
● data must have a value between 8 and 12
● data must only contain numbers
Write each description in the correct row of the table and name each check.
Method used
Description Validation Verification Name of check
✔
✔
✔
✔
It is illegal to photocopy this page
[5]
Hodder & Stoughton Limited © David Watson and Helen Williams 2022 153
318489_Practice_Paper_2A_152-162.indd Page 154 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
[2]
ii) State three types of test data.
1
.............................................................................................................................................................
.............................................................................................................................................................
2
.............................................................................................................................................................
.............................................................................................................................................................
3
.............................................................................................................................................................
.............................................................................................................................................................
[3]
b A program accepts values that are whole numbers between 30 and 40 inclusive.
Give examples of test data that are required.
Explain, including the expected outcome, why each piece of test data is needed.
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
It is illegal to photocopy this page
........................................................................................................................................................................
[6]
154 Cambridge IGCSE™ and O Level Computer Science Study and Revision Guide Second Edition
318489_Practice_Paper_2A_152-162.indd Page 155 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
01 REPEAT
02 OUTPUT "Please enter your password"
03 INPUT Password
04 IF Length(Password) < 10
05 THEN
06 OUTPUT "Reject too short"
07 ELSE
08 Symbol ← FALSE
09 PasswordUp ← UCASE(Password)
10 FOR Counter ← 1 TO Length(Password)
11 IF SUBSTRING(PasswordUp, Counter, 1) > 90 OR
SUBSTRING(PasswordUp, Counter, 1) < 65
12 THEN
13 Symbol ← TRUE
14 ENDIF
15 NEXT Counter
16 IF Symbol
17 THEN
18 OUTPUT "Accept"
19 ELSE
20 OUTPUT "Reject no symbol"
21 ENDIF
22 ENDIF
23 UNTIL Symbol AND Length(Password) >= 10
. .................................................................................................................................................................
[1]
ii) Identify the line number(s) for these types of statement.
Assignment
It is illegal to photocopy this page
. .................................................................................................................................................................
Selection
. .................................................................................................................................................................
Iteration
. .................................................................................................................................................................
[2]
Hodder & Stoughton Limited © David Watson and Helen Williams 2022 155
318489_Practice_Paper_2A_152-162.indd Page 156 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
b i) Complete the trace table for the algorithm using this data MyPassword!
Password PasswordUp Symbol Counter OUTPUT
[4]
ii) Complete the trace table for MyWord!
Password PasswordUp Symbol Counter OUTPUT
[2]
6 a i) Describe the difference between variables and constants in programming.
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
[2]
ii) Give three basic data types that are used in programming.
1
.............................................................................................................................................................
It is illegal to photocopy this page
.............................................................................................................................................................
2
.............................................................................................................................................................
.............................................................................................................................................................
3
.............................................................................................................................................................
.............................................................................................................................................................
[3]
156 Cambridge IGCSE™ and O Level Computer Science Study and Revision Guide Second Edition
318489_Practice_Paper_2A_152-162.indd Page 157 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
b Write pseudocode statements to declare a variable to store the number of children in a class
and a constant with the value 30 that is the maximum number of children that could be
included in a class.
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
[3]
7 Describe, with the use of examples, the different types of operators that can be used when
programming.
.............................................................................................................................................................................
.............................................................................................................................................................................
.............................................................................................................................................................................
.............................................................................................................................................................................
.............................................................................................................................................................................
.............................................................................................................................................................................
.............................................................................................................................................................................
.............................................................................................................................................................................
[4]
8 In the following diagram, six descriptions are shown on the left and eight library routines
are shown on the right.
By drawing lines, connect each description to the correct library routine.
DIV
Returns the remainder of a division.
LCASE
Returns a random number.
LENGTH
Returns the number of characters.
MOD
Returns a string where all letters are lower case. RANDOM
UCASE
[6]
9 a i) Explain what is meant by the term array.
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
[2]
Hodder & Stoughton Limited © David Watson and Helen Williams 2022 157
318489_Practice_Paper_2A_152-162.indd Page 158 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
[2]
iii) Describe the difference between 1D and 2D arrays.
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
. .................................................................................................................................................................
[2]
b Write pseudocode statements to declare and populate a 2D array with 20 rows of four zeros. Use
iteration to populate the array.
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
[4]
c Give one advantage and one disadvantage of using arrays.
Advantage:
........................................................................................................................................................................
........................................................................................................................................................................
Disadvantage:
It is illegal to photocopy this page
........................................................................................................................................................................
........................................................................................................................................................................
[2]
158 Cambridge IGCSE™ and O Level Computer Science Study and Revision Guide Second Edition
318489_Practice_Paper_2A_152-162.indd Page 159 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
10 Read this section of pseudocode that inputs fifty (50) negative numbers and then outputs
the largest negative number input.
01 Large ← 9999
02 Counter ← 50
03 WHILE Counter > 50 DO
04 REPEAT
05 INPUT NegNum
06 UNTIL NegNum > 0
07 IF NegNum < Large THEN Large ← NegNum
08 Counter = Counter - 1
09 ENDWHILE
10 OUTPUT "Largest number is ", Large
........................................................................................................................................................................
2
.......................................................................................................................................................................
........................................................................................................................................................................
3
.......................................................................................................................................................................
........................................................................................................................................................................
4
.......................................................................................................................................................................
........................................................................................................................................................................
5
.......................................................................................................................................................................
........................................................................................................................................................................
[5]
11 A database of plants for sale, PlantSale, is to be set up with the following fields:
● PlantName – for example Begonia
● PlantPrice – for example $10.00
● PlantID – for example PL579
It is illegal to photocopy this page
........................................................................................................................................................................
Hodder & Stoughton Limited © David Watson and Helen Williams 2022 159
318489_Practice_Paper_2A_152-162.indd Page 160 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
PlantHeight
........................................................................................................................................................................
........................................................................................................................................................................
Position
........................................................................................................................................................................
........................................................................................................................................................................
[3]
b State which field you would choose for the primary key and explain why it is appropriate.
........................................................................................................................................................................
........................................................................................................................................................................
........................................................................................................................................................................
[2]
c Complete this SQL script to display the names, prices and number in stock of all plants taller
than 1.8 metres.
SELECT PlantName, Price, ............................................................................................................
FROM .............................................................................................................................................................
1 1 1
[4]
160 Cambridge IGCSE™ and O Level Computer Science Study and Revision Guide Second Edition
318489_Practice_Paper_2A_152-162.indd Page 161 12/07/22 1:20 PM F-0250 /145/HO02580/work/indd
b Draw a logic circuit for the un-simplified logic expression. Each logic gate must have a maximum
of two inputs.
[4]
B X
13 The one-dimensional array BabyName[] contains the names of the babies in a nursery.
Another one-dimensional array ParentPhone[] contains the phone numbers for the parents
of the baby.
A final one-dimensional array BabyAge[] contains the baby’s age in months.
The position of each baby’s data in the three arrays is the same; for example, the baby in
position 3 in BabyName[], ParentPhone and BabyAge[] is the same.
Write and test a program that meets the following requirements:
● uses procedures to display these lists:
– parent phone numbers and baby names in alphabetic order of baby name
– baby names for babies aged under three months
● uses a procedure to display all the details for a baby, with the name used as a parameter
● uses a procedure to update the details for a baby, with the name used as a parameter.
You must use pseudocode or program code with local and global variables and add comments to
explain how your code works. All inputs and outputs must contain suitable messages.
[12]
Hodder & Stoughton Limited © David Watson and Helen Williams 2022 161