Designing, creating and refining algorithms
26
0/2

A delivery company has six delivery vans numbered from 0 to 5.

The number of packages currently loaded into each van is stored in an array named packages.

The index of the packages array represents the van number.

Array packages

Index012345
Data12581507

The following program is intended to calculate and output the total number of packages across all vans.

for index = 1 to 5
    total = 0
    total = total + packages[index]
next index
print(total)

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