Note AcademyNote Academy

Computer Science · Oct / Nov 2021 · Paper 22 · Question 5

0478

As printed in the paper

The question as text

The flowchart represents an algorithm. The algorithm will terminate if –1 is entered at the List input. START List1 ← 0 List2 ← 0 END INPUT List Yes No No No No Yes Yes Yes INPUT Value OUTPUT "Input Error" OUTPUT "List 1 = ", List1 OUTPUT "List 2 = ", List2 IS List = –1 ? IS List = 1 ? IS List = 2 ? OUTPUT "List 2 is greatest" OUTPUT "List 1 is greatest" IS List1 > List2 ? List2 ← List2 + Value List1 ← List1 + Value 11 Complete the trace table for the algorithm using this input data: 2, 77, 2, 16, 1, 35, 2, –7, 5, 18, 1, 11, 1, 12, 2, 20, –1, 18 List Value List1 List2 OUTPUT [5]

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme

One mark for each correct column

List

Value

List1

List2

OUTPUT

0

0

2

77

77

2

16

93

1

35

35

2

-7

86

5

List

Value

List1

List2

OUTPUT

18

Input Error

1

11

46

1

12

58

2

20

106

-1

List 1 = 58

List 2 = 106

List 2 is greatest

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.