Question 6
AQA Computer Science June 2023 Paper 1C (8525/1C)GCSE4 marks
On the specification
- 3.2 Programming
Question text
6 Figure 5 shows an algorithm represented using pseudo-code. box The algorithm is for a simple authentication routine. The pseudo-code uses a subroutine getPassword to check a username: • If the username exists, the subroutine returns the password stored for that user. • If the username does not exist, the subroutine returns an empty string. Parts of the algorithm are missing and have been replaced with the labels to . Figure 5 login False REPEAT username '' WHILE username = '' OUTPUT 'Enter username: ' username ENDWHILE password '' WHILE password = '' OUTPUT 'Enter password: ' password USERINPUT ENDWHILE storedPassword getPassword( ) IF storedPassword = THEN OUTPUT ' ' ELSE IF password = storedPassword THEN login True ELSE OUTPUT 'Try again.' ENDIF ENDIF UNTIL login = True OUTPUT 'You are now logged in.' Figure 6 -1 OUTPUT 0 username True SUBROUTINE 1 User not found '' USERINPUT password Wrong password State the items from Figure 6 that should be written in place of the labels in the algorithm in Figure 5. You will not need to use all the items in Figure 6. [4 marks]