A pseudocode algorithm that monitors network server latency readings is shown below.
The first four inputs read from the file LatencyLog.txt are 145, 82, 310, and 195 in that order.
Complete the trace table showing the execution of the pseudocode with these four inputs. You may not need to use all the rows in the table.
1 SET latency TO 0
2 SET min_lat TO 999
3 SET max_lat TO 0
4
5 FOR EACH latency FROM "LatencyLog.txt" DO
6 IF (latency < min_lat) THEN
7 SET min_lat TO latency
8 ENDIF
9 IF (latency > max_lat) THEN
10 SET max_lat TO latency
11 ENDIF
12 END FOREACH
13
14 SEND min_lat & " - " & max_lat TO DISPLAY
| latency | min_lat | max_lat | Display |
|---|---|---|---|
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.