Professional Documents
Culture Documents
1 A solution to a problem is decomposed into its component parts. Name and describe the
component parts. [8]
Notes: Decomposition is the breaking down of a problem into smaller sub problems that are
more manageable and easier to solve.
Decomposition is the breaking down of a system into smaller sub subsystems, and breaking
down those subsystems into even smaller sub systems until each one is just one task which is
more manageable and easier to solve.
Answer:
Component parts are:
INPUTS: - The data used by the system that needs to be entered while the system is active.
E.g INPUT “Enter the first number”, Num1
PROCESS:- the tasks that need to be performed using the input data and any other previously
stored data.
E.g SumNum1+Num2
OUTPUTS:- Information that needs to be displayed or printed for the users for use in the future.
E.g OUTPUT “The sum is “, Sum
STORAGE: - data that needs to be stored in files on an appropriate medium for use in the future.
2 A computer system is to be developed to provide a modulo 11 check digit for numbers from 4
to 20 digits in length. Provide a structure diagram for this computer system. [6]
Notes:
Check Digit is an error checking method which is also a validation method used to check for
errors in code such as ISBN and VIN. It is the last digit included in a code and is calculated from
all the other digits in the code. It is used to identify data entry errors.
Examples of errors identified by check digit: An incorrect digit entered e.g 5327 instead of 5307,
transposition errors e.g 5037 instead of 5307, omitted or extra digits e.g 537 instead of
5307phonetic errors e.g 13 instead of 30
Modulo 11: Is check digit algorithm which is used to calculate the digit to be placed at the end
of a code
3 A phone app is being developed to split the cost of a restaurant bill between a given number
of people. It is being designed to work for up to 12 diners and for bills from $10 to $500.
a What validation checks should be used for the number of diners and the size of the bill? [2]
Notes:
Validation is the automated check by a program to ensure that data is reasonable before being
accepted into a computer system. Eg Length check, Type check, Format check, Presence check,
Range check, Check digit
Answer: For Number of Diners and Size of bill – Range Check, Type Check and Presence Check
b Provide two sets of normal data and their expected results. [4]
Answer: Number of Diners – 1 2 3 4 5 6 7 8 9 10 11 12 – program must Accept
Bills – 10, 11, 12 , 13…. To 500 – program must Accept
Notes:`Test Data is all the data values that are used to test if the algorithm is working perfectly
4 types of Test Data are: 1. Normal Test Data 2. Extreme Test Data 3. Abnormal test Data 4.
Boundary Test Data.
Normal Test Data – Data that is within the acceptable range that should be accepted by the
program e.g for a percentage marks program, normal test data would be 0 1 2 3….up to 100
The program must accept Normal Test Data. If the program rejects normal test data then there
is an error in the program.
Extreme Test Data – The lowest/Smallest and Highest/Largest value in the normal or acceptable
range of values. The program must accept Extreme Test Data. E.g for a percentage marks
program, extreme test data would be 0 and 100.
Abnormal Test Data – Is data that is outside the acceptable range or erroneous data that the
program must reject. E.g for a percentage marks program, Abnormal test data would be -5, 200,
300, -1.
Boundary Test Data – Data values that are at the edges of acceptable and rejectable ranges. E.g
for a percentage marks program:
Lower Boundary -1 and 0 hence the program must reject -1 and accept 0
Upper Boundary 100 and 101 hence the program must accept 100 and reject 101
Verification – checking that data has been accurately copied from another source and input into
a computer or transferred from one part of a computer system to another.
Methods: Double Entry, Screen or Visual Check
Double Entry – Data is entered twice sometimes by different users and the computer program
compares the 2 versions. If they are identical then there is no error if they are different then
there is an error. E.g Password and email address
Screen or Visual Check – The manual check completed by the user who is entering the data,
when the data entry is completed, the user is asked to confirm that it is accurate before
continuing.
5 The following data is to be entered onto an online form:
– Name
Validation:
Presence Check - to ensure that the name field is not left blank since every person has a name.
Length Check – to ensure that a name has a certain minimum number of characters
Type Check- to ensure that the name is of text or string datatype
Verification:
Visual or Screen Check – the user checks the spelling of their name
– Date of birth
Validation:
Format Check – to ensure that the is in the required format eg: DD-MM-YYYY
Type Check – To ensure that the DOB is in the Date Data type
Verification:
Visual or Screen Check – to check if the date of birth has been accurately entered
– Password
Validation:
Presence Check – To ensure that the password field is not left blank
Length Check – To ensure that the password has a certain number of characters or more e.g 8
characters or more
Verification:
Double entry – so the password entered twice and the 2 entries are compared, if they are
identical then the password is correct and if they are not then the password is wrong
– Phone number
Validation:
Length Check – to ensure that the phone number has a certain number of characters (Please
note that a phone number is a string)
Type Check – to ensure that phone number of String or Text Datatype
Verification:
Screen or Visual Check to cross check the if the digits have been copied accurately.
For each item state, with reasons, the validation and verification checks that should be used on
the input data. [8]
c Set up a trace table and some test data to dry run your rewritten algorithm. [4]
Normal test Data: 5 2 4 200 50 8000
Abnormal test data: -1 -20 -80 -1000 -16
Extreme Test Data: 1
Boundary Test Data: 0 1
d Identify which items of your test data are normal, erroneous and extreme. [3]
Normal test Data: 5 2 4 200 50 8000
Abnormal test data: -1 -20 -80 -1000 -16
Extreme Test Data: 1
Boundary Test Data: 0 1
8 This pseudocode algorithm inputs two non-zero numbers and a sign, and then performs
the calculation shown by the sign. An input of zero for the first number terminates the
process.
INPUT Number1, Number2, Sign
WHILE Number1 <> 0
IF Sign = '+' THEN Answer ← Number1 + Number2 ENDIF
IF Sign = '-' THEN Answer ← Number1 - Number2 ENDIF
IF Sign = '*' THEN Answer ← Number1 * Number2 ENDIF
IF Sign = '/' THEN Answer ← Number1 / Number2 ENDIF
IF Sign <> '/' AND Sign <> '*' AND Sign <> '-' AND Sign <>
'+'
THEN Answer ← 0
ENDIF
IF Answer <> 0 THEN OUTPUT Answer ENDIF
INPUT Number1, Number2, Sign
ENDWHILE
a Complete the trace table for the input data:
5, 7, +, 6, 2, -, 4, 3, *, 7, 8, ?, 0, 0, /
Number1 Number2 Sign Answer OUTPUT
5 7 + 12 12
6 2 - 4 4
4 3 * 12 12
7 8 ? 0
0 0 /
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
ENDCASE
IF Answer <> 0 THEN OUTPUT Answer ENDIF
INPUT Number1, Number2, Sign
ENDWHILE
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]
NOTES:
Verification – checking that data has been accurately copied from another source and input into
a computer or transferred from one part of a computer system to another.
Methods: Double Entry, Visual Check
Answer: To ensure that the name, email address and password are copied accurately for each
contributor
Name – Visual Check method of verification where the user checks that the name has been spelt
correctly/accurately and the programmer can put a checkbox or button for the user to click or
tick indicating that they have checked the spelling for the name.
Email address and password – Double Entry method, whereby the email address and password
are prompted for and entered twice. The program then compares the 2 versions, and if they are
identical, then its accurate and if they are not then there is an error and the user is prompted to
re-enter.
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
Validation Checks: Presence Check, format Check, Type Check and Length Check
Presence Check - to ensure that the email address field and password are not left blank
Format Check – to ensure that the email address has an @ sign/character
Length Check – to check that the password has 8 or more characters
Format Check – To check that the password contains a combination of alphabetic characters,
numeric characters, and alpha numeric characters, capital letters, small letters