← IGCSE Computer Science Paper 2

UCASE: converting to upper case

UCASE(x) returns the string or CHAR x with every letter in upper case. UCASE("Happy") returns "HAPPY". The original variable only changes if you assign the result.

Understanding UCASE: converting to upper case in IGCSE Computer Science Paper 2

What it does: Assigning the result back to Name is the only way the stored value becomes upper case. Whether the user types yes, Yes or YES, UCASE turns it into YES before the comparison, so all versions match. Assignment in Cambridge pseudocode uses ←, with the variable on the left and the expression on the right. UCASE works on both a STRING and a CHAR. Converting the input to upper case first means yes, Yes and YES are all treated the same. Only letters change. Digits and spaces stay the same, so the result is "ROOM 7B". UCASE returns a new value and does not change the variable, so the result must be assigned or output directly.

Common mistakes: The Cambridge pseudocode function is UCASE, not UPPER. The line should be OUTPUT UCASE(word). The quotes make this the text "name" instead of the variable. It should be OUTPUT name so the upper case value is shown.

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 337–346) and word search (Modules 337–357).

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
UCASE(Name) OUTPUT Name
↓
The result of UCASE is thrown away, so Name is unchanged and the output is still the original text. Assign it: Name ← UCASE(Name)
Applying
Meanings
Term
UCASE(x)
Meaning
UCASE(x) returns the string or CHAR x with every letter in upper case. UCASE("Happy") returns "HAPPY". The original variable only changes if you assign the result.
Practice
DECLARE Word : STRING
Testing
Gaps
OUTPUT ("Happy")
Check Answer
Spots
2word ← "Happy"
3OUTPUT UPPER(word)

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

The 'Galaxy Phoenix' badge — Orbit Champion, 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 converts every letter to upper case, so "Happy" becomes "HAPPY".
2. Which line stores the upper case version of Name in a variable called Shout?
A. Shout ← UCASE(Name) ✓
B. UCASE(Name) → Shout
Assignment in Cambridge pseudocode uses ←, with the variable on the left and the expression on the right.
3. Name is "zoe". After the line X ← UCASE(Name) what is the value of Name?
A. "zoe" ✓
B. "ZOE"
UCASE returns a new value. Name only changes if the result is assigned back to Name. Here it was assigned to X.
4. Which line changes the variable Name itself to upper case?
A. Name ← UCASE(Name) ✓
B. UCASE(Name)
UCASE(Name) on its own returns a value but stores nothing. You must assign the result back to Name.
5. Letter is a CHAR holding 'q'. Can UCASE be used on it?
A. No, UCASE only works on STRING
B. Yes, UCASE('q') returns 'Q' ✓
UCASE works on both a STRING and a CHAR.

Match the Pairs

UCASE("Happy") → Returns the text "HAPPY" with every letter changed to upper case
Initial ← UCASE('q') → Stores the CHAR 'Q' in Initial because UCASE also works on a single CHAR
UCASE does not change the original variable unless you assign the result back to it → Name ← UCASE(Name)
UCASE makes comparing text fair, because both sides are converted to the same case → IF UCASE(Answer) = "YES" THEN
UCASE(Name) OUTPUT Name → The result of UCASE is thrown away, so Name is unchanged and the output is still the original text. Assign it: Name ← UCASE(Name)
IF Answer = "YES" THEN → If the user types yes or Yes, the comparison fails because the case differs. Use UCASE(Answer) = "YES" to compare fairly.

Key Term

UCASE(x)
UCASE(x) returns the string or CHAR x with every letter in upper case. UCASE("Happy") returns "HAPPY". The original variable only changes if you assign the result.

Fill in the Blanks

1. OUTPUT UCASE("Happy")
Hint: Type the function name that returns text in upper case.
2. Word ← UCASE(Word)
Hint: Type the assignment operator that stores the result back into the variable.
3. DECLARE Letter : CHAR Letter ← 'q' OUTPUT UCASE(Letter)
Hint: Type the variable name holding the CHAR to convert.
4. IF UCASE(Answer) = "YES" THEN OUTPUT "Correct" ENDIF
Hint: Type the function that makes the comparison fair whatever case the user typed.
5. Word ← "Happy" Big ← UCASE(Word) OUTPUT Word
Hint: Type the variable that still holds the original text, because UCASE did not change it.

Spot the Error

Question 1
A DECLARE word : STRING
B word ← "Happy"
C OUTPUT UPPER(word)
Line C — The Cambridge pseudocode function is UCASE, not UPPER. The line should be OUTPUT UCASE(word).
Question 2
A DECLARE name : STRING
B INPUT name
C name ← UCASE(name)
D OUTPUT "name"
Line D — The quotes make this the text "name" instead of the variable. It should be OUTPUT name so the upper case value is shown.
Question 3
A DECLARE letter : INTEGER
B letter ← 'q'
C OUTPUT UCASE(letter)
Line A — The variable stores a single character, so it must be declared as CHAR. An INTEGER cannot hold 'q'.
Question 4
A DECLARE reply STRING
B INPUT reply
C IF UCASE(reply) = "YES" THEN
D OUTPUT "Agreed"
E ENDIF
Line A — A DECLARE statement needs a colon between the identifier and the data type. It should be DECLARE reply : STRING.
Question 5
A DECLARE tag : STRING
B tag ← "go"
C OUTPUT tag
D OUTPUT UCASE tag
Line D — UCASE is a function, so its argument must be inside brackets. It should be OUTPUT UCASE(tag).

Student with a class code? Join your class →