0% found this document useful (0 votes)
6 views11 pages

Edited Chapter Three

Chapter Three discusses data representation in computers, focusing on how data is stored, processed, and communicated using units like bits, bytes, and words, which are based on the binary number system. It also covers various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. Additionally, the chapter introduces coding methods such as EBCDIC, BCD, and ASCII for character representation in digital systems.

Uploaded by

isayasasmera672
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)
6 views11 pages

Edited Chapter Three

Chapter Three discusses data representation in computers, focusing on how data is stored, processed, and communicated using units like bits, bytes, and words, which are based on the binary number system. It also covers various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. Additionally, the chapter introduces coding methods such as EBCDIC, BCD, and ASCII for character representation in digital systems.

Uploaded by

isayasasmera672
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

CHAPTER THREE

DATA REPRESENTATION
Objectives:
 To understand how really data represented, flow, stored and processed
inside the computer.
 To know the different coding systems & unit of data representation.

3.1. UNITS OF DATA REPRESENTATION


When data is stored, processed or communicated within the computer system, it is
packed in units. Arranged from the smallest to the largest, the units are called bit, byte
and word. These units are based on the binary number system.
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.
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 byte, this is expressed in short by saying

1|Page Bonga University


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 210 megabytes
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 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.
We enter data into a computer or review (see) output data from a computer using the
letter of alphabet, various special symbols, and the numerals in the decimal number
system. But since computer is an electronic device, which understands electrical flow
(signal) there is no letter, symbol or number inside the computer. Computer works with
binary numbers.

3.2. Number System


 A number system is a set of symbols used for counting
 There are various number systems
Ex. Decimal, Binary, octal and hexadecimal.
For the purpose of understanding how data are represented, stored and processed in
computer, we will discuss on the following , the Decimal, binary, octal and hexadecimal
number system.

 The Decimal Number System


 The Decimal number system is based on the ten different digits (or symbols)
0,1,2,3,4,5,6,7,8,9.

2|Page Bonga University


 We say it is a base ten number system
 Though it is widely used, it is inconvenient for computer to represent data. So we
need another number system.

 The Binary number system


 Binary number system is based on the two different digits; 0 and 1;
 It is important to note that every decimal number system has its equivalent binary
number; Conversion from binary to its equivalent decimal and from decimal to its
equivalent binary is possible; Operation on binary number system is also possible.
 It is convenient to use binary number system to represent data in a computer;
 An “ON” corresponds to a 1; An “OFF” corresponds to a 0;
 In the computer “ON” is represented by the existence of a current and “OFF” is
represented by non-existence of current; on a magnetic disk, the same information
is stored by changing the polarity of magnetized particles on the disk’s surface.

 Octal number System (base 8) (Oct)


 It uses 8 symbols 0,1,2,3,4,5,6,7 to represent numbers;
 Like binary number system it is complete number system.
Example: - 77 in octal equals 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.

 Hexadecimal number system (16) (hex)


 It uses 16 symbols to represent numbers. But for the numbers greater than 15
they represented in terms of the 16 symbols. For example the decimal number 16
represented as 10, 20 as 14, 30 as 1E and so on.
 These symbols are 0,1,…9,A,B,C,D,E,F ( A=10, B=11,C=12, D=13, E=14, F=15)
 When we compare the hexadecimal with decimal, 0-9 in hexadecimal is the same
as 0-9 in decimal but 10 in hexadecimal is not the same as 10 in decimal, off
course 10 in hexadecimal is equal to 16 in decimal because it holds the position of
16 in decimal.

3|Page Bonga University


 Conversion from one Base to Another
The values that numbers have with a given number systems are largely determined by
their positional notation. Positional notation means that the position of one symbol
relative to other symbols in a given number system determines the value of that symbol.
For example, the symbols 1 & 7 can represent either 17 or 71 depending upon their
relative position to one another.
The decimal number 135 may be expanded as:
(135) 10 = 1*102+3*101+5*100
 The subscript 10 is used to indicate 135 is in base 10 number system.
 The number 10 in binary is not the same as 10 in decimal because the value of 1 in
the binary is not the same as the value of the 1 in the decimal.
 The binary number 1101 may be expanded as
(1101)2 =1*23+1*22+0*21+1*20 = 8+4+0+1
= (1*8)+(1*4)+(0*2)+(1*1) = 1310
*A number X1 X2 X3 …Xn in base M can be expanded as
(X0 X1 X2 …..Xn)M=X0*mn-1+X1*mn-2X2*mn-3+ …Xd-1*m1+Xnm0 in base 10
 Conversion from decimal (base 10) to other base (base M)
(Base 10……….Base M)
To convert a decimal number X to a number in base m,
i. Divide X by m, store the remainder.
ii. Again divide the quotient by M.
iii. Store the remainder, and continue until the quotient is 0.
iv. And concatenate (collect) the remainders starting from the last up to the
first.
Ex.1 Convert 5610 to base two (binary) EX.3. Convert 3010 to base sixteen
X=56 M=2 (hexadecimal)
5610 =1110002 3010=1E16
EX.2 Convert 7810 to base eight (Octal) Ex.4 Convert 1610 to base sixteen
7810=1168 (hexadecimal) 1610=1016

4|Page Bonga University


 Conversion from base M to base 10 (decimal)
To convert a number X consists of digits X1 X2 X3 …Xn in base m to decimal; simply
expand the number with base M. That is
(X1X2X3…Xn) m =X1*mn-1+X2*mn-2 +X3*mn-3+...+ Xi*mn-i+… Xn-1m1+Xn*m0 =Y10
e.g. 1. Convert (1001001)2 to decimal =73 3. Convert (101)8 to decimal =65
2. Convert (234)8 to decimal =156 4. Convert (A1B) 16 to decimal = 2587
5. Convert (101)16 to decimal =257

 Conversion from binary (base2) to Octal (base 8) or


hexadecimal (base16) and vice versa
 To convert a number in binary to octal group three binary digits together
starting from the last digit (right) and if there are no enough digits add zeros to
the front end (left) and find the corresponding Octal of each group.
Example. Convert 1001001 to octal Convert 101101001 to octal
1001001=001,001,001 101101001 =101,101,001
= 1118 =5518

 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 and expand.
EX. Convert 111100100 to hexadecimal Convert 111001111 to Hexadecimal
111100100 =0001 1110 0100 111001111 =0001 1100 1111
=1 14 4 =1 12 15
=1 E 4 =1 C F
= 1E416 =(1CF)16
 To convert from Octal to binary, convert each octal digit to its equivalent 3 bit
binary starting from right.
EX. Convert (675) 8 to binary Convert 2318 to binary

6758 =110 111 101 2318 = 010 011 001

=1101111012 =100110012

5|Page Bonga University


 To convert from Hexadecimal to binary, convert each hexadecimal Digit to its
equivalent 4-bit binary starting from right.
Ex. Convert 23416 to binary
23416 =0010 0011 0100
= 10001101002
Convert 2AC to binary
2AC16 =0010 1010 1100
=10101011002

 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.

EX.1. Convert 2358 to hexadecimal


2388=010 011 101
=0000 1001 1101
= 0 9 13
=9D16
Convert 1A to Octal
1A=0001 1010
=000 011 010
=0 3 2
=328

Example
DECIMAL OCTAL BINARY HEXADECIMAL
0 0 0 0
3 3 11 3
8 10 1000 8
10 12 1010 A
16 20 10000 10

6|Page Bonga University


3.3. CODING METHODS
 It is possible to represent any of the character in our language in a way as a series of
electrical switches in arranged manner.
 These switch arrangements can be coded as a series of equivalent arrangements of
bits.
 There are different coding systems that convert one or more character sets into
computer codes. Some are: EBCDIC, BCD, ASCII-7 & ASCII-8.
 In all cases, binary coding schemes separate the characters, known as character set,
in to zones. Zone groups characters together so as to make the coding scheme to
decipher and the data easier to process. Within each zone, the individual characters
are identified by digit code.
EBCDIC:
 Pronounced as “Eb-see-dick” and stands for Extended Binary Coded Decimal
Interchange Code.
 Used usually for IBM Main frame model and in similar machines produced by other
manufacturer.
 It is an 8-bit coding scheme: (00000000 – 11111111)
 It accommodates to code 28 or 256 different characters It is a standard coding scheme
for the large computers.
Coding Examples

7|Page Bonga University


BCD (Binary Coded Decimal)
There are two types of BCD coding techniques.
A. BCD (4-bits)
B. BCD (6-bits)
BCD (4-bits)
The 4 bit BCD, which represent any digit of decimal number by four bits of binary numbers.
For example:-If you want to represent 219 using 4 bit BCD you have to say 0010 0001 1001
 4 bits BCD numbers are useful whenever decimal information is transferred into or
out of a digital system. Examples of BCD systems are electronic ousters, digital
voltmeter, and digital clocks; their circuits can work with BCD numbers. ™
 BCD’s are easy for conversion but slower for processing than binary. And they Have
limited numbers because with BCD we can represent only numbers 0000 for 0 and
1001 for 9 and ,1010, 1011,1100,1101,1110, 1111 can’t be used for represents 10 to
15 because 1010 represent 10 in decimal but 10 is 0001 0000 in BCD.
BCD (6-bits)
 It uses 6-bits to code a Character (2 for zone bit and 4 for digit bit)
 it can represent 26 = 64 characters (10 digits, 26 capital characters and some other
special characters).

Exercise:- Write your name Using BCD (6-bits) Coding system?

8|Page Bonga University


ASCII-7
ASCII stands for American Standard Code for Information Interchange.
 Used widely before the introduction of ASCII-8 (the Extended ASCII)
 Uses 7 bits to represent a character.
 With the seven bits, 27( or 128) different characters can be coded (0000000-1111111)

Character Zone( 4-bit) Digit( 4-bit)


0-9 3 0-9
A-O 4 1-15
P-Z 5 0-10

The ASCII System


 Also referred as ASCII-8 or Extended ASCII.
 It is the most widely used type of coding scheme for Micro Computer system
 ASCII uses 8-bits to represent alphanumeric characters (letters, digits and special
symbols).
 With the 8-bits, ASCII can represent 28 or 256 different characters (00000000-
11111111).
Character Zone( 4-bit) Digit( 4-bit)
0-9 3 0-9
A-O 4 1-15
P-Z 5 0-10
a-o 6 1-15
p-z 7 0-10
Exercise:- Write you name Using ASCII-8 Coding system?

9|Page Bonga University


3.4. Binary Arithmetic
Computer understands only the language of binary numbers. Therefore, the machine
performs what is called binary arithmetic (binary computation).
Binary addition
Binary addition operates by the same rule as decimal addition, except that it is simpler. A
carry to the next higher order (or more significant) position occurs when the sum is decimal
2, that is, binary 10. Therefore, the binary addition rules may be written as follows:
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: 6+7 =13
110+111=1101
Example2 19+31+10=60
10011 +11111+1010=111100
Binary Subtraction
It operates by the same rule as decimal subtraction.
The rule is as follows; 0-0=0
1-0=1
1-1=0
10-1=1
Binary Multiplication
It is a very simple process that operates by the following obvious rulers:
(a) Multiplying any number by 1 rules the multiplicand unchanged
0x1=0 1x1=1
(b) Multiplying any number by 0 produces 0
0x0=0 1x0=0
Binary division

10 | P a g e Bonga University
That is, the process for dividing one binary number (the dividend) by another (the
divisor) is based on the rules for binary subtraction and multiplication and Similar to
decimal division

11 | P a g e Bonga University

You might also like