OCR J277 · Computational thinking, algorithms and programming
Data types and conversion revision
Choose suitable integer, real, Boolean, character and string types and convert inputs deliberately.
What to know about data types and conversion
Types describe values and operations
Integers are whole numbers; real values can include a fractional part. A Boolean represents true or false. A character is one symbol; a string is a sequence of characters and may be empty. Choosing an appropriate type helps a program perform meaningful operations and represent its data correctly.
Identifiers are not always quantities
A route code such as 0074 may contain only digits but should often be a string: leading zeros matter and arithmetic is not needed. A count of people is normally an integer. A measured mass may require a real. A flag such as isOpen is naturally Boolean rather than the text word true.
Focus areas: Data types and conversion.
Test yourself: questions and answers
Answer each prompt from memory before opening the explanation. These 4 samples come from this topic's 8 original retrieval cards.
Which type is most suitable for the number of parcels?
Integer.
Which type normally suits a mass measured as 2.75 kg?
Real.
What values can a Boolean represent?
True or false.
How does a character differ from a string?
A character is one symbol; a string is a sequence of characters.
Turn this topic into a revision session
- Explain one idea without looking at the notes.
- Compare your answer with the guidance and identify the missing link.
- Apply it in a question or short program, then revisit it after a delay.
Free accounts choose one revision topic pack. Pro includes all 26 packs in this course and both published qualifications. Public samples and coding practice are free; PDF guides are separate purchases.
Create a free accountSpecification and sources
Check the required scope against the official OCR J277 specification (PDF). RecallStride's explanations and examples are independent learning resources. See our editorial policy or report a correction, including the topic code and statement concerned.