Skip to main content
O-LevelComputer ScienceProgramming2210/22 · Oct/Nov 2024 · Q96 Marks

The function LENGTH(X) calculates the length of a string X Write the pseudocode statements to: • allow a line of text to be input to an appropriate variable • store this line of text in a text file called Main.txt • calculate the length of the line of text and output the text in lower case along with its length • store the lower-case line of text in a text file called Lowercase.txt Make sure that any variables used are declared and that both text files are closed after they have been used.

  1. (a)The function LENGTH(X) calculates the length of a string X Write the pseudocode statements to: • allow a line of text to be input to an appropriate variable • store this line of text in a text file called Main.txt • calculate the length of the line of text and output the text in lower case along with its length • store the lower-case line of text in a text file called Lowercase.txt Make sure that any variables used are declared and that both text files are closed after they have been used.[6]

Mark scheme

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

  1. [1] Declaration of appropriate string variable(s)
  2. [1] Input of a line of text
  3. [1] Correct use of LCASE
  4. [1] Correct use of LENGTH
  5. [1] Opening of at least one of the required text files using given names (Main.txt, Lowercase.txt)
  6. [1] Storing of correct line of text to Main.txt
  7. [1] Storing of correct lines to Lowercase.txt
  8. [1] Closing of both text files
  9. [1] Correct output

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, 6 marks.
Source
O-Level Computer Science, Oct/Nov 2024 Paper 2 Variant 2, question 9.

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