Databases and SQL – IGCSE Computer Science (0478)

116 questions · page 6 of 8 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
76
0478/22/M/J/19 · Question 3May/June 2019Paper 224 marks
Loading question…
Question text

3
This flowchart inputs the marks gained in an examination. An input of –1 ends the routine.
START
Total
0
Count
0
Distinction
0
INPUT Mark
Yes
Is Mark = –1 ?
Total
Total + Mark
Count
Count + 1
No
OUTPUT "Number of
No
Is
Distinctions ", Distinction
Mark >=
OUTPUT "Average Mark "
80 ?
Total/Count
Yes
END
Distinction
Distinction + 1
Complete the trace table for the mark input data: 50, 70, 65, 30, 95, 50, 55, 85, 65, 35, –1, 45
OUTPUT
Total
Count
Distinction
Mark
[4]

77
0478/22/M/J/19 · Question 6May/June 2019Paper 228 marks
Loading question…
Question text

6
A database table, FLIGHT, is used to keep a record of flights from a small airfield. Planes can
carry passengers, freight or both. Some flights are marked as private and only carry passengers.
Flight number
Plane
Notes
Departure time
Passengers
FN101
Caravan 1
Private passenger flight
08:00
Y
CN101
Caravan 2
Freight only
08:30
N
CN102
Piper 1
Freight only
09:00
N
FN104
Piper 2
Passengers only
09:20
Y
FN105
Piper 1
Freight and passengers
10:00
Y
FN106
Caravan 1
Passengers only
10:30
Y
CN108
Caravan 2
Freight only
08:00
N
CN110
Lear
Private passenger flight
08:00
Y
(a) State the field that could have a Boolean data type.
Field … [1]
(b) A query-by-example has been written to display just the flight numbers of all planes leaving
after 10:00 that only carry passengers.
Field:
Flight number
Passengers
Departure time
Table:
FLIGHT
FLIGHT
FLIGHT
Sort:
Show:
3
Criteria:
= Y
= 10:00
or:
Explain why the query-by-example is incorrect, and write a correct query-by-example.
Explanation …
…
…
…
…
Field:
Table:
Sort:
Show:
Criteria:
or:
[7]
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
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of

78
0478/23/M/J/19 · Question 2May/June 2019Paper 238 marks
Loading question…
Question text

2
(a) An algorithm has been written in pseudocode to input the weight of 500 items and reject any
that are over-weight or under-weight, then print the percentage rejected.
1
Count
0
Reject
62
Over
58
Under
REPEAT
INPUT ItemWeight
IF ItemWeight > Over AND ItemWeight < Under
THEN
Reject - 1
Reject
ENDIF
Count + 1
Count
UNTIL Count > = 500
Reject / 100
Reject
PRINT "Percentage rejected is ", Reject
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 …
…
Correction …
…
Error 2 …
…
Correction …
…
Error 3 …
…
Correction …
…
Error 4 …
…
Correction …
…
[4]
(b) Describe how you would change the corrected algorithm to calculate the number accepted
instead of rejected, using a variable Accept, and print a warning if fewer than 50% are
accepted.
…
…
…
…
…
…
…

Advertisement
79
0478/23/M/J/19 · Question 3May/June 2019Paper 234 marks
Loading question…
Question text

3
This flowchart inputs the tread depth of five tyres, four on the car and a spare tyre. Any tread
depth of 1.6 mm or less is rejected. To be potentially roadworthy, a car must have four tyres with a
tread depth greater than 1.6 mm.
START
TreadReject
0
Count 1
Is
Yes
Count = 6?
Count
Count + 1
No
Is
No
INPUT Depth
TreadReject
<= 1?
Yes
OUTPUT "Car is
not roadworthy"
No
Is
Depth <=
1.6?
Yes
TreadReject
TreadReject + 1
OUTPUT "Car is
potentially
roadworthy"
END
Complete Trace table 1 for the tread depth input data:
1.7, 1.9, 1.4, 1.8, 2.0
TreadReject
Count
Depth
OUTPUT
Trace table 1
Complete Trace table 2 for the tread depth input data:
1.2, 1.9, 1.4, 1.8, 2.4
TreadReject
Count
Depth
OUTPUT
Trace table 2
[4]

80
0478/23/M/J/19 · Question 6May/June 2019Paper 238 marks
Loading question…
Question text

6
A database table, TRAIN, is used to keep a record of train departures from a station.
Train Number
Platform
Destination
Departure Time
Status
1A37
1
Newtown
08:00
On time
2X19
2
Anytown
08:10
Late
1A29
1
Bigcity
08:15
On time
1A28
2
Anytown
08:30
Cancelled
1A67
3
Gardenvillage
08:45
On time
1A37
1
Newtown
08:50
On time
1A24
2
Charter Train
09:00
Late
1A67
3
Gardenvillage
09:15
On time
(a) Explain why the field Train Number could not be used as a primary key.
…
… [1]
(b) A query-by-example has been written to display only the train numbers and platforms of all
trains leaving after 08:30 that are late.
Field:
Train Number
Platform
Departure Time
Status
Table:
TRAIN
TRAIN
TRAIN
TRAIN
Sort:
Show:
3
Criteria:
= Y
< 08:30
or:
= "Late"
Explain why the query-by-example is incorrect, and write a correct query-by-example.
Explanation …
…
…
…
…
Field:
Table:
Sort:
Show:
Criteria:
or:
[7]
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
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of

81
0478/22/F/M/19 · Question 2Feb/March 2019Paper 226 marks
Loading question…
Question text

2
(a) An algorithm has been written in pseudocode to input 50 numbers and total only the positive
numbers.
←
1
Count
←
Count
Total
REPEAT
INPUT Number
IF Number <> 0
THEN
←
Total + Count
Total
ENDIF
←
Count + 1
Count
UNTIL Count < 50
PRINT Total
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
[4]
(b) Show how you would change the corrected algorithm to only total numbers greater than 0
and less than 20.
…
…
… [2]
Question 3 starts on page 10.

82
0478/22/F/M/19 · Question 4Feb/March 2019Paper 224 marks
Loading question…
Question text

4
For each of the four groups of statements in the table, place a tick in the correct column to show
whether it is an example of Selection or Repetition.
Statements
Selection
Repetition
← 1 TO 10
FOR X
← SUM + 1
SUM
NEXT X
WHILE X > 10 DO
←
SUM
SUM + 1
←
X - 1
X
ENDWHILE
IF X > 10
THEN
←
SUM + 1
SUM
←
X - 1
X
ENDIF
REPEAT
←
SUM
SUM + 1
←
X - 1
X
UNTIL X > 10
[4]

83
0478/22/F/M/19 · Question 6Feb/March 2019Paper 224 marks
Loading question…
Question text

6
A database table, BIKETYRES, is used to keep a record of tyres for sale in a cycle shop.
Tyres are categorised by width and diameter in millimetres, whether they have an inner tube and
the type of terrain for which they are designed.
Tyre Code
Width
Diameter
Tube
Terrain
Stock Level
SLTT
23
700
YES
Asphalt
18
MLNT
24
700
NO
Asphalt
23
LLNT
28
700
NO
Asphalt
19
SLTM
23
700
YES
Mixed
22
MLTM
24
700
YES
Mixed
14
LLTM
28
700
YES
Mixed
12
SLTH
23
700
YES
Hard
10
MLTH
24
700
YES
Hard
5
LLNH
28
700
NO
Hard
7
SLNM
23
700
NO
Mixed
12
MLNM
24
700
NO
Mixed
22
LLNM
28
700
NO
Mixed
18
SSNT
23
650
NO
Asphalt
10
MSNT
24
650
NO
Asphalt
8
SSTM
23
650
YES
Mixed
5
MSNM
24
650
NO
Mixed
4
The query-by-example grid below displays the tyre code and the stock level of all 28 mm width
tyres suitable for mixed terrain.
Field: Tyre Code
Stock Level
Width
Terrain
Table: BIKETYRES
BIKETYRES
BIKETYRES
BIKETYRES
Sort:
Show:
3
3
Criteria:
= 28
= 'Mixed'
or:
Alter the query to show the tyre code and stock level in ascending order of stock level for all
24 mm asphalt terrain tyres. Write the new query in the following query-by-example grid.
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
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of

Advertisement
84
0478/21/O/N/18 · Question 4Oct/Nov 2018Paper 218 marks
Loading question…
Question text

4
An algorithm is written in pseudocode:
0
Total
1 TO 50
FOR Count
INPUT Num
Total + Num
Total
NEXT Count
OUTPUT Total
(a) Describe the purpose of the algorithm.
…
…
…
…
…
… [3]
(b) Re-write the algorithm in pseudocode using a different type of loop.
…
…
…
…
…
…
…
…
…
… [3]
(c) Describe how you could modify the original algorithm shown at the start of question 4, to
allow any number of inputs.
…
…
…
… [2]
Question 5 starts on page 12.

85
0478/21/O/N/18 · Question 6Oct/Nov 2018Paper 216 marks
Loading question…
Question text

6
The database table, PCSTOCK, is a part of the database in an electronics shop, showing some of
the desktop (DT), tablet (TB) and laptop (LT) computers they have in stock.
PCID
ScreenSize
RAM
Type
HDD(GB)
Price
DT303240
30
32
DT
4000
$5000.00
DT303220
30
32
DT
2000
$4500.00
DT301620
30
16
DT
2000
$4000.00
DT231610
23
16
DT
1000
$3000.00
LT191620
19
16
LT
2000
$3000.00
LT171610
17
16
LT
1000
$2500.00
DT230820
23
8
DT
2000
$2000.00
DT190810
19
8
DT
1000
$1500.00
LT190810
19
8
LT
1000
$1500.00
LT170805
17
8
LT
500
$1200.00
DT230420
23
4
DT
2000
$1000.00
DT190410
19
4
DT
1000
$750.00
LT190410
19
4
LT
1000
$950.00
TB100206
10
2
TB
64
$200.00
(a) Complete the table to show the most appropriate data type for each field based on the data
shown in the table at the start of question 6.
Field
Data type
PCID
ScreenSize
Type
Price
[2]
(b) Using the query-by-example grid, write a query to identify all the desktop computers with a
hard drive larger than 1000 GB. All fields in the table should be shown, sorted in descending
order by price.
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

86
0478/22/O/N/18 · Question 4Oct/Nov 2018Paper 224 marks
Loading question…
Question text

4
A programmer wants to test that the readings from 2000 electricity meters are greater than 400
units and less than 900 units. The programmer uses selection and repetition statements as part of
the program.
Explain, using programming statements, how selection and repetition could be used in this
program.
Selection …
…
…
…
…
Repetition …
…
…
…
…
…
…
…
[4]

87
0478/22/O/N/18 · Question 6Oct/Nov 2018Paper 227 marks
Loading question…
Question text

6
A database table, PORTRAIT, is used to keep a record of the portraits available from a photographic
studio. Each portrait has a unique reference number PICnnn, where n is a single digit, for example
PIC123. The studio keeps a record of the size (for example 20 × 15), the type (black and white or
colour), and the price in dollars.
(a) Complete the table to show the most appropriate data type for each of the fields.
Field
Data type
Reference Number
Size
Type
Price in $
[4]
(b) The results from the query-by-example grid should show the reference number, price, type
and size of all portraits under $50. Identify the three errors in the query-by-example grid.
Field:
Reference No
Price in $
Type
Size
Table:
PORTRAIT
PORTRAIT
PORTRAIT
PORTRAIT
Sort:
Show:



Criteria:
>50.00
or:
Error 1 …
…
Error 2 …
…
Error 3 …
…
[3]
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

88
0478/23/O/N/18 · Question 4Oct/Nov 2018Paper 234 marks
Loading question…
Question text

4
This is a section of program code.
1 Total = 100.00
2 PRINT ′Enter the height of each member of your class, one at a
time, when prompted′
3 FOR Count = 1 TO 30
4
PRINT ′Enter a height in metres′
5
INPUT Height
6
Total = Total + Height
7
PRINT Total / 30
8
Count = Count + 1
9 NEXT Count
(a) There are three errors in this code.
State the line numbers that contain the errors and describe how to correct each error.
Error 1 …
…
…
Error 2 …
…
…
Error 3 …
…
…
[3]
(b) State the purpose of this program.
…
…
… [1]

Advertisement
89
0478/23/O/N/18 · Question 6Oct/Nov 2018Paper 2313 marks
Loading question…
Question text

6
An online fruit tree specialist sells fruit trees in various sizes. A database table, TREETAB, shows
the tree type and, for each size, the price and whether they are in stock.
Tree Type
Size1
Size1 In
Size2
Size2 In
Size3
Size3 In
Apple
10.95
Yes
14.95
Yes
29.95
Yes
Apple
12.95
Yes
14.95
Yes
29.95
Yes
Cherry
24.95
No
34.95
No
59.95
Yes
Fig
19.95
Yes
29.95
No
49.95
Yes
Guava
19.95
No
29.95
No
59.95
No
Nectarine
8.50
Yes
11.95
Yes
19.95
Yes
Olive
19.95
No
39.95
Yes
59.95
Yes
Peach
9.25
No
11.95
Yes
19.95
Yes
Pear
10.95
Yes
14.95
Yes
29.95
Yes
Plum
8.95
Yes
11.95
Yes
19.95
Yes
Pomegranate
12.95
No
18.95
Yes
34.95
No
Quince
34.95
Yes
44.95
Yes
84.95
No
(a) State whether any of the fields shown would be suitable as a primary key.
…
Explain your answer …
…
…
[2]
(b) Complete the table to show the most appropriate data type for each of the fields based on the
data shown in the table at the start of question 6.
Field
Data type
Tree Type
Size3
Size2 In
[3]
(c) Show the output that would be given by this query-by-example.
Field: Tree Type
Size1
Size1 In
Table: TREETAB
TREETAB
TREETAB
Sort:
Descending
Show:



Criteria:
<10.00
or:
…
…
…
… [4]
(d) Using the following query-by-example grid, write a query to identify all types of the fruit trees
that are out of stock for all three sizes. Make sure the type of the tree and the various ‘in
stock’ fields are shown. The trees should be listed in alphabetical order by type.
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

90
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