LCASE: converting to lower case

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

LCASE: converting to lower case

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does LCASE('W') return?
A 'w'
B 'W'
2. Which line correctly converts a STRING called Name to lower case?
A LCASE Name
B LCASE(Name)
3. Name ← "HELLO" then OUTPUT LCASE(Name). What does Name hold after this?
A "HELLO"
B "hello"
4. Which statement actually changes the stored value of Name to lower case?
A LCASE(Name)
B Name ← LCASE(Name)
5. What does LCASE("Hi There") return?
A "hi there"
B "hi There"

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1LCASE("HELLO") AThe argument is missing its brackets. It should be LCASE("HELLO").
2LCASE('W') BReturns the string "hello" with every letter in lower case
3LCASE does not change the original variable unless the result is assigned back to it CAnswer ← LCASE(Reply)
4LCASE is the opposite of UCASE: it converts text to lower case instead of upper case DReturns the CHAR 'w'
5LCASE(Name) OUTPUT Name EThe result of LCASE is thrown away, so Name is unchanged and OUTPUT shows the original text. It should be Name ← LCASE(Name).
6Word ← LCASE "HELLO" FName ← LCASE(Name)

Definitions

LCASE(Text)

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
OUTPUT _____("Hi")
2.
Big ← UCASE(Word) Small ← _____(Word)
3.
Name _ LCASE(Name)
4.
DECLARE Word : STRING Word ← "HELLO" OUTPUT LCASE(____)
5.
DECLARE Initial : ____ Initial ← LCASE('W')

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A DECLARE Word : STRING
B Word ← "HELLO"
C OUTPUT LOWER(Word)
Question 2
A DECLARE Letter CHAR
B Letter ← 'W'
C OUTPUT LCASE(Letter)
Question 3
A Name ← 'ANNA'
B Small ← LCASE(Name)
C OUTPUT Small
Question 4
A DECLARE Text : STRING
B Text ← Hello World
C Text ← LCASE(Text)
D OUTPUT Text
Question 5
A DECLARE Code : STRING
B Code ← "ABC"
C LCASE(Code) ← Code
D OUTPUT Code

Answer Key

LCASE: converting to lower case
Section A: Quick Questions
Q1
A — 'w'
Q2
B — LCASE(Name)
Q3
A — "HELLO"
Q4
B — Name ← LCASE(Name)
Q5
A — "hi there"
Section B: Match the Pairs
Q1
LCASE("HELLO") → Returns the string "hello" with every letter in lower case
Q2
LCASE('W') → Returns the CHAR 'w'
Q3
LCASE does not change the original variable unless the result is assigned back to it → Name ← LCASE(Name)
Q4
LCASE is the opposite of UCASE: it converts text to lower case instead of upper case → Answer ← LCASE(Reply)
Q5
LCASE(Name) OUTPUT Name → The result of LCASE is thrown away, so Name is unchanged and OUTPUT shows the original text. It should be Name ← LCASE(Name).
Q6
Word ← LCASE "HELLO" → The argument is missing its brackets. It should be LCASE("HELLO").
Section C: Definitions
Q1
LCASE(Text) — Returns the text with every character in lower case, e.g. LCASE("Hi") gives "hi". The original variable is unchanged unless you assign the result to it.
Section D: Fill in the Blanks
Q1
OUTPUT LCASE("Hi")
Q2
Big ← UCASE(Word) Small ← LCASE(Word)
Q3
Name ← LCASE(Name)
Q4
DECLARE Word : STRING Word ← "HELLO" OUTPUT LCASE(Word)
Q5
DECLARE Initial : CHAR Initial ← LCASE('W')
Section E: Spot the Error
Q1
C — Cambridge pseudocode has no LOWER function. The function that converts to lower case is LCASE, so the line should be OUTPUT LCASE(Word).
Q2
A — A DECLARE statement needs a colon between the identifier and the data type. It should be DECLARE Letter : CHAR.
Q3
A — Single quotes are for a single CHAR. A STRING such as ANNA needs double quotes, so it should be Name ← "ANNA".
Q4
B — A string literal must be inside double quotes. Without them Hello World is not a valid value. It should be Text ← "Hello World".
Q5
C — The ← operator assigns the value on its right to the variable on its left. The variable must be on the left, so it should be Code ← LCASE(Code).