0% found this document useful (0 votes)
472 views18 pages

Trace Tables

The flowchart inputs the weight of parcels in kilograms. Parcels over 25 kg are rejected. It outputs the total weight of accepted parcels and the number rejected. A trace table is completed for two sets of input data. The purpose is to check parcel weights and outputs totals. A problem is it doesn't check for negative or non-numeric inputs, which could be fixed by adding input validation.

Uploaded by

bethehero9000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
472 views18 pages

Trace Tables

The flowchart inputs the weight of parcels in kilograms. Parcels over 25 kg are rejected. It outputs the total weight of accepted parcels and the number rejected. A trace table is completed for two sets of input data. The purpose is to check parcel weights and outputs totals. A problem is it doesn't check for negative or non-numeric inputs, which could be fixed by adding input validation.

Uploaded by

bethehero9000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

8

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

is Size Yes OUTPUT


Average ← Engine/Number
= –1 ? Average, Count

No

STOP
is Size Yes
Count ← Count + 1
> 1.5 ?

No

Number ← Number + 1

Engine ← Engine + Size

© UCLES 2014 0478/02/SP/16

Page 9
9

Complete the trace table for the input data.

1.8, 2.0, 1.0, 1.3, 1.0, 2.5, 2.0, 1.3, 1.8, 1.3, –1

Engine Count Number Size Average OUTPUT

[6]

© UCLES 2014 0478/02/SP/16 [Turn over


Page 10
8

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

Is Weight Yes OUTPUT Total,


= –1? Reject

No END

Is Weight Yes
5HMHFWĸ5HMHFW
> 25?

No

7RWDOĸ7RWDO:HLJKW

© UCLES 2015 0478/21/M/J/15

Page 28
9

Complete the trace table for the input data:

1.8, 26.0, 7.0, 11.3, 10.0, 2.5, 25.2, 5.0, 19.8, 29.3, –1

Total Reject Weight OUTPUT

[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.

Data type Data sample


Integer 'a'

Real 2

Char 2.0

String True

Boolean "Twelve"
[4]

© UCLES 2015 0478/21/M/J/15 [Turn over


Page 29
6

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

Total @ A*1 + B*2 + C*3 + D*4 + E*5

Check @ Total MOD 11

Is Check = Yes OUTPUT


F? 'Accept'

No

OUTPUT
'Reject'

END

© UCLES 2015 0478/22/M/J/15

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

Trace table set 1 5, 2, 4, 3, 1, 5

A B C D E F Total Check Output

Trace table set 2 3, 2, 1, 0, 7, 3

A B C D E F Total Check Output

[4]

(b) State the purpose of the flowchart in part (a).

...................................................................................................................................................

...............................................................................................................................................[1]

(c) Identify a problem with this flowchart and explain how to correct it.

Problem ....................................................................................................................................

...................................................................................................................................................

Solution .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

© UCLES 2015 0478/22/M/J/15 [Turn over


Page 45
8

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

New @New+T1 * Posn

OUTPUT New

END

© UCLES 2015 0478/21/O/N/15

Page 61
9

Complete a trace table for each of the two input values 5 and 12.

Trace table for input value 5

X Posn New T1 T2 OUTPUT

Trace table for input value 12

X Posn New T1 T2 OUTPUT

[6]

(b) State the purpose of the flowchart in part (a).

...............................................................................................................................................[1]

© UCLES 2015 0478/21/O/N/15 [Turn over


Page 62
8

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

© UCLES 2015 0478/23/O/N/15

Page 76
9

Complete a trace table for each of the two input values 37 and 191.

Trace table for input value 37

X T1 T2 OUTPUT

Trace table for input value 191

X T1 T2 OUTPUT

[4]

(b) State the purpose of the pseudocode in part (a).

...................................................................................................................................................

...............................................................................................................................................[2]

© UCLES 2015 0478/23/O/N/15 [Turn over


Page 77
8

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

1R 5LGHUV <HV 287387


" 5HDG\WRJR 5HMHFW

(1'

© UCLES 2016 0478/21/M/J/16

Page 92
9

Complete the trace table for the input data:

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

Riders Reject Height OUTPUT

[4]

© UCLES 2016 0478/21/M/J/16 [Turn over


Page 93
4

Section B

2 (a) 1 mark for value of c and message

51020: value of c: 5
message: PIN OK (1 mark)

5120: value of c: 4
message: error in PIN entered (1 mark) [2]

(b) length check [1]

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]

4 1 mark for each error identified + suggested correction

line 5: this should read IF x > h THEN h = x

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]

© UCLES 2012 0478/02/SM/15

Page 19
Page 5 Mark Scheme Syllabus Paper
Cambridge IGCSE – May/June 2015 0478 21

Section B

2 1 mark for each error identified + suggested correction


Line 1 or Small = 0: this should read Small = 999
line 5 or IF…: this should read IF Num < Small THEN Small = Num
line 8 or UNTIL: this should read UNTIL Counter = 10 or
UNTIL Counter > = 10 or
UNTIL Counter > 9
line 7 or PRINT…: PRINT Small should come after the end of the repeat loop
or
line 8 or UNTIL: this should come before line 7 [4]

Total Reject Weight Output

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

(2 marks) (1 mark) 1 mark) (1 mark)


(–1 for each error) (allow follow through)
(then follow though) (from Total and Reject)

[5]

© Cambridge International Examinations 2015

Page 36
Page 4 Mark Scheme Syllabus Paper
Cambridge IGCSE – May/June 2015 0478 22

Section B

2 1 mark for each error identified + suggested correction


Line 1 or Large =9999: this should read Large = 0
Line 3 or WHILE: this should read WHILE Counter < 30
line 6 or IF: this should read IF Num > Large THEN Large = Num
line 7 or Counter =…: this should read Counter = Counter + 1 [4]

3 (a)
Trace table set 1
A B C D E F Total Check Output

5 2 4 3 1 5 38 5 Accept

-----------------------------------(1 mark)-----------------------------------(1 mark)------


Trace table set 2
A B C D E F Total Check Output

3 2 1 0 7 3 45 1 Reject

-----------------------------------(1 mark)-----------------------------------(1 mark)------


[4]

(b) – (modulo 11) check digit calculation [1]

(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]

© Cambridge International Examinations 2015

Page 52
Page 4 Mark Scheme Syllabus Paper
Cambridge IGCSE – October/November 2015 0478 21

Section B

2 One mark for each error identified + suggested correction


line 4 or (Total =) Total + 1: this should read (Total =) Total + Num
line 5 or Counter = Counter + 1: delete this line
line 6 or (Average = )Total / Counter: swap lines 6 and 7
line 6 or (Average = )Total / Counter : this should read (Average =) Total / 50
[4]

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

(1 mark) (1 mark) (1 mark)

Number 2 Trace table


X Posn New T1 T2 Output

12 1 0

10 0 6 0

6 100 0 3 0

3 1000 100 1 1

1100

1100

(1 mark) (1 mark) (1 mark)


[6]

(b) Converts a (denary) number to binary [1]

© Cambridge International Examinations 2015

Page 68
Page 4 Mark Scheme Syllabus Paper
Cambridge IGCSE – October/November 2015 0478 23

Section B

2 One mark for each error identified + suggested correction


line 5 or IF Num < 0: this should read IF Num > 0 (THEN Total = Total + Num)

line 6 or (IF Num > 0 ) THEN Counter = Counter + 1:


this should read (IF Num > 0 THEN)Poscount = Poscount + 1

line 7 Average = Total/Poscount: this should come after the end of the repeat loop

line 9 or PRINT Num: this should read PRINT Average [4]

3 (a) Number 1 Trace Table


X T1 T2 Output

37 2 5 5

2 2

 (1 mark)  (1 mark) 

Number 2 Trace Table


X T1 T2 Output

191 11 15 F

11 B

 (1 mark)  (1 mark)  [4]

(b) – convert a denary number to hexadecimal


– and output it in reverse order [2]

4 (a) (i) Normal

(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]

© Cambridge International Examinations 2015

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]

6 (a) – all (fields) have (1 mark) duplicate entries (1 mark)

– none (of the fields) (1 mark) have unique entries(1 mark)


[2]

(b) – e.g. StaffNumber ….

– ….. Uniquely identifies each member of staff//no duplicates//different for each member of
staff
[2]

© Cambridge International Examinations 2016

Page 100

You might also like