Skip to main content
O-LevelComputer ScienceProgramming2210/22 · May/June 2023 · Q117 Marks

The variables P and Q are used to store data in a program. P stores a string. Q stores a character.

  1. (a)Write pseudocode statements to declare the variables P and Q, store "The world" in P and store 'w' in Q[2]
  2. (b)Write a pseudocode algorithm to: • convert P to upper case • find the position of Q in the string P (the first character in this string is in position 1) • store the position of Q in the variable Position[4]
  3. (c)Give the value of Position after the algorithm has been executed with the data in question 11(a).[1]

Mark scheme

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

  1. [2] One mark for any two correct lines DECLARE P : STRING P ← "The world" DECLARE Q : CHAR Q ← 'W'
  2. [4] One mark for each point (max four) • converting P to upper case • finding the length of P • using a loop to check for position of Q • using the string operation substring • storing the loop counter in Position if the value is found For example: P ← UCASE (P) Counter ← 1 Position ← 0 REPEAT IF SUBSTRING(P, Counter, 1) = Q THEN Position ← Counter ENDIF Counter ← Counter + 1 UNTIL Position <> 0 OR Counter = LENGTH(P)
  3. [1] 5

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, 7 marks.
Source
O-Level Computer Science, May/June 2023 Paper 2 Variant 2, question 11.

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