Designing, creating and refining algorithms
16
0/2

A server room contains eight server racks numbered from 0 to 7.

The power consumption (in kilowatts) of each rack is stored in an array named power_draw.

The index of the power_draw array represents the rack number.

Array power_draw

Index01234567
Data4.23.85.56.10.04.93.25.0

The following program is intended to calculate and output the total power consumption across all server racks.

for index = 1 to 7
    total_power = 0
    total_power = total_power + power_draw[index]
next index
print(total_power)

When tested, the program is found to contain two logic errors.

Describe how the program can be refined to remove these logic errors.

[2]

Designing, creating and refining algorithms Questions

Practise OCR GCSE Computer Science Designing, creating and refining algorithms with exam-style questions for GCSE Computer Science. 50 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Designing, creating and refining algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Designing, creating and refining algorithms