Designing, creating and refining algorithms
15
0/4

This algorithm calculates the loyalty points a customer receives when recycling plastic at a smart deposit point:

01  weight = input("Enter weight")
02  isVIP = input("Is customer VIP? (Y/N)")
03  if weight >= 15.0 then
04      points = 5
05  elseif weight >= 5.0 then
06      points = 3
07  else
08      points = 1
09  endif
10  if isVIP == "Y" then
11      points = points + 3
12  endif
13  print("Points awarded:", points)

Complete the trace table for the algorithm when a customer recycles a weight of 8.5 and has VIP status input as "Y".

You may not need to use all the rows in the table.

Line numberweightisVIPpointsOutput
[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