Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
Question 57

An engineer reviews the smart home control algorithm shown in Figure 1 and makes the following statement:

"Currently, if the user enters 'arm' instead of 'armed' when prompted, they will sometimes get unexpected results. This design flaw could have been easily prevented."

Explain why this problem has occurred and describe what would happen if a user entered 'arm' instead of 'armed' when prompted at line 2.

You may include references to line numbers in the algorithm where appropriate. You do not need to write or correct any of the pseudocode.

Figure 1

1  OUTPUT 'Is the security system armed?'
2  systemStatus ← USERINPUT
3  IF systemStatus = 'armed' THEN
4      OUTPUT 'Is the entry door sensor active?'
5      sensorStatus ← USERINPUT
6      IF sensorStatus = 'active' THEN
7          OUTPUT 'Trigger primary alarm'
8      ELSE
9          OUTPUT 'System secure - monitoring'
10     ENDIF
11 ELSE
12     OUTPUT 'Do you want to arm the system now?'
13     armNow ← USERINPUT
14     IF armNow = 'armed' THEN
15         OUTPUT 'System arming sequence initiated'
16     ELSE
17         OUTPUT 'System remains disarmed'
18     ENDIF
19 ENDIF
[3]
Markscheme

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts

298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank