Trace Tables
Trace Tables
3 The flowchart inputs the size of a number of car engines; a value of –1 stops the input.
This information is output: average engine size and number of engines with size > 1.5
START
Engine ← 0
Count ← 0
Number ← 0
INPUT Size
No
STOP
is Size Yes
Count ← Count + 1
> 1.5 ?
No
Number ← Number + 1
Page 9
9
1.8, 2.0, 1.0, 1.3, 1.0, 2.5, 2.0, 1.3, 1.8, 1.3, –1
[6]
3 The flowchart below inputs the weight of a number of parcels in kilograms. Parcels weighing more
than 25 kilograms are rejected. A value of –1 stops the input.
The following information is output: the total weight of the parcels accepted and number of parcels
rejected.
START
7RWDOĸ
5HMHFWĸ
INPUT
Weight
No END
Is Weight Yes
5HMHFWĸ5HMHFW
> 25?
No
7RWDOĸ7RWDO:HLJKW
Page 28
9
1.8, 26.0, 7.0, 11.3, 10.0, 2.5, 25.2, 5.0, 19.8, 29.3, –1
[5]
4 Five data types and five data samples are shown below.
Draw a line to link each data type to the correct data sample.
Real 2
Char 2.0
String True
Boolean "Twelve"
[4]
3 (a) The flowchart below inputs six single digit numbers. The predefined function MOD gives the
value of the remainder, for example, Y ← 10 MOD 3 gives the value Y = 1
START
INPUT
A, B, C, D, E, F
No
OUTPUT
'Reject'
END
Page 44
7
Complete a trace table for each of the two sets of input data.
Set 1 5, 2, 4, 3, 1, 5
Set 2 3, 2, 1, 0, 7, 3
[4]
...................................................................................................................................................
...............................................................................................................................................[1]
(c) Identify a problem with this flowchart and explain how to correct it.
Problem ....................................................................................................................................
...................................................................................................................................................
Solution .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
3 (a) The flowchart inputs an integer. The predefined function DIV gives the integer result of the
division, e.g. Y 10 DIV 3 gives the value Y = 3. The predefined function MOD gives the
value of the remainder, e.g. Y 10 MOD 3 gives the value Y = 1.
START
Posn @ 1
New @ 0
INPUT X
T1 @ X DIV 2
T2 @ X MOD 2
New @New+T2 * Posn
Posn @Posn * 10
X @T1
Yes is T1
>= 2?
No
OUTPUT New
END
Page 61
9
Complete a trace table for each of the two input values 5 and 12.
[6]
...............................................................................................................................................[1]
3 (a) This pseudocode inputs an integer. The predefined function DIV gives the value of the
division, e.g. Y 10 DIV 3 gives the value Y = 3. The predefined function MOD gives the
value of the remainder, e.g. Y 10 MOD 3 gives the value Y = 1.
INPUT X
WHILE X > 15
DO
T1 X DIV 16
T2 X MOD 16
CASE T2 OF
10:OUTPUT A
11:OUTPUT B
12:OUTPUT C
13:OUTPUT D
14:OUTPUT E
15:OUTPUT F
OTHERWISE OUTPUT T2
ENDCASE
X T1
ENDWHILE
CASE X OF
10:OUTPUT A
11:OUTPUT B
12:OUTPUT C
13:OUTPUT D
14:OUTPUT E
15:OUTPUT F
OTHERWISE OUTPUT X
ENDCASE
Page 76
9
Complete a trace table for each of the two input values 37 and 191.
X T1 T2 OUTPUT
X T1 T2 OUTPUT
[4]
...................................................................................................................................................
...............................................................................................................................................[2]
4 The flowchart below inputs the height of children who want to ride on a rollercoaster. Children
under 1.2 metres are rejected. The ride starts when eight children have been accepted.
67$57
5LGHUV
5HMHFW
,1387
+HLJKW
,V <HV
+HLJKW 5HMHFW5HMHFW
"
1R
5LGHUV5LGHUV
(1'
Page 92
9
1.4, 1.3, 1.1, 1.3, 1.0, 1.5, 1.2, 1.3, 1.4, 1.3, 0.9, 1.5, 1.6, 1.0
[4]
Section B
51020: value of c: 5
message: PIN OK (1 mark)
5120: value of c: 4
message: error in PIN entered (1 mark) [2]
3
Engine Count Number Size Average OUTPUT
0 0 0 1.8
1.8 1 1 2.0
3.8 2 2 1.0
4.8 3 1.3
6.1 4 1.0
7.1 5 2.5
9.6 3 6 2.0
11.6 4 7 1.3
12.9 8 1.8
14.7 5 9 1.3
16.0 10 –1
1.6
1.6, 5
(1 mark) (1 mark) (1 mark) (1 mark) (1 mark) (1 mark) [6]
line 7: PRINT h should come after the end of the repeat loop
line 8: this should read UNTIL c = 20 or UNTIL c >= 20 or UNTIL c > 19 [3]
Page 19
Page 5 Mark Scheme Syllabus Paper
Cambridge IGCSE – May/June 2015 0478 21
Section B
0 0
1.8 1.8
1 26.0
8.8 7.0
20.1 11.3
30.1 10.0
32.6 2.5
2 25.2
37.6 5.0
57.4 19.8
3 29.3
–1 57.4, 3
[5]
Page 36
Page 4 Mark Scheme Syllabus Paper
Cambridge IGCSE – May/June 2015 0478 22
Section B
3 (a)
Trace table set 1
A B C D E F Total Check Output
5 2 4 3 1 5 38 5 Accept
3 2 1 0 7 3 45 1 Reject
(c) 1 mark for identifying the problem, 2 marks for the solution
Problem – doesn’t deal correctly with remainder 10/a check digit of X
Solution – check Z for X as a final digit
– have a special case where check = 10
– accept where Check = 10 and F = X [3]
Page 52
Page 4 Mark Scheme Syllabus Paper
Cambridge IGCSE – October/November 2015 0478 21
Section B
3 (a)
Number 1 Trace table
X Posn New T1 T2 Output
5 1 0
10 1 2 1
2 100 1 1 0
101
101
12 1 0
10 0 6 0
6 100 0 3 0
3 1000 100 1 1
1100
1100
Page 68
Page 4 Mark Scheme Syllabus Paper
Cambridge IGCSE – October/November 2015 0478 23
Section B
line 7 Average = Total/Poscount: this should come after the end of the repeat loop
37 2 5 5
2 2
(1 mark) (1 mark)
191 11 15 F
11 B
(ii) Acceptable data to test that the results are as expected. [2]
(b) One mark for the data set, one mark for the type and one mark for the matching reason
There are many possible correct answers this is an example only.
Set 1 – Age 4, height 0.9
Type – Boundary/Extreme
Reason – Data to test the validation that is just within the limits of acceptability
Set 2 – Age 10, height 1.4
Type – Abnormal
Reason – Data that should be rejected and produce an error message [6]
Page 83
Page 5 Mark Scheme Syllabus Paper
Cambridge IGCSE – May/June 2016 0478 21
4
Riders Reject Height Output
0 0
1 1.4
2 1.3
1 1.1
3 1.3
2 1.0
4 1.5
5 1.2
6 1.3
7 1.4
8 1.3
Ready to go 2
(1 mark) (1 mark) (1 mark) (1 mark)
[4]
5 – FOR (… TO … NEXT)…
– … a set number of iterations
– WHILE (… DO … ENDWHILE) …
– … used where the loop may never be executed/whilst a specified condition exists
[4]
– ….. Uniquely identifies each member of staff//no duplicates//different for each member of
staff
[2]
Page 100