Question 2(b) 2014 · October-November · Paper 21 · 8 marks
Reveal official mark-scheme answer

Official answer for Question 2
Part (b)
Part (b)
FUNCTION FindPassword(ThisUserID : STRING) RETURNS STRING
Question 21
Show text version of question
Question 2
Part (b)
Question 2
Ali sets up user IDs and passwords for his program. When the user types in their user ID, the program looks up the stored password for this user ID. The stored password is the encrypted version of the user’s password.
Part (b)
Ali uses a sequential file of records to store the user IDs and encrypted passwords.
When a user types in their User ID, the program calls a function, FindPassword, with parameter ThisUserID. The function searches each record in the file for ThisUserID and returns the encrypted password. If ThisUserID is not stored in the file, the function returns an error code. Complete the pseudocode: FUNCTION FindPassword(ThisUserID : STRING) RETURNS ................. DECLARE Found : BOOLEAN OPENFILE FOR INPUT // for reading Found ← FALSE WHILE ........................................................... FILEREAD next record IF ............................................................ THEN ......................................................... ENDIF ENDWHILE IF .............................................................. THEN ........................................................... ELSE ........................................................... ENDIF CLOSEFILE ENDFUNCTION
Question 8
Why this question appears here
72% assigned-topic match · Data types and structures › Data types and records
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9691_w14_qp_21.pdf
