Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Paper 2/Data Types

Data types

The use of data types

2.2.2 Data Types

Practise exam questions

Data Types — Note 1 of 2

Integer, Real/Float, Boolean, Character and String

What you need to know

A data type defines what kind of data a variable can hold and what operations can be performed on it. The five main data types are integer (whole numbers), real/float (decimals), Boolean (True/False), character (a single symbol), and string (a sequence of characters). Choosing the correct data type ensures efficient storage and correct processing.

What to know

  • Integer (`int`): whole numbers with no decimal point, e.g. 5, -20, 0. Use for counts, year groups, DoorActiveTime = 100.
  • Boolean (`bool`): only TWO possible values, True or False; used for conditions, logic, and flags (e.g. DoorSensorActive, SystemArmed).
  • Character (`char`): a single letter, digit, or symbol, e.g. 'A', '5', '#'. NOT acceptable when the question expects String.
  • String (`str`): a sequence of characters, e.g. "Hello", "Super-Team", "+449999999999". Use for names, text, identifiers, phone numbers.
  • 123 as an integer and "123" as a string are different; they are stored and used differently.
  • Python names for the data types are int, float, str and bool. In exam answers use the full names: integer, real (or float), string, Boolean and character.

Key terms

Exam tipCommon mistake

Data Type

A classification that defines what kind of data a variable can store and what operations can be performed on it.

  • Data types determine which operations are valid: you cannot divide a string, for example.
  • Exam tip: When asked to identify data types, each must be DIFFERENT — don't reuse one. Match data to context: teamName → String, yearGroup → Integer, javelinThrow → Real/Float.
Real / Float

A number with a decimal/fractional part, e.g. 3.14, -0.5. Use for measurements like javelinThrow = 18.2.

Exam technique

  • Tip:Boolean can ONLY have two values (True/False). If there are 3+ options (win/loss/draw), Boolean is NOT suitable — use String or Integer.
  • Tip:Phone numbers like +449999999999 should be stored as STRING (not Integer) because of the + prefix and leading zeros.
  • Tip:EmergencyPhoneNumber → String, UserName → String, DoorSensorActive → Boolean, DoorActiveTime → Integer.

Code examples

Data types in Python
python
age = 16           # Integer
height = 1.75      # Float (real)
passed = True      # Boolean
grade = "A"        # String
initial = "J"      # String (Python has no char type)

print(type(age))    # <class 'int'>
print(type(height)) # <class 'float'>
print(type(passed)) # <class 'bool'>

Ready to test yourself?

Practise 2.2.2 questions
← Previous topicBoolean operators AND, OR and NOT2.2.1 Programming FundamentalsNext note →Casting2.2.2 Data Types

Back to Data Types

Revise another OCR GCSE topic: Programming Fundamentals

Data Types

Note 1 of 2

  1. 1Data types
  2. 2Casting
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).