Practice

String Extraction and Lowercase

2023/Oct/Nov·Variant 2·Q7·[5 marks]
MEDIUMString Processing

The string "Learning Never Exhausts The Mind" is stored in a variable Quote.

Write pseudocode to:

  1. Store that string in Quote
  2. Extract and output the last 8 characters ("The Mind")
  3. Output the entire string in lowercase

Source: 2023 Oct/Nov Variant 2 Q7

Input: None — the string is hardcoded in the program. Output: Two lines — The Mind then learning never exhausts the mind

Note: SUBSTRING(str, start, length) returns length characters from position start. The string has 32 characters, so "The Mind" starts at position 25.

Sample Test Cases

Test 1: Fixed string operations
Expected: The Mind learning never exhausts the mind