Data Types

Computer Science: OCR A Level, topic 4.1.1

Data Types

Every piece of data that is stored has a type. The type determines how it is stored and what you can do with the data.

Integer

Integer

  • Whole numbers.
  • Examples:
  • 12, 0, -142.
Float / Real

Float / Real

  • Fractional numbers.
  • Examples:
  • 0.42, 1.00.
String

String

  • Text data.
  • Example:
  • "Hello, world!".
Character

Character

  • A single letter of text data.
  • Example:
  • 'a'.
Boolean

Boolean

  • A True or False value.
  • Examples:
  • True.
  • False.

Test yourself on Data Types

  • What would be the most suitable type to store the number 2.5?

  • Which of these data are characters?

  • Which would be the most appropriate type to store a username?

Practise this topic for free