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.
Practise AQA GCSE Computer Science Programming concepts with exam-style questions for GCSE Computer Science. 100 questions, matched to the AQA GCSE Computer Science (8525) 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.