You are on page 1of 8

Exam-style questions

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.

Top-down design is the decomposition of a computer system into a set of subsystems,


then breaking each sub-system down into a set of smaller sub-systems, until each sub-system
just performs a single action.

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 SumNum1+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

c Provide some abnormal/erroneous data. [1]


Answer: Number of Diners: -1 -30 -12 50 100 – Program must Reject
Bills: 6, 9, 5030, 800 -90 – Program must Reject
d Identify the boundary data required and the expected results. [4]
Dinners: Lower Boundary: 0 and 1 – program rejects 0 and accept 1
Upper Boundary: 12 and 13 – program accept 12 and reject 13
Bill: Lower Boundary: 9 and 10 – program, rejects 9 and accepts 10
Upper Boundary: 500 and 501 – program accepts 500 and rejects 501
4 Explain what is meant by validation and verification. [4]
Validation is the automated check that is performed by the computer program that data is
reasonable before it is accepted into the system. E.g Range Check, Length Check, Check Digit,
Type Check and Format Check.

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]

6 The following algorithm, shown as a flowchart, checks the size of a consignment


of ten parcels. The dimensions of each parcel are input in centimetres.
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
b State the processes included in this algorithm. [3]
- Inputting of the Length and Breadth
- Comparing Length and Breadth to check if they are greater than 30
- If length or breadth is greater than 30 then REJECT is incremented by 1
- If They are both less than or equal to 30 then Size is calculated by multiplying length by
breadth
- Comparing size to check if its greater than 600, if it is greater then Reject is incremented
by 1 if its less than or equal to 600 then accept is incremented by 1
- The count is incremented by 1 and checked at each iteration if is now equal or greater
than 10.
- The process stops when counter is now equal to 10 and then the algorithm outputs
Reject and Accept
c Identify the rules required to accept a parcel. [3]
- Length must be less than or equal 30
- Breadth must be less than or equal to 30
- Size must be less than or equal to 600
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
a Identify all the errors in the algorithm. [5]
- Initialise Counter to 0 instead of 1
- Total Total+Counter MUST be TotalTotal+Number
- UNTIL Number<0 MUST be UNTIL Number>0
- CounterCounter+1 MUST not be there in a COUNT CONTROLLED LOOP
(FOR…TO…NEXT)
- NEXT Number MUST be NEXT Counter
- OUTPUT Total MUST be outside the FOR…TO…NEXT Loop///Must come after NEXT
Counter
b Rewrite the algorithm so that it is effective and error free. [4]
Counter ← 0
FOR Counter ← 1 TO 10
REPEAT
OUTPUT "Enter a positive whole number "
INPUT Number
UNTIL Number > 0
Total ← Total + Number
Counter ← Counter + 1
NEXT Counter
OUTPUT Total

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

INPUT Number1, Number2, Sign


WHILE Number1 <> 0
CASE Sign OF:
“+”: Answer ← Number1 + Number2
“-“: Answer ← Number1 - Number2
“*”: Answer ← Number1 * Number2
“/”: Answer ← Number1 / Number2
OTHERWISE: Answer0

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

You might also like