Skip to main content
A-LevelComputer ScienceProgramming ConceptsMay/June 2022Paper 2 Q821 Marks

A program allows a user to save passwords used to login to websites. A stored password is inserted automatically when the user logs into the corresponding website. A student is developing a program to generate a password. The password will be of a fixed format, consisting of three groups of four alphanumeric characters. The groups are separated by the hyphen character '-'. An example of a password is: "FxAf-3haV-Tq49" A global 2D array Secret of type STRING stores the passwords together with the website domain name where they are used. Secret contains 1000 elements organised as 500 rows by 2 columns. Unused elements contain the empty string (""). These may occur anywhere in the array. An example of a part of the array is: Array element | Value ---|--- Secret [27, 1] | "www.thiswebsite.com" Secret [27, 2] | "............." Secret [28, 1] | "www.thatwebsite.com" Secret [28, 2] | "............." Note: • For security, passwords are stored in an encrypted form, shown as "............." in the example. • The passwords cannot be used without being decrypted. • Assume that the encrypted form of a password will not be an empty string. The programmer has started to define program modules as follows: Module | Description ---|--- RandomChar() | • Generates a single random character from within one of the following ranges: | ◦ 'a' to 'z' | ◦ 'A' to 'Z' | ◦ '0' to '9' | • Returns the character Encrypt() | • Takes a password as a parameter of type string | • Returns the encrypted form of the password as a string Decrypt() | • Takes an encrypted password as a parameter of type string | • Returns the decrypted form of the password as a string For reference, relevant ASCII values are as follows: Character range | ASCII range ---|--- 'a' to 'z' | 97 to 122 'A' to 'Z' | 65 to 90 '0' to '9' | 48 to 57

✓ Correct Answer

The correct answer is . This question tests the candidate's understanding of programming concepts within the Computer Sciencesyllabus. The examiner's mark scheme requires...

📋 Examiner Report & Trap Analysis

Common mistake: 62% of candidates selected the distractor because they confused... The examiner specifically designed this question to test whether students can differentiate between... To secure full marks, candidates must demonstrate...

🔒

Unlock the Examiner's Answer

Sign up for free to reveal the correct answer, the official mark scheme breakdown, and the examiner trap analysis for this question.

Sign Up Free to Unlock →

Join thousands of Cambridge students already using Oracle Prep

About This A-Level Computer Science Question

This structured question appeared in the Cambridge A-Level Computer Science (9618) May/June 2022 examination, Paper 2 Variant 1. It tests the topic of Programming Concepts and is worth 21 marks.

Oracle Prep provides AI-powered practice for all Cambridge O-Level and A-Level subjects. Our platform includes topic predictions with 87.7% accuracy, AI essay grading, and a comprehensive question bank spanning 25 years of past papers.

© 2026 Oracle Prep — The AI-Powered Cambridge Exam Engine