DATA REPRESENTATION
INTRODUCTION
A computer is an electronic device that accept data, process it to produce
information with speed and accuracy.
1. What is Data?
2. What types of data in imputed into the computer?
3. Are they in human readable form?
4. What number system does the computer use to represent data?
5. In what pattern is the data represented?
Answers to these questions will be provided as we go through the lesson.
• OBJECTIVES
By the end of the lesson, you will be able to,
• a) Identify the various data types used by the computer
• b) Explain the unit of storage
• c) Mention the various ways data is represented
• d) Explain how character is represented
• e) Explain the coding information using bit pattern
• Data Types
All computer programs, from brain scanners to video games to music
players, use these same basic data types to represent all possible
information.
Three basic examples of such data types are:
1. Numbers:
a. Integers or Whole Numbers (e.g., 0,1,2,3,123123, 12, -1, -2, -4….)
• Advanced Concept: Unsigned Integers.
b. Real Numbers also called doubles or floats. These are numbers
represented with a decimal point. (e.g., 1.1, 5.0, 3.1419, -1234234.01,
0.0000001)
2. Booleans (true or false):
• Booleans were named after the famous Mathematician, George Boole
• Booleans are good for knowing the status of something... I am learning vs. I am NOT
learning.
Many math operations give us Boolean answers, such as
•
"not equal" (e.g., "5 ~= 10"),
•
"less than" (e.g., 5 < 10), and
•
"greater than" (e.g., 5 > 10)
3. Characters ('a', 'b', ... 'z', '1', '2', ... '9', '!', '^', etc):
Note: ‘1’ is NOT 1. The character is NOT the numeric value! That is, ‘1’ is a character
while 1 is a number (integer).
Characters are usually not used by themselves, but in concert with many other
characters. In fact, a combination of Characters gives us a data type called
a String (e.g. “a book!”).
Unit of Storage
To understand the unit of storage in computer, you should know how a
computer represents data.
People communicate through speech by combining words into
sentences.
Human speech is analog because it uses continuous (wave form)
signals that vary in strength and quality.
Most computers are digital. They recognize only two discrete
states: on and off. This is because computers are electronic devices
powered by electricity, which also has only two states: on and off.
The two digits, 0 and 1, easily can represent these two states.
· The digit 0 represents the electronic state of off (absence of an electronic
charge).
· The digit 1 represents the electronic state of on (presence of an electronic
charge).
We know that people use the decimal system (0 through 9) in counting.
The computer, by contrast, uses a binary system because it recognizes only
two states.
The binary system is a number system that has just two unique digits,
0 and 1, called bit (short for binary digit). A bit is the smallest unit of
data the computer can process and hence, its basic unit of storage. It is
followed by
•
Nibble è 4 bits
•
Byte è 8 bits
•
Word è 16 bits
•
Double word è 32 bits
The table below shows the various equivalent Storage Units of a computer
Character Representation
A bit by itself, is not very informative. A byte, however, provides
enough different combinations of 0s and 1s to represent 256 individual
characters.
• These characters include
•
numbers,
•
uppercase and lowercase letters of the alphabet,
•
punctuation marks, and
•
others, such as the letters of the Greek alphabet.
The combinations of 0s and 1s that represent characters are defined by
patterns called a coding scheme.
In one coding scheme, the number 4 is represented as 00110100,
8-BIT BYTE FOR THE NUMBER 4
Coding Information/Scheme Using Bit Pattern
The followings are coding schemes used to represent data
1. ASCII (pronounced ASK-ee), which stands for American Standard
Code for Information Interchange, is the most widely used 8-bit coding
scheme to represent data. The ASCII coding scheme is sufficient for
English and Western European languages but is not large enough for
Asian and other languages that use different alphabets.
2. Unicode is a 16-bit coding scheme that has the capacity of
representing more than 65,000 characters and symbols. The Unicode
coding scheme is capable of representing almost all the world’s current
written languages, as well as classic and historical languages.
Coding schemes make it possible for humans to interact with a digital
computer that processes only bits. The picture below shows how data
is converted in the computer
• Data Representation
The main ways of representing data in the computer system are by
using the:
•
Binary Number System which has only two numbers: 0 and 1.
That is 0, 1, 10, 11, 100, 101, 111…)
•
Octal Number System which has 8 numbers: 0 to 7. That is 0, 1, 2,
3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20…)
•
Decimal Number System which has 10 number: 0 to 9. That is 0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, … and
•
Hexadecimal Number System which has 16 numbers 0 to 9 and
continue from A to F. That is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, E, F, 10,
11…
• SUMMARY
In this lesson, we have learnt that
The various data type fed into the computer includes
o Number,
o Boolean,
o Characters and
o String
• The smallest unit of storage capacity is bit and that
o 8 bits makes a byte,
o 1024 bytes makes a Kilobyte,
o 1024 Kilobyte makes a Megabyte…
• In the computer, characters and numbers are represented using the binary number system (0, 1)
• Coding information/scheme are special ways of representing numbers, symbols and characters. Two most
commonly used coding scheme are
o ASCII and
o UNICODE
• Other Data representation apart from the Binary number system include
o Octal,
o Decimal and
o Hexadecimal number system.
UNIT OF DATA STORAGE
• INTRODUCTION
In the last lesson, you learned about different Number Systems used by the
computer, which were
•
Binary Number System
•
Octal Number System
•
Decimal Number System
•
Hexadecimal Number System
in this lesson, we are going to learn about the basic binary arithmetic.
• OBJECTIVES
By the end of the lesson, you will be able to
• a.
find the sum of any two given binary numbers
• b. subtract any two given binary numbers
• c.
multiply any two given binary numbers
• d. divide any two given binary numbers
• BINARY ARITHMETICS
Binary arithmetic is essential part of all the digital computers and many
other digital system. Binary arithmetic is one of those skills which you
probably won't use very often. It can be very useful to know however.
These processes are often stepping stones to more complex processes
which can do very powerful things. Fortunately, they are not too
difficult so with a bit of practice you'll be off and running in no time.
Binary Arithmetic involves
•
Addition
•
Subtraction
•
Multiplication
•
Division
Binary Addition
This involves adding two or more binary digits. There are four rules of binary
addition.
NOTE: In the fourth case, 1 + 1 = 10. That is, we first write 0 and carry 1 to
the next significant bit.
Also, take note that 1 + 1 + 1 = 11. That is 1 + 1 = 10 and 10 + 1 = 11. So, we
write 1, and carry 1 to the next significant bit.
Example:
a.
00011010 + 00001100 = 00100110
Example:
a.
00011010 + 00001100 = 00100110
b.
00010011 + 00111110 = 01010001
Binary Subtraction
• Like binary addition, binary subtraction has four rules.
NOTE: in the second case, we cannot subtract 1 from 0. So we
borrow 1 from the next significant bit which become 10 and
subtract 10 – 1 = 1
• Example:
a.
00100101 - 00010001 = 00010100
b.
00110011 - 00010110 = 00011101
Binary Multiplication
There are four rules of binary multiplication.
• Examples:
a.
00101001 × 00000110 = 11110110
b.
00010111 × 00000011 = 01000101
Binary Division
Binary Division is a repeated process of Subtraction
• Examples:
a.
00101010 ÷ 00000110 = 00000111
b.
10000111 ÷ 00000101 = 00011011
0
• SUMMARY
In this lesson, we learnt that.
·
The rule for addition of binary arithmetic are:
• 1+0 = 1,
• 0+1 = 1,
• 0+0 = 0 and
• 1+1 = 10 (we write 0 first and carry 1 to the next successive digit to the left)
·
The rule for subtraction of binary arithmetic are:
• 1- 0 = 1,
• 0 - 1 = 1, (we first borrow 1 from the next successive digit to the left if there is to make 10 and subtract 1
from it: 10 – 1 = 1)
• 0 - 0 = 0 and
• 1-1=0
·
Rules of Multiplication in binary arithmetic are:
• 1×0=0
• 0×1=0
• 1×1=1
• 0×0=0
·
Binary division is a repeated process of Subtraction
DATA CONVERSION
• INTRODUCTION
In our last two lessons, we learnt that computer represents data in 0s and 1s
(bit). We also learnt about the binary arithmetic since computer processes
data using the binary system. We saw that there were other number system
fed into the computer for processing namely
·
Octal
·
Decimal and
·
Hexadecimal number system
But since the computer processes data solely in the binary system, it must
first convert these system into the binary system. So, in this lesson, we will
learn about the conversion of numbers from binary to decimal and vice
versa, binary to octal and vice versa, and binary to hexadecimal and vice
versa.
• OBJECTIVES
By the end of the lesson, you will be able to
a. Convert a given binary digit to its decimal equivalence and the vice
versa
b. Convert a given binary digit to its octal equivalence and the vice versa
c. Convert a given binary digit to its hexadecimal equivalence and the vice
versa
• SUMMARY
In this lesson, we learnt how to convert binary digit to
a) Decimal and vice versa
b) Octal and vice versa
c) Hexadecimal and vice versa
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )