Professional Documents
Culture Documents
CS SRG Paper-2B-answers
CS SRG Paper-2B-answers
CS SRG Paper-2B-answers
b)
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
PROCEDURE
DECLARE
CASE
d) Which statement describes a database primary key?
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 1
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
[4]
b) Flowchart
[6]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 2
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
c) Pseudocode:
REPEAT
OUTPUT "Please enter the weight of your parcel in grams, 10gm to 10kg"
INPUT Weight
UNTIL Weight >= 10 AND Weight <= 10000
IF Weight < 250
THEN
OUTPUT "Small cost $1"
ELSE
IF Weight > 2500<
THEN
OUTPUT "Large cost $5"
ELSE
OUTPUT "Medium cost $3"
ENDIF
ENDIF
[6]
4 In order to be able to maintain a program it needs to be easily understood by other programmers. All
the identifiers used in the program should have meaningful names. For example when declaring
constants. and variables. Any code reused in the program should be part of function or procedure The
programmer should include comments to explain how the solution works and the syntax used.
[8]
5 a) Finding the average of several numbers.
[1]
b)
X Y Z W OUTPUT
0 0
1 20 20
2 50 30
3 105 55
4 170 65
5 160 -10
-999 32 32
[4]
c) Suggest meaningful names for:
W Total
X Counter
Y Average
Z Number
[2]
6 FOR Index 1 TO 24
INPUT Temperature[Index]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 3
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
IF Temperature[Index] > 30
THEN
OUTPUT "too high"
ELSE
IF Temperature[Index] < 20
THEN
OUTPUT "too low"
ENDIF
ENDIF
NEXT Index
[6]
7
[4]
8
1 01 For Index 0 TO 100
For Index 1 TO 100
2 01 For Index 0 TO 100
For Index 1 TO 50
5 06 Index Index + 1
Remove line
6 07 NEXT Number
NEXT Index
[6]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 4
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
9 a)
HouseType, text as a short description is required
Bedrooms, integer as a whole number is required, and this may be used for sorting
Bathrooms, integer as a whole number is required, and this may be used for sorting
Address, text as several words and numbers are required
Garage, Boolean as this can be true or false
Price, Currency as the price should be displayed in dollars
[6]
b)
Name: HouseID
Example: P370
[4]
c)
FROM HouseRent
WHERE Garage;
[4]
10 a) T = (G AND NOT R AND NOT O) OR (R AND O AND NOT G)
[4]
b)
Inputs Working space Output
R O G T
0 0 0 0 0 0
0 0 1 1 0 1
0 1 0 0 0 0
0 1 1 0 0 0
1 0 0 0 1 1
1 0 1 0 0 0
1 1 0 0 0 0
1 1 1 0 0 0
[4]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 5
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
c)
[6]
11
Python:
# set up starting conditions
Name = input("Please enter your name ")
Table = 0
while (Table < 1 or Table > 12):
Table = int(input("Please enter a table between 1 and 12 "))
Questions = 0
while (Questions < 5 or Questions > 10):
Questions = int(input("Please enter the number of questions between 5 and 10 "))
Retest = True
[14]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 6
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
Visual Basic:
Module Module1
Sub Main()
Dim Name, Choice As String
Dim Table, Questions, QuestionNumber, Right, Answer As Integer
Dim ReTest As Boolean
' set up staring conditions
Console.Write("Please enter your name ")
Name = Console.ReadLine()
Do
Console.Write("Please enter a table between 1 and 12 ")
Table = Int(Console.ReadLine())
Loop Until Table >= 1 And Table <= 12
Do
Console.Write("Please enter the number between 5 and 10 ")
Questions = Int(Console.ReadLine())
Loop Until Questions >= 5 And Questions <= 10
ReTest = True
[14]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 7
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
Java:
import java.util.Scanner;
class ExamQ11Java
{
int Questions;
do
{
System.out.print("Please enter the number of questions between 5 and 10 ");
Questions = myObj.nextInt();
}
while (Questions < 5 || Questions > 12);
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 8
© Hodder & Stoughton Ltd 2022
Cambridge IGCSE™ and O Level Computer Science
}
[14]
Cambridge IGCSE™ and O Level Computer Science Second Edition Study and Revision Guide 9
© Hodder & Stoughton Ltd 2022