ch-3
ch-3
Chapter Three
Data representation in computer system
Chapter objectives:
☺ To understand how really data represented, flow, stored and processed inside
the computer.
☺ To know the different coding systems & unit of data representation.
BIT
➢ Bits are the smallest units and can convey only two possible states 0 or 1;
➢ bit stands for binary digits;
➢ A bit is a single element in the computer, on a disk that stands for either “ON”
indicating 1 or “OFF” indicating 0;
➢ In the computer “ON” is represented by the existence of current and “OFF” is
represented by the non-existence of current.
➢ On a magnetic disk, the same information is stored by changing the polarity or
magnetized particles on the disk’s surface;
Page 1
Compiled by Berihun G. Chapter Three 2017 E.C.
BYTE
➢ Bits can be organized into large units to make them represent more and meaningful
information;
➢ This large unit is called a byte and is the basic “unit of data representation” in a
computer system;
➢ The commonly used byte contains 8 bits;
➢ Since each bit has two states and there are 8 bits in a byte, the total amount of data
that can be represented is 28 or 256 possible combinations;
➢ Each byte can represent a character (a character is either a letter, a number or a
special symbol such as +, -,?, *, $, etc.
➢ A byte is then used as a unit of measurement in the computer memory, processing
unit, external storage and during communication;
➢ If the computer memory is 524288 bytes, this is expressed in short by saying 512KB,
where KB stands for kilobyte.
✓ 1 Kilobyte(1KB) is 210 or 1024 bytes
✓ 1 Megabyte (MB) is 220 bytes or 210 kilobytes
✓ 1 Gigabyte (GB) is 230 bytes or 220 kilobytes or 210megabytes
WORD
➢ Word refers the number of bits that a computer process at a time or a transmission
media transmits at a time
➢ Although bytes can store or transmit information, the process can even be faster if
more than one byte is processed at a once;
➢ A combination of bytes, then form a “word”
➢ A word can contain one, two, three or four bytes based on the capacity of the
computer;
➢ Word length is usually given in bits
➢ We say that a computer is an 8-bits, a 16 bit, a 32 bit or a 64-bit computer to indicate
that the amount of data it can process at a time;
➢ The large the word length a computer has the more powerful and faster it is.
Page 2
Compiled by Berihun G. Chapter Three 2017 E.C.
Page 3
Compiled by Berihun G. Chapter Three 2017 E.C.
The most elementary form to organize data within a computer (an electronic device) is in
the form of a code which utilizes the “ON” and “OFF” states of electric switches or there
is “current” and “no current” condition of the electronic components. We see that the
nature of the electronic devices has similarity with the binary number system in that both
represent only two elementary states. It is therefore convenient to use binary number
system to represent data in a computer. An “ON” corresponds to a 1, An “OFF”
corresponds to a 0;
✓ Octal number System (base 8) (Oct)
➢ It uses 8 symbols 0-7 to represent numbers;
➢ Like binary number system it is complete number system.
Ex. 77 in octal equals to 63 in decimal and 111111 in binary.
When we compare the octal with the decimal, 0-7 in octal is the same as 0-7 in decimal
but 10 in octal is not the same as 10 in decimal because 10 in octal holds the position of
8 in decimal, off course 10 in octal is the same as 8 in decimal.
Example 2
Decimal Binary Code Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
We have seen the binary and decimal number system in the previous topics so we will
discuss the next two in the following topics
(135) 10 = 1*102+3*101+5*100
Page 5
Compiled by Berihun G. Chapter Three 2017 E.C.
Ex.1. Convert 5610 to base two (binary) EX.3. Convert 3010 to base sixteen
X=56 M=2 (hexadecimal)
EX.2 Convert 7810 to base eight (Octal) Convert 1610 to base sixteen
7810=1168 (hexadecimal)
1610=A016
Page 6
Compiled by Berihun G. Chapter Three 2017 E.C.
=Y10
=257
Conversion from binary (base2) to Octal (base 8) or hexadecimal (base16) and vice
versa
= 1118
=5518
Ex: 10011.110010=?
Page 7
Compiled by Berihun G. Chapter Three 2017 E.C.
675eight =110111101
=110111101two
231eight = 010011001
=10011001two
Ex2: 377.77
Ex3: 37
011 111 111. 111 111
= 011 111
=011111
Conversion from Binary to Hexadecimal:
= 011111111.111111
To convert binary to hexadecimal group four binary digits together starting from right
and if there are no enough digits add zeros at the left.
=1 14 4 =1 12 15
=1 E 4 =1 B F
= 1E416 = (1BF) 16
Page 8
Compiled by Berihun G. Chapter Three 2017 E.C.
23416 =001000110100
= 10001101002
2AC16 =001010101100
=10101011002
Ex3. 39A
=0011 1001 1010
Conversion from Octal to hexadecimal and vice versa
To convert from Octal to hexadecimal, first we have to convert to binary and the binary to
hexadecimal. To convert from hexadecimal to Octal, first we have to convert to binary and then
the binary to Octal.
=000010011101
= 0 9 13
=9D16
Ex 2 Convert 1A to Octal
1A=0001 1010
Page 9
Compiled by Berihun G. Chapter Three 2011 E.C.
=0 3 2
=328
Hexadecimal → Octal:
CBAED → Hexadecimal
C B A E D
1100 1011 1010 1110 1101
011 001 011 101 011 101 101
3 1 3 5 3 5 5
CBAED = 3135355
0+0=0
0+1=1
1+0=1
1+1=0 plus a carry of 1 into the next position
1+1+1=1 plus a carry of 1 into the next position
The last case occurs when the two binary digits in a certain position are 1s and there is a carry
from the previous position.
Example1:
Page 10
Compiled by Berihun G. Chapter Three 2011 E.C.
6+7 =13
110+111=1101
Example2
19+31+10=60
10011 +11111+1010=111100
0-0=0
1-0=1
1-1=0
10-1=1
Example:
11100 28 101101 45
1x1=1
1x0=0
Page 11
Compiled by Berihun G. Chapter Three 2011 E.C.
-2 is 11111101
Note that in this representation positive numbers start with a 0 on the left, and negative numbers
start with a 1 on the left most bit.
3 = 0011
-3=1100
- 4 is 11111011
+ 6 is 00000110
Page 12
Compiled by Berihun G. Chapter Three 2011 E.C.
The sum is (1) 00000001 the one in the parenthesis is the external carry.
In one’s complement addition and subtraction, if there is an external carry it should be added to
get the correct result. This indicates it requires additional circuitry for implementing this
operation.
2’s Complement:
The 2’s complement of the binary system is similar to 10’s complement in the decimal system. Thus the
2’s complement of a binary number is equal to the 1’s complement of the number plus one.
Page 13