Representing algorithms

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
Question 39
Easy

An algorithm is used to troubleshoot a smart home thermostat. The pseudocode for this algorithm is shown below:

1  OUTPUT 'Is the green LED flashing?'
2  response ← USERINPUT
3  IF response = 'yes' THEN
4      OUTPUT 'Is the router connected to the Internet?'
5      response ← USERINPUT
6      IF response = 'no' THEN
7          OUTPUT 'Replace device'
8      ELSE
9          OUTPUT 'Restart the router'
10     ENDIF
11 ELSE
12     OUTPUT 'Is the power cable damaged?'
13     response ← USERINPUT
14     IF response = 'yes' THEN
15         OUTPUT 'Replace device'
16     ELSE
17         OUTPUT 'Plug into a different socket'
18     ENDIF
19 ENDIF

The phrase 'Replace device' appears twice in this algorithm.

State the two possible sequences of user inputs (consisting of 'yes' or 'no') that would result in 'Replace device' being output.

[2]

Representing algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Representing algorithms