Designing, creating and refining algorithms
4
0/4

A network administrator writes a program to calculate and print the total data transferred (in TB) by Storage Rack 4 over 12 drive bays (represented by indices 0 to 11) from a 2D array called storageLog.

totalData = 0
totalData = totalData + storageLog[4, 0]
totalData = totalData + storageLog[4, 1]
totalData = totalData + storageLog[4, 2]
totalData = totalData + storageLog[4, 3]
totalData = totalData + storageLog[4, 4]
totalData = totalData + storageLog[4, 5]
totalData = totalData + storageLog[4, 6]
totalData = totalData + storageLog[4, 7]
totalData = totalData + storageLog[4, 8]
totalData = totalData + storageLog[4, 9]
totalData = totalData + storageLog[4, 10]
totalData = totalData + storageLog[4, 11]
print(totalData)

Refine the program to make it more efficient by using a loop. Write the refined version of the algorithm.

You must use either:

  • OCR Exam Reference Language, or
  • a high-level programming language that you have studied.
[4]

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