Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Develop code

EasyMediumHard
123456789101112131415161718192021222324
Question 2

There are multiple errors in the pseudocode in Figure 1.

Write the correct code for line 08

Figure 1

LinePseudocode
01
02SET temps TO [12, -3, 15, 0, -1, 14, 2]
03
04SET freezing TO 0
05SET standard TO 0
06SET index TO 0
07
08WHILE NOT (index > LENGTH(temps)) DO
09
10IF temps[index] < 0 THEN
11SET freezing TO temps[index]
12ELSE
13IF temps[index] >= 0 THEN
14SET standard TO standard + 1
15END IF
16END IF
17
18SET index TO index + 1
19
20END WHILE
21
22SEND "Freezing: " & freezing TO DISPLAY
23SEND "Total: " & (freezing + standard) TO DISPLAY
[1]

Develop code Questions

  1. IGCSE
  2. /Computer Science
  3. /Develop code