Revise Computingrevisecomputing.co.uk
Free student revisionSee questionsFor schoolsSchool enquiry
Free revisionSee questionsFor schoolsSchool enquiry
Knowledge/A Level/H446/01 Computer systems/Data Types/Primitive data types

Primitive data types: integer, real/floating point, character, string and Boolean

Primitive data types, integer, real/floating point, character, string and Boolean

1.4.1 Data Types

Data Types — Note 1 of 10

Candidates need to have an understanding of programming data types such as integer, real, Boolean, character string etc. Candidates need to be able to choose appropriate data types for a situation or given data. Candidates should have experience of programming solutions using these data types. Candidates should have knowledge of how to convert from one data type to another.

What you need to know

A data type defines what kind of value a variable can hold and which operations can be carried out on it. You need to choose appropriate data types for given data and convert between them.

What to know

  • Choosing the right type ensures the correct operations are possible and memory is used efficiently.
  • Casting converts between types, e.g. int("42"), str(3.5), float("2.1").

Key terms

Exam tipCommon mistake

Integer

A whole number, positive or negative, e.g. 42, -7.

Real / floating point

A number with a fractional part, e.g. 3.14, -0.5.

  • Exam tip: Justify your choice of data type in context, e.g. 'Real, because the price can contain pence'.
Character

A single letter, digit or symbol, e.g. 'A', '7', '#'.

String

A sequence of characters, e.g. "Hello", "CB2 8EA".

  • Data that looks numeric but is never used in calculations, such as phone numbers, should be stored as a string so leading zeros and symbols are kept.
Boolean

One of two values, True or False.

  • Common mistake: Choosing Boolean for data with more than two possible values.
← Previous topicServer and client side processing1.3.4 Web TechnologiesNext note →Represent positive integers in binary1.4.1 Data Types

Back to Data Types

Data Types

Note 1 of 10

  1. 1Primitive data types: integer, real/floating point, character, string and Boolean
  2. 2Represent positive integers in binary
  3. 3Sign and magnitude and two's complement to represent negative numbers
  4. 4Addition and subtraction of binary integers
  5. 5Represent positive integers in hexadecimal
  6. 6Convert positive integers between binary, hexadecimal and denary
  7. 7Representation and normalisation of floating point numbers in binary
  8. 8Floating point arithmetic: addition and subtraction
  9. 9Bitwise manipulation and masks: shifts, combining with AND, OR and XOR
  10. 10How character sets (ASCII and UNICODE) are used to represent text
Topic overview