Skip to content

Course home

Algorithms

Algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
Question 48

Here is a pseudo-code algorithm designed to monitor the expected water flow rate output across 6 stages of a desalination filtration system.

1  # Processing flow rate efficiency across 6 stages
2  SET stageCode TO ["S1", "S2", "S3", "S4", "S5", "S6"]
3  SET efficiencyFactor TO [105, 95, 80, 65, 50, 30]
4  SET validFlow TO False

6  # Validate initial flow rate
7  WHILE (validFlow = False) DO
8      SEND "Enter the initial flow rate (min 1200): " TO DISPLAY
9      RECEIVE initialFlow FROM (INTEGER) KEYBOARD
10
11     IF (initialFlow >= 1200) THEN
12         SET validFlow TO True
13         SEND "Initial flow rate verified: " & initialFlow TO DISPLAY
14     ELSE
15         SEND "Invalid flow rate" TO DISPLAY
16     END IF
17 END WHILE
18
19 # Calculate expected output flow for each stage
20 FOR i FROM 0 TO (LENGTH(stageCode)-1)
21     SET multiplier TO efficiencyFactor[i] / 100
22     SET expectedOutput TO initialFlow * multiplier
23     SEND "Stage " & stageCode[i] & " output: " & expectedOutput TO DISPLAY
24 END FOR

Complete the trace table to show the execution of lines 20 to 24 of the pseudo-code for the iteration where i=3i = 3i=3 when the user enters the value 1600 at line 9.

initialFlowiLENGTH(stageCode)multiplierefficiencyFactor[i]expectedOutput
[6]
Markscheme

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms

159 exam-style questions on Edexcel GCSE Computer Science Algorithms, covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank