OCR GCSE Computer Science J277
Systems Architecture
Memory and Storage
Computer Networks, Connections and Protocols
Network Security
Systems Software
Ethical, Legal, Cultural and Environmental Impacts of Digital Technology
Algorithms
Programming Fundamentals
Producing Robust Programs
Programming Languages and Integrated Development Environments
Programming Fundamentals
Data types and casting
- 3 things to know
- J277/02
Overview
Integer, real, Boolean, character and string, choosing the right type for phone numbers, prices and grades, and casting with worked results.
What you need to know
Answer each one before you reveal it.
What is the integer data type?
What is the real data type?
Questions from this subtopic
Each one with the model answer underneath.
- 1
Name five common data types used in programs.
Model answer
Five common data types are integer, real, Boolean, character and string.
- 2
What is the integer data type?
Model answer
An integer is a whole number with no fractional part. Values such as −12, 0 and 450 are integers.
- 3
What is the real data type?
Model answer
A real is a number that can have a fractional part, such as 3.75. Many languages call the real type a float.
- 4
What values can a Boolean hold?
Model answer
A Boolean holds only one of two values, True or False. Booleans suit yes-or-no facts such as whether a door is locked.
- 5
What is the difference between a character and a string?
Model answer
A character is a single letter, digit or symbol, such as "G". A string is a sequence of characters, such as "Go home".
- 6
Which data type should store a UK phone number such as 07700 900123, and why?
Model answer
A phone number should be stored as a string. An integer would lose the leading zero and the space, and no arithmetic is done on a phone number.
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 Fundamentals, 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.