Cambridge IGCSE Computer Science 0478
Data Representation
Data Transmission
Hardware
Software
The Internet and Its Uses
Automated and Emerging Technologies
Algorithm Design and Problem-Solving
Programming
Programming
Totalling, counting and string handling
- 3 things to know
- Paper 2
Overview
Running totals and counters, and the LENGTH, SUBSTRING, UCASE and LCASE functions.
What you need to know
Answer each one before you reveal it.
Write the pseudocode statement that adds one to a counter
What does the LENGTH function return?
Questions from this subtopic
Each one with the model answer underneath.
- 1
Write the pseudocode statement that adds a price to a running total.
Model answer
The running total is updated with Total ← Total + Price.
- 2
Write the pseudocode statement that adds one to a counter.
Model answer
A counter variable called Count is increased by one with Count ← Count + 1.
- 3
What does the LENGTH function return?
Model answer
The LENGTH function returns the number of characters in a string, so LENGTH("Happy Days") returns 10.
- 4
What does the SUBSTRING function return?
Model answer
SUBSTRING returns part of a string, given the start position and length. SUBSTRING("Happy Days", 1, 5) returns "Happy".
- 5
What do UCASE and LCASE do?
Model answer
UCASE converts a string or character to upper case. LCASE converts a string or character to lower case.
- 6
Why are UCASE or LCASE useful when checking an answer?
Model answer
Converting the input to one case means answers such as Yes, YES and yes are all accepted.
Other ways to work this
The same content, four other ways.
Everything in your subscription
Runs, plus a mode for every other kind of session.
Every question in Programming, on a schedule.
Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.