Skip to content

Course home

Algorithms

Algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
Question 33

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
latencymin_latmax_latDisplay
[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