An administrator is writing an algorithm to validate the length of a new password. The password must be between 8 and 20 characters, inclusive.
Figure 1
1 validLength ← False
2 REPEAT
3 OUTPUT 'Enter your password length:'
4 pLength ← USERINPUT
5 IF pLength < 8 THEN
6 OUTPUT 'Error: Password must be at least 8 characters.'
7 ELSE
8 IF pLength < 20 THEN
9 OUTPUT 'Error: Password must be at most 20 characters.'
10 ELSE
11 validLength ← True
12 ENDIF
13 ENDIF
14 UNTIL validLength = True
Describe how the logic error on line 8 can be corrected.
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.