Six original Cambridge-style questions on string handling in 0478 pseudocode, with mark points.
State the purpose of the string operations LENGTH and SUBSTRING.
Text ← "Data Science". State what is returned by (a) LENGTH(Text) (b) SUBSTRING(Text, 6, 3) (c) UCASE(SUBSTRING(Text, 1, 4)).
Write pseudocode that inputs a person's first name and outputs its first letter in upper case and the number of letters in the name.
INPUT FirstName ✓Initial ← UCASE(SUBSTRING(FirstName, 1, 1)) ✓OUTPUT Initial ✓OUTPUT LENGTH(FirstName) ✓Write pseudocode that inputs a sentence and outputs the number of words, assuming words are separated by single spaces.
Spaces ← 0 and INPUT Sentence ✓FOR Index ← 1 TO LENGTH(Sentence) ✓IF SUBSTRING(Sentence, Index, 1) = " " THEN Spaces ← Spaces + 1 ✓OUTPUT Spaces + 1 ✓A login program compares the username typed with the stored username "SMITH". A user types smith and is rejected. Explain why and how to fix it.
A student wants characters 3 to 6 of Word and writes SUBSTRING(Word, 3, 6). Explain the error and correct it.
SUBSTRING(Word, 3, 4). ✓Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.