Skip to main content
O-LevelComputer ScienceProgramming2210/23 · Oct/Nov 2024 · Q109 Marks

An algorithm has been written in pseudocode to check that a password meets a set of rules. 01 OUTPUT "Please enter password " 02 INPUT Password 03 Accept ← TRUE 04 IF LENGTH(Password) < 8 OR LENGTH(Password) > 20 05 THEN 06 Accept ← FALSE 07 ENDIF 08 IF LCASE(Password) = Password OR UCASE(Password) = Password 09 THEN 10 Accept ← FALSE 11 ENDIF 12 Index ← 1 13 Found ← FALSE 14 WHILE NOT Found AND Accept AND Index < LENGTH(Password) 15 IF SUBSTRING(Password, Index, 1) = '!' 16 THEN 17 Found ← TRUE 18 ENDIF 19 Index ← Index + 1 20 ENDWHILE 21 IF NOT Found 22 THEN 23 Accept ← FALSE 24 ENDIF 25 IF Accept 26 THEN 27 OUTPUT "Accepted" 28 ELSE 29 OUTPUT "Rejected" 30 ENDIF

  1. (a)Complete the three trace tables using the data shown for each one. Data: MYWORD Password Accept Index Found OUTPUT Data: M!word Password Accept Index Found OUTPUT Data: My!Hidden Password Accept Index Found OUTPUT[6]
  2. (b)State the rules that the password must meet.[3]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.

  1. [6] (a) For each trace table, one mark Password and output, one mark Accept, Index and Found columns
  2. (a) MYWORD Trace Table: Password: MYWORD Accept: TRUE, FALSE, FALSE, FALSE Index: (blank), (blank), 1, (blank) Found: (blank), (blank), FALSE, (blank) OUTPUT: (Please enter password), (blank), (blank), Rejected
  3. (a) M!word Trace Table: Password: M!word Accept: TRUE, FALSE, FALSE, FALSE Index: (blank), (blank), 1, (blank) Found: (blank), (blank), FALSE, (blank) OUTPUT: (Please enter password), (blank), (blank), Rejected
  4. (a) My!Hidden Trace Table: Password: My!Hidden Accept: TRUE, TRUE, TRUE, TRUE, TRUE, TRUE Index: (blank), (blank), 1, 2, 3, 4 Found: (blank), (blank), FALSE, FALSE, TRUE, TRUE OUTPUT: (Please enter password), (blank), (blank), (blank), (blank), Accepted
  5. [3] (b) One mark for each correct point
  6. (b) maximum length 20 characters and minimum length 8 characters
  7. (b) cannot be all upper-case letters or all lower-case letters // must contain upper-case and lower-case letters
  8. (b) must contain an !

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 →

About this question

Topic
Programming, O-Level Computer Science (syllabus 2210). Structured question, 9 marks.
Source
O-Level Computer Science, Oct/Nov 2024 Paper 2 Variant 3, question 10.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep