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.
- (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] Declaration of appropriate string variable(s)
- [1] Input of a line of text
- [1] Correct use of LCASE
- [1] Correct use of LENGTH
- [1] Opening of at least one of the required text files using given names (Main.txt, Lowercase.txt)
- [1] Storing of correct line of text to Main.txt
- [1] Storing of correct lines to Lowercase.txt
- [1] Closing of both text files
- [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 →