Programming Data Types

KS3 Computer Science

11-14 Years Old

48 modules covering EVERY Computer Science topic needed for KS3 level.

GCSE Computer Science

14-16 Years Old

45 modules covering EVERY Computer Science topic needed for GCSE level.

A-Level Computer Science

16-18 Years Old

66 modules covering EVERY Computer Science topic needed for A-Level.

GCSE Data Representation (14-16 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

A-Level Data types, data structures and algorithms (16-18 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

Programming Data Types

data type is a means of classifying the type of data that a variable or object can hold in computer programming.  Data types are an important factor in all computer programming languages, including C#, C++, JavaScript, and Visual Basic.  When programmers develop computer software—whether that’s desktop or web-based—data types must be assigned and applied correctly in order to guarantee proper outcomes and an error-free program.

programming data types

In programming, a data type is a categorization that specifies what kind of operation can be applied to it without resulting in an error.

The data type determines which operations can be safely executed to develop, transpose, and apply the variable to another computation.  When a programming language needs a variable to be used only in ways that follow its data type, that language is said to be strongly typed.  Doing this reduces errors because while it is reasonable to ask the computer to multiply a float by an integer (3.4 x 3), it is unreasonable to ask the computer to multiply a float by a string (3.4 x Sam).  When a programming language allows a variable to assume a different data type, the language is said to be weakly typed.

Strongly typed and weakly typed programming languages are commonly-held misconceptions.  There is a concept of type safety, whereby a programming language constraints or restricts type error.

Common Data Types

  • Integer – a whole number that can have a positive, negative, or zero value. It cannot be a fraction, nor can it include decimal places.  It is commonly used in programming, especially for increasing values.  Addition, subtraction, and multiplication of two integers results in an integer.  However, division of two integers may result in either an integer or a decimal.  The resulting decimal can be rounded off or truncated in order to produce an integer.
  • Character – any number, letter, space, or symbol that can be entered in a computer. Every character occupies one byte of space.
  • String – used to represent text. It is composed of a set of characters that can include spaces and numbers.  Strings are enclosed in quotation marks to identify the data as strings, and not as variable names, nor as numbers.
  • Floating Point Number – a number that contains decimals. Numbers that contain fractions are also considered floating-point numbers.
  • Array – a kind of a list that contains a group of elements which can be of the same data type as an integer or string. It is used to organise data for easier sorting and searching of related sets of values.
  • Varchar – as the name implies, a varchar is a variable character, on account of the fact that the memory storage has variable length.  Each character occupies one byte of space, plus 2 bytes additional for length information.

Note: Use Character for data entries with fixed lengths, like phone numbers, but use Varchar for data entries with variable lengths, like an address.

  • Boolean – used for creating true or false statements. To compare values the following operators are being used: AND, OR, XOR, and NOT.
Boolean OperatorResultCondition
x AND yTrueIf both x and y are True
x AND yFalseIf either x or y is False
x OR yTrueIf either x or y, or both x and y are True
x OR yFalseIf both x and y are False
x XOR yTrueIf only x or y is True
x XOR yFalseIf x and y are both True or both False
NOT xTrueIf x is False
NOT xFalseIf x is True
  • Date, Time and Timestamp – these data types are used to work with data containing dates and times.
Date TypeValue
DATEYear, Month and Day
TIMEHour, Minute and Second
TIMESTAMPYear, Month, Day, Hour, Minute, Second and Microsecond

Further Reading