0% found this document useful (0 votes)
4 views33 pages

Learning Unit 1 - Data Representation

The document provides an overview of data representation and storage, discussing various number systems such as decimal, binary, and hexadecimal. It explains the importance of digital representation in modern computing, including how integers and characters are stored and processed. Additionally, it covers data storage measurements and the representation of colors in digital formats, highlighting the significant number of possible colors and the data requirements for screen resolutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views33 pages

Learning Unit 1 - Data Representation

The document provides an overview of data representation and storage, discussing various number systems such as decimal, binary, and hexadecimal. It explains the importance of digital representation in modern computing, including how integers and characters are stored and processed. Additionally, it covers data storage measurements and the representation of colors in digital formats, highlighting the significant number of possible colors and the data requirements for screen resolutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

L E A R N I N G U N I T 1 : D ATA

R E P R E S E N TAT I O N A N D S T O R A G E
Binary,
C R E AT EDecimal,
D B Y A I DHexadecimal,
AN BANKS Octal
INTRODUCTION

In the old days, the ‘Abacus’ which was


one of the first calculators, was used to
perform calculations.

The method of calculation used


something similar to the ‘Hundreds,
Tens and Units’ system, it was based on
a number system where the arithmetic
processes were similar to the decimal
number system.
An effective method of communication, before radio communication,
between ships was a system called ‘Morse Code’. One ship understood the
message received from the other by interpreting and decoding a number of
short and long light flashes.
WHY ARE THESE METHODS
N O T B E I N G U S E T O D AY ?

Although both of these examples were successful at


the time and in the contexts in which they were used,
they could not have been successful in the electronic
environment as a computer for several reasons. Neither
could be successfully stored unless written down and
both were mechanically operated which means that
they are very slow.
A LT E R N AT I V E S ?
Modern calculators and
computers abuse a far more
efficient coding method which is
digital and electronic, high fans
low voltages In groups of specific
sizes can be interpreted as 0’s and
1’s so that computer can under
the representation of the data to
process it and store it.
THE DECIMAL, BINARY AND
HEXADECIMAL NUMBER SYSTEMS
DECIMAL
EXAMPLES:
Numbers are represented in the
decimal number system (base-10). 234
Why? Probably because we have ten
fingers and basic calculations could
6519
be done using our fingers before
calculators were invented.
8901
2
69
BINARY
The language of computers in order EXAMPLES:
to function. Every input you give to a
computer, it converts it into binary 0000111100001111
(base-2) in order to understand that
input.
01010100
0011

01011100
010101010000101010
HEXADECIMAL EXAMPLES:
Hexadecimal (base-16) is used in
many computer contexts. This uses
numbers and letters. A113 DID0

76
ACE

DF
CONVERSIONS
CONVERT BINARY TO DECIMAL
CONVERT DECIMAL TO BINARY
CONVERT DECIMAL TO HEXADECIMAL
CONVERT HEXADECIMAL TO DECIMAL
CONVERT HEXADECIMAL TO BINARY
CONVERT BINARY TO HEXADECIMAL
N U M B E R O F C O M B I N AT I O N S F O R
NUMBER OF BITS
Word size generally increases as
WORD SIZE processors become more
powerful For example, current
The word size, also known as
word size is 32 or 64 bits. The
word length, is the number of
number of bits in a word has many
bits that a computer, more
applications, one being the
precisely the processer, can work
number of possible combinations
with at one time. It is too
that can be stored in a fix number
inefficient to work with individual
of bits
bits, so bits are grouped

n
together into units called words, This can be calculated by

2
just like letters are grouped into using the formula:
words
D ATA S T O R A G E
The size of memory capacity such as RAM and Hard Disk Drives is measured
10
in multiple of bytes. A kilobyte (1KB) is 2 bytes which is 1024 bytes and not
100 bytes.

8 Bits = 1 Byte

1024 Bytes = 210 = 1 Kilobyte

1024 X 1024 Bytes = 220 = 1 Megabyte

1024 X 1024 X 1024 Bytes = 230 = 1 Gigabyte


40
1024 X 1024 X 1024 X 1024 Bytes = 2 = 1 Terabyte

1024 X 1024 X 1024 X 1024 X 1024 Bytes = 2 50 = 1 Petabyte


1024 X 1024 X 1024 X 1024 X 1024 X 1024 Bytes = 260 = 1 Exabyte
D I G I TA L R E P R E S E N TAT I O N O F N U M B E R S
Integers are numbers that don’t have decimal parts; and are positive whole
numbers, negative whole numbers or 0. The number of bits allocated to
store an integer determines the largest and smallest numbers that can be
represented in a fixed number of bits. An integer consists of two parts, the
sign (+ or -) and the value of the integer.

Integers are represented in two ways, either the sign or without.


Integers without a sign can only be positive and are called unsigned.
UNSIGNED INTEGERS
LARGEST NUMBER IN AN UNSIGNED INTEGER

In 8 bits, where all the bits are allocated to storing the number, the largest
number that can be represented is shown in the table below. Since the table
represents how the number is represented in a computer, it is not necessary
to write base 2.

1 1 1 1 1 1 1 1

n
Formula:
2 −1 The n is the number of bits.
UNSIGNED INTEGERS
SMALLEST NUMBER IN AN UNSIGNED INTEGER

The smallest unsigned number is 0. Since we do not have a bit to store the
sign, we can only store positive numbers

0 0 0 0 0 0 0 0
SIGNED INTEGERS
LARGEST NUMBER IN AN UNSIGNED INTEGER
To store numbers, we allocate the first bit to the sign leaving one less bit to
store the number. If the first bug is 0, the number is positive and if it is 1, the
number is negative. The large value that can be stored is 8 bits is.

0 1 1 1 1 1 1 1

n−1
Formula:
2 −1 The n is the number of bits.
SIGNED INTEGERS
SMALLEST NUMBER IN AN UNSIGNED INTEGER

We do not need to subtract one from the total as we did for the positive
since 0 has been accounted for in the positive integers.

n−1
Formula:
−2
P R I M I T I V E D ATA T Y P E S
Most programming languages provide basic data types to store characters,
text (String), real numbers and integers.
D I G I TA L C H A R A C T E R
R E P R E S E N TAT I O N
ASCII
The first widely used character set was
ASCII where each character was
represented in 8 bits and contained the
alphabetic characters (A -Z and a - z),
numbered characters (0-9, 1/2, 1/4),
some codes are accented, some Greek
letters, icons and limited number of lin
draw symbols which gave the screen very
limited graphical capabilities. It was
extended to 256 characters.
UNICODE AND UTF-8
Unicode
It provides a standard that provides a unique code number fro every
character, no matter what OS, device, application or language.
UNICODE AND UTF-8
UTF-8
Every character is represented by at least 8 bits per character (1 byte).
S T O R I N G S C R E E N D ATA
REPRESENTING COLOUR
Pixels are tiny dots on the screen. Each
pixel has its own colour definition. Colour
can be defined either RGB or other colour
definition.
RGB (Red Green Blue) is a system of producing
any colour light by adding varying intensities of
red, green and blue. Each colour is represented
by a byte. Echo byte has 256 combinations and
numbering from 9 to 255.
FOR BLACK:

Black Red Green Blue

Bytes 0 0 0

Bits 0 0 0

Hex 0 0 0
FOR WHITE:

Black Red Green Blue

Bytes 255 255 255

Bits 11111111 11111111 11111111

Hex FF FF FF
EACH COLOUR CAN BE ONE
OF 256 (RED) X 256 (GREEN) X
2 5 6 ( B L U E ) VA L U E S
PRODUCING 16,77,216
POSSIBLE COLOURS.
Current resolutions range from 360 x 640 to 1920 x 1080. If we use 360 x 640
pixels and 3 bytes for each pixel each screen will need:

360 x 640 x 3 bytes = 691200 bytes approximately 691.2KB

The refresh Rae of modern screeens is 60Hz to 360Hz. We will use an


average of 150Hz producing the calculation:

360 x 640 x 3 bytes x 150Hz = 103,680,00 bytes/second


approximately 104MB per second

You might also like