← IGCSE Computer Science Paper 2

UCASE and LCASE functions

UCASE returns a string or character in upper case, e.g. UCASE("Happy") gives "HAPPY". LCASE returns it in lower case, e.g. LCASE('W') gives 'w'.

Understanding UCASE and LCASE functions in IGCSE Computer Science Paper 2

What it does: Converting the input with UCASE means only one upper case value needs to be compared, whatever case the user typed. LCASE returns the lower case version of Name, and the assignment saves it in the variable LowerName. Keywords and function names in Cambridge pseudocode are written in capital letters, so it is LCASE, not lcase. UCASE and LCASE let you compare answers regardless of case. They do not check data types, which is the job of a type check. UCASE never makes lower case. Letters that are already capitals stay as capitals. UCASE converts all the letters of the string it is given into capital letters.

Common mistakes: A string of several characters must be written in double quotes. Single quotes are only for a single CHAR. It should be Word ← "Happy". LCASE makes the answer lower case, so it can never equal "YES". To compare with "YES" the answer must be converted with UCASE(Answer).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 37–46) and word search (Modules 27–46).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does UCASE("Happy") return?
"happy""HAPPY"
Matches
IF UCASE(Answer) = "yes" THEN
↓
UCASE makes Answer all capitals, so it can never equal the lower case text "yes". The comparison is always false. It should be "YES".
Applying
Meanings
Term
UCASE(x) and LCASE(x)
Meaning
UCASE returns a string or character in upper case, e.g. UCASE("Happy") gives "HAPPY". LCASE returns it in lower case, e.g. LCASE('W') gives 'w'.
Practice
OUTPUT "Continue? (Y/N)"
Testing
Gaps
OUTPUT ("Happy")
Check Answer
Spots
1Word ← "Happy"
2Word ← 'Happy'

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Moray Eel' badge — Lurking Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does UCASE("Happy") return?
A. "HAPPY" ✓
B. "happy"
UCASE returns the string in upper case, so every letter becomes a capital: "HAPPY".
2. What does LCASE('W') return?
A. 'w' ✓
B. 'W'
LCASE returns the character in lower case, so 'W' becomes 'w'.
3. Which function changes the text "cat" into "CAT"?
A. LCASE("cat")
B. UCASE("cat") ✓
UCASE gives upper case. LCASE would leave "cat" as "cat".
4. Which line of Cambridge pseudocode is written correctly?
A. Answer ← lcase(Reply)
B. Answer ← LCASE(Reply) ✓
Keywords and function names in Cambridge pseudocode are written in capital letters, so it is LCASE, not lcase.
5. A program asks 'Do you want to play again? (Y/N)'. The user types y. Which condition still matches 'Y'?
A. UCASE(Reply) = 'Y' ✓
B. Reply = 'Y'
UCASE changes the typed 'y' to 'Y' before comparing. Without it, 'y' = 'Y' is FALSE because the case is different.

Match the Pairs

UCASE("Happy") → Returns the string "HAPPY" with every letter in upper case
LCASE('W') → Returns the character 'w' in lower case
Make sure an answer typed as "yes", "Yes" or "YES" is treated the same by converting it to upper case before comparing → IF UCASE(Answer) = "YES" THEN
Store a copy of the user's name in lower case so that it can be compared without worrying about capital letters → LowerName ← LCASE(Name)
IF UCASE(Answer) = "yes" THEN → UCASE makes Answer all capitals, so it can never equal the lower case text "yes". The comparison is always false. It should be "YES".
Letter ← LCASE 'K' → The argument must be inside brackets after the function name. It should be LCASE('K').

Key Term

UCASE(x) and LCASE(x)
UCASE returns a string or character in upper case, e.g. UCASE("Happy") gives "HAPPY". LCASE returns it in lower case, e.g. LCASE('W') gives 'w'.

Fill in the Blanks

1. OUTPUT UCASE("Happy")
Hint: Type the function that returns a string in upper case.
2. OUTPUT LCASE('W')
Hint: Type the function that returns a character in lower case.
3. INPUT Answer Shout ← UCASE(Answer) OUTPUT Shout
Hint: Type the variable that holds the text the user entered.
4. INPUT Answer Match ← UCASE(Answer) = "YES" OUTPUT Match
Hint: Type the relational operator that tests whether two values are equal.
5. DECLARE Letter : CHAR Letter ← LCASE('W') OUTPUT Letter
Hint: Type the variable name that stores the lower case character, so it can be output.

Spot the Error

Question 1
A Word ← "Happy"
B Word ← 'Happy'
C OUTPUT Shout
Line B — A string of several characters must be written in double quotes. Single quotes are only for a single CHAR. It should be Word ← "Happy".
Question 2
A INPUT Answer
B Answer ← UCASE(Answer)
C Answer ← LCASE(Answer)
D OUTPUT "Accepted"
E ENDIF
Line C — LCASE makes the answer lower case, so it can never equal "YES". To compare with "YES" the answer must be converted with UCASE(Answer).
Question 3
A Letter ← LCASE 'W'
B OUTPUT Letter
C // Letter is now 'w'
Line A — A function call needs brackets around its argument. It should be Letter ← LCASE('W').
Question 4
A INPUT Code
B Code ← UPPER(Code)
C OUTPUT "Code: ", Code
Line B — UPPER is not a Cambridge pseudocode function. The function that returns upper case is UCASE, so it should be Code ← UCASE(Code).
Question 5
A DECLARE Name : STRING
B Name ← "Zoe"
C OUTPUT UCASE("Name")
Line C — Putting Name in quotes passes the text "Name" to UCASE, so it would output NAME. To output ZOE, pass the variable: OUTPUT UCASE(Name).

Student with a class code? Join your class →