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 |
|---|---|---|---|
Practise Edexcel GCSE Computer Science Algorithms with exam-style questions for GCSE Computer Science. 100 questions 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, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 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.