Skip to content
MathsGenie logo
Open app

Course home

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

Computational thinking

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637
Question 28

Here is a pseudo-code algorithm designed to calculate the forecasted server load scaling for an online platform over a 5-hour launch window.

2  # Expected loads over 5 hours post-launch
3  SET hourNumber TO ["+1", "+2", "+3", "+4", "+5"]
4  SET loadScaling TO [115, 130, 145, 160, 180]
5  SET goodInput TO False
6
7  # Validate base load capacity
8  WHILE (goodInput = False) DO
9      SEND "Enter the baseline server capacity (min 500): " TO DISPLAY
10     RECEIVE baseCapacity FROM (INTEGER) KEYBOARD
11
12     IF (baseCapacity >= 500) THEN
13         SET goodInput TO True
14         SEND "Baseline capacity recorded: " & baseCapacity TO DISPLAY
15     ELSE
16         SEND "Invalid baseline capacity" TO DISPLAY
17     END IF
18 END WHILE
19
20 # Calculate hourly scaling requirements
21 FOR i FROM 0 TO (LENGTH(hourNumber)-1)
22     SET scaleFactor TO loadScaling[i] / 100
23     SET forecastedLoad TO baseCapacity * scaleFactor
24     SEND "Hour " & hourNumber[i] & " forecast: " & forecastedLoad TO DISPLAY
25 END FOR

Complete the trace table to show the execution of lines 21 to 25 of the pseudo-code for the event iteration where i = 2 when the user enters the value 800 at line 10.

baseCapacityiLENGTH(hourNumber)scaleFactorloadScaling[i]forecastedLoad
[6]

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking