Algorithm design and problem-solving – IGCSE Computer Science (0478)

200 questions · page 12 of 14

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
166
0478/21/M/J/18 · Question 4May/June 2018Paper 213 marks
Loading question…
Question text

4
A programmer has written a routine to check that prices are below $10.00. These values are used
as test data.
10.00
9.99
ten
Explain why each value was chosen.
10.00 …
…
…
9.99 …
…
…
ten …
…
…
[3]

167
0478/21/M/J/18 · Question 5May/June 2018Paper 214 marks
Loading question…
Question text

5
Explain the difference between the programming concepts of counting and totalling.
Include an example of a programming statement for each concept in your explanation.
…
…
…
…
…
…
…
…
… [4]

168
0478/21/M/J/18 · Question 6May/June 2018Paper 218 marks
Loading question…
Question text

6
A database table, PERFORMANCE, is used to keep a record of the performances at a local
theatre.
Show Number
Type
Title
Date
Sold Out
SN091
Comedy
An Evening at Home
01 Sept
Yes
SN102
Drama
Old Places
02 Oct
No
SN113
Jazz
Acoustic Evening
03 Nov
No
SN124
Classical
Mozart Evening
04 Dec
Yes
SN021
Classical
Bach Favourites
01 Feb
Yes
SN032
Jazz
30 Years of Jazz
02 Mar
Yes
SN043
Comedy
Street Night
03 Apr
No
SN054
Comedy
Hoot
04 May
No
(a) State the number of fields and records in the table.
Fields …
Records …
[2]
(b) Give two validation checks that could be performed on the Show Number field.
Validation check 1 …
…
Validation check 2 …
…
[2]
(c) Using the query-by-example grid, write a query to identify jazz performances that are not sold
out. Only display the date and the title.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local

Advertisement
169
0478/22/M/J/18 · Question 3May/June 2018Paper 226 marks
Loading question…
Question text

3
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
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 = '/' THEN Answer
IF
Sign <> '/' AND Sign <> '*' AND Sign <> '-'
AND Sign <> '+'
0
THEN Answer
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
[3]
(b) Show how you could improve the algorithm written in pseudocode by writing an alternative
type of conditional statement in pseudocode.
…
…
…
…
…
…
…
…
…
… [3]

170
0478/22/M/J/18 · Question 4May/June 2018Paper 226 marks
Loading question…
Question text

4
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.
Email address …
…
…
Password …
…
…
[2]

171
0478/22/M/J/18 · Question 5May/June 2018Paper 223 marks
Loading question…
Question text

5
A program checks that the weight of a basket of fruit is over 1.00 kilograms and under
1.10 kilograms. Weights are recorded to an accuracy of two decimal places and any weight not in
this form has already been rejected.
Give three weights as test data and for each weight state a reason for choosing it. All your reasons
must be different.
Weight 1 …
Reason …
…
Weight 2 …
Reason …
…
Weight 3 …
Reason …
…
[3]

172
0478/23/M/J/18 · Question 2May/June 2018Paper 234 marks
Loading question…
Question text

2
Describe, using an example, the purpose of the following checks during data entry.
(a) Validation check
…
…
… [2]
(b) Verification check
…
…
… [2]

173
0478/23/M/J/18 · Question 4May/June 2018Paper 236 marks
Loading question…
Question text

4
An algorithm is written in pseudocode:
INPUT Number
IF Number > 100
THEN OUTPUT ″The number is too large″
ELSE OUTPUT ″The number is acceptable″
ENDIF
(a) Describe the purpose of the algorithm.
…
…
…
…
… [2]
(b) (i)
The algorithm only allows one attempt at inputting an acceptable value.
State how you would change the algorithm so that it continues until a suitable input is
supplied.
…
… [1]
(ii)
Re-write the algorithm in full, using pseudocode, to implement your answer to part (b)(i).
…
…
…
…
…
…
…
…
…
… [3]

Advertisement
174
0478/23/M/J/18 · Question 5May/June 2018Paper 235 marks
Loading question…
Question text

5
The flowchart allows a set of 10 numbers to be entered; it finds and outputs the largest of these
numbers.
START
Max
–1000.00
Counter
0
INPUT Num
Is Num >
Yes
Max ?
No
Max
Num
Counter
Counter + 1
Yes
Is Counter
< 10 ?
No
OUTPUT Max
END
(a) Complete the trace table for the input data:
6.30, 18.62, 50.01, 3.13, 2.05, 50.10, 40.35, 30.69, 0.85, 17.30
Max
Counter
Num
OUTPUT
[3]
(b) Describe two different changes you should make to the flowchart to find the smallest number
instead of the largest number.
Change 1 …
…
Change 2 …
…
[2]

175
0478/22/F/M/18 · Question 2Feb/March 2018Paper 226 marks
Loading question…
Question text

2
An algorithm has been written in pseudocode to input some numbers and print out any numbers
that are greater than or equal to 100. The number 999 stops the algorithm.
INPUT Number
WHILE NUMBERS <> 999 DO
IF Number > 100 THEN PRINT Number ENDIF
ENDWHILE
PRINT Number
(a) Find the four errors in the pseudocode and suggest corrections.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
[4]
(b) Show, using pseudocode, how you would change the corrected algorithm to print out any
numbers between 100 and 200 inclusive.
…
…
…
…
…
…
…
… [2]

176
0478/22/F/M/18 · Question 3Feb/March 2018Paper 224 marks
Loading question…
Question text

3
This flowchart inputs the weight in kilograms of a passenger stepping into a lift. The lift can take a
maximum of eight passengers or a maximum weight of 640 kilograms.
START
totalWeight
0
totalNumber
0
INPUT Weight
totalWeight totalWeight + Weight
totalNumber totalNumber + 1
Is
Yes
totalWeight
> 640?
No
Is
No
Yes
totalNumber
> 8?
OUTPUT 'Lift
overload, step
out'
END
Complete the trace table for the passenger input data:
50, 70, 65, 100, 95, 50, 55, 85, 70, 75
Weight
totalWeight
totalNumber
OUTPUT
[4]

177
0478/22/F/M/18 · Question 4Feb/March 2018Paper 224 marks
Loading question…
Question text

4
A program checks if the weight of a baby is at least 2 kilograms.
Give, with reasons, two different values of test data that could be used for the baby’s weight.
Each reason must be different.
Value 1 …
Reason …
…
Value 2 …
Reason …
…
[4]

178
0478/21/O/N/17 · Question 3Oct/Nov 2017Paper 216 marks
Loading question…
Question text

3
(a) Explain the difference between a validation check and a verification check.
…
…
… [2]
(b) Describe, using an example, how data could be verified on data entry.
…
…
… [2]
(c) Explain what is meant by the term library routine.
…
…
… [2]

Advertisement
179
0478/21/O/N/17 · Question 5Oct/Nov 2017Paper 2127 marks
Loading question…
Question text

5
The flowchart below represents a program routine.
START
Flag
0
Count
1
Is Name[Count]
Yes
Temp
Name[Count]
> Name[Count + 1]?
No
Name[Count]
Name[Count + 1]
Name[Count + 1]
Temp
Flag
1
Count
Count + 1
No
Is Count
= 4?
Yes
No
Is Flag
= 0?
Yes
END
(a) The array used in the flowchart contains the following data:
Name[1]
Name[2]
Name[3]
Name[4]
Jamal
Amir
Eve
Tara
Complete the trace table using the data given in the array.
Flag
Count
Name[1]
Name[2]
Name[3]
Name[4]
Temp
Jamal
Amir
Eve
Tara
[5]
(b) Describe what the algorithm represented by the flowchart is doing.
…
… [2]
Question 6 begins on Page 12.
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local

180
0478/22/O/N/17 · Question 1Oct/Nov 2017Paper 2220 marks
Loading question…
Question text

1
(a) All variables, constants and other identifiers should have meaningful names.
(i)
For one variable that you have used to record the information about a single boat in
Task 1, state the name, data type and its use.
Variable name …
Data type …
Use …
[3]
(ii)
State one constant and its value that you could have used for Task 1.
Constant name …
Value …
[2]
(b) Give two different validation checks you could have used for data entry in Task 1. For each
check explain why it could be used and provide a set of data for testing.
Validation check 1 …
…
Reason for choice …
…
Set of test data …
…
Validation check 2 …
…
Reason for choice …
…
Set of test data …
…
[6]
(c) Write an algorithm to complete Task 3, using either pseudocode, programming statements
or a flowchart. You may assume Task 2 has been completed.
…
…
…
…
…
…
…

Advertisement