Units and Data Representation
Units and Data Representation
representation
Units
In a computer, all data is stored in binary form. A binary digit has two possible states,
1 and 0.
A binary digit is known as a bit. A bit is the smallest unit of data a computer can use.
The binary unit system is used to describe bigger numbers too.
Eight bits are known as a byte.
The binary unit system is as follows:
Size Unit
4 bits 0.5 byte (B)
8 bits 1 byte (B)
1,000 bytes (1,000 B) 1 kilobyte (KB)
1,000 kilobytes (1,000 KB) 1 megabyte (MB)
1,000 megabytes (1,000 MB)1 gigabyte (GB)
1,000 gigabytes (1,000 GB) 1 terabyte (TB)
1,000 terabytes (1,000 TB) 1 petabyte (PB)
Key fact
Four bits or half a byte is known as a nibble.
Analogue data and digital data
Analogue data is a real-life signal that can vary greatly in value. Examples include:
sound waves
pressure
temperature
Digital data is binary data which represents analogue data. Computers work with
digital data. Analogue data must be converted to digital before a computer can use it.
A device known as an analogue-to-digital convertor (ADC) is used to generate digital
data from analogue signals. In the same way, a digital signal can be converted back
to an analogue signal using a digital-to-analogue convertor (DAC).
Data capacity
Calculating the number of documents that can be stored on a storage medium can
be a straightforward process.
Suppose there are 150 music files, each of which is approximately 6 megabytes in
size, and a 1 gigabyte USB memory stick on which these files are to be stored. In
order to work out how much storage space is required to store all these files on the
USB memory stick, the following calculation can be used:
150 x 6 megabytes = 900 megabytes
To determine whether the USB memory stick has enough capacity to store all 150
music files, the units used for both the files and the storage device need to be the
same. The size of the music files is in megabytes, so the capacity of the USB will
also need to be converted to megabytes. In this example, the USB memory stick has
a 1 gigabyte capacity:
1 gigabyte = 1,000 megabytes
The capacity of the USB memory stick is now expressed in megabytes. The
following calculation will determine how many 6 megabyte files this storage device
can hold:
1000 / 6 = 166.66 files
As there are 150 music files, they will all fit on the USB memory stick.
This process can be applied to files of any type and size:
Quantity a 1 gigabyte USB memory stick could
File type Typical size hold
1 gigabyte = 1,000 megabytes, 1000 megabytes =
Word processed 1,000,000 kilobytes, 1,000,000 / 50 = 20,000 word
document 50 kilobytes processed files
1 gigabyte = 1,000 megabytes, 1000 megabytes =
100 1,000,000 kilobytes, 1,000,000 / 100 = 10,000 image
Image file kilobytes files
100 1 gigabyte = 1,000 megabytes, 1,000 / 100 = 10 video
Video file megabytes files
Characters
Computers work in binary. As a result, all characters, whether they are letters,
punctuation or digits are stored as binary numbers. All of the characters that a
computer can use are called a character set.
Two standard character sets in common use are:
American Standard Code for Information Interchange (ASCII)
Unicode
ASCII code
ASCII uses seven bits, giving a character set of 128 characters. The characters are
represented in a table, called the ASCII table. The 128 characters include:
32 control codes (mainly to do with printing)
32 punctuation codes, symbols, and space
26 upper case letters
26 lower case letters
numeric digits 0-9
We tend to say that the letter ‘A’ is the first letter of the alphabet, ‘B’ is the second
and so on, all the way up to ‘Z’, which is the 26th letter. In ASCII, each character has
its own assigned number. For example:
Colour depth
Many images need to use colours. To add colour, more bits are required for
each pixel. The number of bits determines the range of colours. This is known as an
image's colour depth.
For example, using a colour depth of two, ie two bits per pixel, would allow four
possible colours, such as:
00 - black
01 - dark grey
10 - light grey
11 - white
Each extra bit doubles the range of colours that are available:
one bit per pixel (0 or 1) - two possible colours
two bits per pixel (00 to 11) - four possible colours
three bits per pixel (000 to 111) - eight possible colours
four bits per pixel (0000 to 1111) - 16 possible colours
16 bits per pixel (0000 0000 0000 0000 to 1111 1111 1111 1111) - over 65,000
possible colours
The more colours an image requires, the more bits per pixel are needed. Therefore,
the more the colour depth, the larger the image file will be.
Key fact
Colour depth is the range of colours available.
Image size
Image size is simply the number of pixels that an image contains. It is expressed as
height and width. For example:
256 × 256
640 × 480
1024 × 764
Image file size
The size of an image file can be estimated using:
the image height in pixels
the image width in pixels
the colour depth per pixel
Example - an image of height 200, width 400, colour depth 16 bits
200 × 400 = 80,000
80,000 × 16 = 1,280,000 bits
1,280,000 bits ÷ 8 = 160,000 bytes
160,000 ÷ 1000 = 160 kilobytes
Result: 160KB
Resolution
Image quality is affected by the resolution of the image. The resolution of an image is
a way of describing how tightly packed the pixels are.
In a low-resolution image, the pixels are larger and therefore, fewer are needed to fill
the space. This results in images that look blocky or pixelated. An image with a high
resolution has more pixels, so it looks a lot better when it is enlarged or stretched.
The higher the resolution of an image, the larger its file size will be.
Metadata
Files contain extra data called metadata. Metadata includes data about the file itself,
such as:
file type
date created
author
An image file also includes metadata about the image data itself, such as:
the height and width of the image - this defines how many rows and columns
the pixels are to be arranged in
the resolution
the colour depth
Without this metadata, the image data would not be correctly interpreted, meaning
the image could not be correctly displayed.
Key fact
Metadata is data about data!
Sound
Computers work in binary. All data must be converted into binary in order for a
computer to process it. Sound is no exception. To do this, sound is captured - usually
by a microphone - and then converted into a digital signal.
An analogue-to-digital converter will capture a sound wave at regular time intervals.
This recording is known as a sample.
For example, a sound wave like this can be sampled at each time sample point:
The sound recorded at each sample point is converted to its nearest numeric
equivalent:
Sample 1 2 3 4 5 6 7 8 9 10
Denary 8 3 7 6 9 7 2 6 6 6
Binary 1000 0011 0111 0110 1001 0111 0010 0110 0110 0110
This data is then stored in a file for later use.
Sample rate
Sample rate is the number of samples recorded in any given period of time. The
higher the sample rate, the closer the recorded signal is to the original. Sample rate
is measured in hertz.
If the samples recorded above were plotted on a graph, the resulting representation
of the sound wave would not be too accurate:
Figure caption,
A sound wave plotted from 10 samples
However, if the sample rate is doubled - twice as many samples in the same time
period - the resulting representation would be closer:
Figure caption,
A sound wave plotted from 20 samples
However, the higher the sample rate, the larger the resulting file. As a result, sound
files are often a compromise between quality and size of file. An audio file is usually
recorded at 44.1 kilohertz. This is high enough for good sound quality while keeping
file size down to sensible levels.
Bit depth
Bit depth refers to the number of bits used to record each sample. Just as with
images, the higher the bit depth, the more accurately a sound can be recorded, but
the larger the file size. Typical bit depths are 16 bit and 24 bit.
Bit rate
Bit rate is simply a measure of how much data is processed for each second of
sound. Bit rate is calculated by:
Sample rate × bit depth
As with sample rate, the higher the bit rate, the better quality of the recorded sound.
Key fact
Bit depth refers to the number of bits used to record each sample. Bit rate is a
measure of how much data is processed for each second of sound.