Skip to main content
O-LevelComputer ScienceAlgorithm design and problem-solving2210/21 · May/June 2025 · Q48 Marks

A telephone number with 13 characters is input. The first character is a '+', followed by a 2-digit country code, for example: +20XXXXXXXXXxx where 20 is the country code and x is a digit between 0 and 9 inclusive. The algorithm includes checks for the country codes: 44 for the UK and 20 for Egypt.

  1. (a)Write an algorithm using pseudocode to: • input the telephone number • extract the 2-digit country code • output the matching country • output 'Unknown' if there is no matching country.[5]
  2. (b)Explain how you could change the algorithm to repeatedly prompt for the telephone number until the number entered is 13 characters in length. Any code used must be fully explained.[3]

Mark scheme

Marking points from the official mark scheme (May/June 2025). The mark or mark type is shown in brackets.

  1. [1] (a) Correct input of number
  2. [1] (a) Use of substring()
  3. [1] (a) ...to extract the correct number
  4. [1] (a) Correct use of IF statements/Case statement with matching END IF /END CASE
  5. [1] (a) Output of matching locations
  6. [1] (a) Output of unknown
  7. Example (a): OUTPUT "Please enter a telephone number " INPUT Telephone Value ← SUBSTRING(Telephone, 2, 2) IF Value = "44" THEN OUTPUT "UK" ELSE IF Value = "20" THEN OUTPUT "Egypt" ELSE OUTPUT "Unknown" ENDIF ENDIF
  8. [1] (b) Find length of input.
  9. [1] (b) Use a suitable loop (repeat/while).
  10. [1] (b) Using the correct condition
  11. [1] (b) Prompt for a 13-digit telephone number and input number inside loop.

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
Algorithm design and problem-solving, O-Level Computer Science (syllabus 2210). Structured question, 8 marks.
Source
O-Level Computer Science, May/June 2025 Paper 2 Variant 1, question 4.

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