Data Representation and Data Types

Data Representation and Data Types

Section 1: Introduction to Data Representation

  • Data representation refers to the methods used to represent or illustrate data in a structured manner.
  • In computing, all types of data such as text, images, sound, etc. must be represented as binary, strings of 0s and 1s.

Section 2: Bits and Bytes

  • The smallest unit of data in computing is a bit, which holds a single binary value of 0 or 1.
  • A byte consists of 8 bits. Large amounts of data are often measured in kilobytes (KB), megabytes (MB), gigabytes (GB), and terabytes (TB).

Section 3: Character Encoding

  • Character encoding is the system used to represent letters, numbers, and other symbols as binary data.
  • ASCII (American Standard Code for Information Interchange) and Unicode are two common encoding systems, with Unicode enabling representation of a wider array of international characters.

Section 4: Image Data

  • Images are represented as bitmap or vector. Bitmap images are represented as a grid of pixels, each storing colour information.
  • Each pixel’s colour is typically represented as a combination of binary codes for Red, Green, and Blue (RGB), or for Cyan, Magenta, Yellow and Key (Black), known as CMYK.

Section 5: Sound Data

  • Sound data is represented as digital audio through a process called sampling. This involves taking snapshots, or ‘samples’ of sound data at frequent intervals.
  • The quality of digital sound is determined by two factors: bit rate (the number of bits used per sample) and sample rate (the number of samples taken per second).

Section 6: Data Types

  • Computer programs need to process different types of data, each of which is categorised under different data types. These include integer, float, boolean, character, and string.
  • Integers are whole numbers, floats represent decimal values, booleans represent true or false, characters represent single letters or symbols, and strings represent lines of text.

Section 7: Data Structures

  • Data structures allow programmers to store, retrieve and manipulate data efficiently. They include arrays, stacks, queues and linked lists.
  • An array is a collection of elements of the same data type, whilst a queue and a stack are linear data structures that differ in how elements are inserted and removed.