An algorithm allows a user to input their password and checks that there are at least eight characters in the password. Then, the user is asked to re-input the password to check that both inputs are the same. The user is allowed three attempts at inputting a password of the correct length and a matching pair of passwords. The pre-defined function LEN (X) returns the number of characters in the string, X 01 Attempt ← 0 02 REPEAT 03 PassCheck ← TRUE 04 OUTPUT "Please enter your password " 05 INPUT Password 06 IF LEN(Password) < 8 07 THEN 08 PassCheck ← TRUE 09 ELSE 10 OUTPUT "Please re-enter your password " 11 INPUT Password2 12 IF Password <> Password 13 THEN 14 PassCheck ← FALSE 15 ENDIF 16 ENDIF 17 Attempt ← Attempt + 1 18 UNTIL PassCheck OR Attempt < 3 19 IF PassCheck 20 THEN 21 OUTPUT "Password success" 22 ELSE 23 OUTPUT "Password fail" 24 ENDIF
- (a)Identify the three errors in the pseudocode and suggest a correction to remove each error. Error 1 Correction Error 2 Correction Error 3 Correction[3]
- (b)The algorithm includes two types of check on the data input. Identify and describe each type of check. Type of check 1 Description Type of check 2 Description[4]
- (c)Give two sets of test data for this algorithm and a reason for choosing each set. Each set of test data and its reason must be different. Set 1 Reason Set 2 Reason[4]
Mark scheme
Marking points from the official mark scheme (May/June 2022). The mark or mark type is shown in brackets.
- [1] • line 8 / PassCheck ← TRUE correction PassCheck ← FALSE
- [1] • line 12/IF Password <> Password correction IF Password2 <> Password // IF Password <> Password2
- [1] • line 18/ UNTIL PassCheck OR Attempt < 3 correction UNTIL PassCheck OR Attempt = 3 / UNTIL PassCheck OR Attempt >= 3
- [1] Check: validation // length check
- [1] Description length check // checks number of characters in password
- [1] Check: verification // double entry
- [1] Description double entry // comparison that two inputs are the same
- [1] Set 1 - any appropriate example e.g. "small"
- [1] Reason must follow through from the password given e.g. abnormal data will be rejected
- [1] Set 2 - any different appropriate example e.g. “password” and “password”
- [1] Reason must be different and follow through from the password given e.g. normal data will be accepted
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →