0% found this document useful (0 votes)
5 views

Chapter 3-Data Representation in Computer

Chapter Three discusses data representation in computers, focusing on how digital computers process and store information in binary form. It covers various number systems, conversion methods between these systems, and binary arithmetic operations. Additionally, it touches on character representation standards like ASCII, EBCDIC, and Unicode.

Uploaded by

Haimanot Dubale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Chapter 3-Data Representation in Computer

Chapter Three discusses data representation in computers, focusing on how digital computers process and store information in binary form. It covers various number systems, conversion methods between these systems, and binary arithmetic operations. Additionally, it touches on character representation standards like ASCII, EBCDIC, and Unicode.

Uploaded by

Haimanot Dubale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Data Representation in

Computer
Chapter Three
Outline
Introduction to data
representation
Concept of Number
Systems
 Conversion of Number
System
 Binary Arithmetic
Introduction to data representation
As we discussed in chapter one,
Digital computers:
 These computers operates with information
which numerically represented in a digital form.
 Such computers process data (including text,
sound, graphics, and video) into a digital value
(in 0s and 1s).
 In digital computers, analog quantities must be
converted into digital quantity before processing.
 In this case, the output will also be digital.
 Digital computers can give the results with more
accuracy and at a faster rate.
Introduction to data representation
When we enter data into a computer or see output data
from a computer using the letter of alphabet, various
special symbols, and number.
But since computer is an electronic device, which
understands electrical flow (signal) there is no letter,
symbol or number inside the computer.
Therefore, Computer works with binary numbers
similarly as a switch is closed or opened.
So data are represented in the form of a code that can
have a corresponding electrical signal.
All information must be rendered into binary in order
to be stored on a computer.
Concept of number systems
 A number system is a set of symbols used for counting
There are various number systems:
Decimal Number System:- with the base of 10 and
symbol used are 0-9
Binary Number System:- the base is 2 and symbol
used are 1 & 0.
Octal Number System:- with the base of 8 and symbol
used are 0- 7
Hexadecimal Number System:- with the base of 16
and symbol used are 0-9, A- F representing the decimal
values 10-15.
Conversion of Number System
 We can convert a number in one system to the other system
based on rules.
 Decimal to Binary Conversion
 The steps to convert a decimal number to its equivalent binary
number are:
1. Divide the number by 2 and store the remainder.
2. Divide the quotient by 2 and store the remainder.
3. Repeat these steps until quotient becomes 0.
4. Write the remainders from bottom to top order.
E.g. Convert 23.
Therefore, 23= (10111)2
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
 Converting Decimal to Octal
 The steps to convert a decimal number to its equivalent octal number
are:
1. Divide the number by 8 and store the remainder.
2. Divide the quotient by 8 and store the remainder.
3. Repeat these steps until quotient becomes 0.
4. Write the remainders from bottom to top order
 Arrangements of remainders will be the binary equivalent of the
number. 8 837
 E.g. Convert 837 8 104 5
 Therefore, 837 = (1505)8 8 13 0
8 1 5
0 1
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
 Converting Decimal to Hexadecimal
 The steps to convert a decimal number to its equivalent hexadecimal
number are:
1. Divide the number by 16 and store the remainder.
2. Divide the quotient by 16 and store the remainder.
3. Repeat these steps until quotient becomes 0.
4. Write the remainders from bottom to top order.
 Arrangements of remainders will be the binary equivalent of the
number.
16 1715
 E.g. Convert 1715
16 107 3 3
 Therefore, 1715 = (6B3)16 16 6 11 B
0 6 6
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
 Converting Binary to Decimal
 To convert a binary number back to decimal number multiply
each digit from right side with increasing power of 2 and
adding the result.
 This means, the first digit from right will be multiplied by 20,
the second digit with 21 and so on.
For example: (10111)2 = ?10
= 1 × 20 + 1 × 2 1 + 1 × 2 2 + 0 × 2 3 + 1 × 2 4
= 1 + 2 + 4 + 0 + 16
= 23
 Therefore, (10111) = (233) 10
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
Converting Octal to Decimal
 To convert a octal number back to decimal number multiply each
digit from right side with increasing power of 8 and adding the
result.
 This means, the first digit from right will be multiplied by 8 0, the
second digit with 81 and so on.
For example, (1505)8 = ?10
= 5 × 80 + 0 × 8 1 + 5 × 82 + 1 × 8 3
= 5 + 0 + 320 + 512
= 837
o Therefore, (1505)8 = (837 ) 10
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
 Converting Hexadecimal to Decimal
 To convert a hexadecimal number back to decimal number
multiply each digit from right side with increasing power of 16
and adding the result.
 This means, the first digit from right will be multiplied by 16 0,
the second digit with 161 and so on.
For example, (6B3)16 = ?10
(6B3)16 = 3 × 160 + 11 × 161 + 6 × 162 (Here, B = 11)
= 3 + 176 + 1536
= 1715
 Therefore, (6B3)16 = (1715 ) 10
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
 Converting Binary to Octal
 The steps to convert a binary number to its equivalent octal number are:
1. Divide the binary number into groups of three bits each beginning from
right side.
2. Add 0s to the left, if last group is incomplete.
3. Convert each group into decimals.
 For example, (101011)2 = ?8

101 011
5 3
 As 101 = 1 × 20 + 0 × 21 + 1 × 22 = 1 + 0 + 4 = 5
 and 011 = 1 × 20 + 1 × 21 + 0 × 22 = 1 + 2 + 0 = 3
 Therefore, (101011)2 = (53)8
Conversion of Number System
 We can convert a number in one system to the other system based on
rules.
 Converting Octal to Binary
 The steps to convert a octal number back to its equivalent binary
number are:
1. Convert each digit octal number to its equivalent three digit binary number.
2. Combine all the binary groups into a single group.
 For example, consider (53)8 = ?2
 As 101 = 5 and 011 = 3
 Therefore, (53)8 = (101011)2
Conversion of Number System
 We can convert a number in one system to the other system
based on rules.
 Converting Binary to Hexadecimal
The steps to convert a binary number to its equivalent hexadecimal
are:
1. Divide the binary number into groups of four bits each
beginning from right side.
2. Add 0s to the left, if last group is incomplete.
3. Combine each group into decimals.
 For example, consider the following: (110101) 2 = ?16
= 0011 0101
= 3 5
 As 0011 is 3 in decimal and 0101 is 5 in decimal (refer to Table).
 Therefore, (110101)2 = (35)16
Conversion of Number System
 We can convert a number in one system to the other system
based on rules.
 Converting Hexadecimal to Binary
The steps to convert a hexadecimal number to its equivalent
binary are:
1. Convert every digit of hexadecimal number to its
equivalent four digit binary number.
3. Combine all the binary groups to form a single binary
number.
 For example, 3516 = ?2
 3 = (0011)2 (refer to Table)
 5 = (0101)2

 Therefore, (35)16 = (110101)2


Conversion of Number System
Fractional Numbers
 We can convert a number in one system to the other system based on
rules.
 The same general way in the decimal number.
0.235 = (2X10-1) + (3X10-2 )+ (5X10-3)
68.53 = (6X101) + (8X100) + (5X10-1) + (3X10-2)

 Position 4 3 2 1 0 . -1 -2 -3 -
4
 Position Value 24 23 22 21 20 . 2-1 2-2 2-3 2-
4

 Quantity
 Represented 16 8 4 2 1 . ½ ¼ 1/8
1/16
Conversion of Number System
Fractional Numbers
 We can convert a number in one system to the other system based on
rules.
 Converting Binary to Decimal
 Example, Find the decimal equivalent of the binary number
110.1012.
Solution:
110.1012 = 1 x 22 + 1 x 21 + 0 x 20 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3
= 4 + 2 + 0 + 0.5 + 0 + 0.125
= 6 + 0.5 + 0.125
= 6.62510
Conversion of Number System
Fractional Numbers
 We can convert a number in one system to the other system based on
rules.
 Converting Octal to Decimal
Example, Find the decimal equivalent of the octal number
127.548.
127.548 = 1x82 + 2x81 + 7x80 + 5x8-1 + 4x8-2
= 64 + 16 + 7 + 5/8 + 4/64
= 87 + 0.625 + 0.0625
= 87. 687510
Conversion of Number System
Fractional Numbers
 We can convert a number in one system to the other system based on
rules.
 Converting Hexadecimal to Decimal
 Example, Find the decimal equivalent of the hexadecimal number
2B.C416.
 Solution:
2B.C416 = 2x161 + Bx160 + cx16-1 + 4x16-2
= 32 + 11 + 12/16 + 4/256
= 43 + 0.75 + 0.015625
= 43. 76565210
Conversion of Number System
Fractional Numbers
 We can convert a number in one system to the other system based on
rules.
 Converting Decimal to Binary
 Example, Find the binary equivalent of the decimal number
0.2510.
 Solution:
Q R
0.25X2=0.5 0
0.5X2=1.0 1

0.2510=0.012
Binary Arithmetic
Computer Arithmetic and Binary Arithmetic used
interchangeably.
In this section you will see how computer perform
arithmetic operation on its data representation
digits(binary number system).
 Specifically,
Binary addition
Binary Subtraction
Binary Division
Binary Multiplication
Binary Arithmetic
Binary addition
Is performed in the same manner as in decimal
arithmetic.
Since 1 is the largest digit in the binary number system,
any sum greater than 1 requires a digit to be carried over.
 Example:
101 + 10 10011 + 1001
101 1001111
+10 +1001
111 11100
Binary Arithmetic
 Binary Subtraction
Determine if it is necessary to borrow.
If the subtrahend (the lower digit) is larger than the minuend (the
upper digit), it is necessary to borrow form the column to the left.
It is important to note here that the value borrowed depends upon
the base of the number system.
Simply to subtract lower value from the upper value.

 Example:
101 - 10 10011 - 1001
101 10011
- 10 -1001
011 01010
Binary Arithmetic
 Binary Division
It is similar to decimal division.
The rules for binary division are:
1. Start from the left of the dividend
2. Perform a series of subtractions, in which the
divisor is subtracted form the dividend.
3. If subtraction is possible, put a 1 in the quotient
and subtract the divisor form the corresponding
digits of dividend.
4. If subtraction is not possible (divisor greater than
remainder), record a 0 in the quotient.
5. Bring down the next digit to add to the remainder
digits. Proceed as before in a manner similar to
long division.
Binary Arithmetic
Binary Division
 Example
 Divide binary 100001 by 110.

0101 Quotient
110 100001 Dividend
110 1 Divisor greater than 100, hence, put 0 in quotient
1000 2 Add digit from dividend to group used above
110 3 Subtract possible, hence, put 1 in quotient
4 Remainder from subtraction plus digit from dividend
100
110 5 Divisor greater, hence, put 0 in quotient
1001 6 Add digit from dividend to group used above
110 7 Subtract possible, hence, put 1 in quotient
11 remainder
Binary Arithmetic
Binary Multiplication
Also here follows the same general rules as
multiplication in decimal number system.
 Example, Multiply the binary numbers 1010 and
1001
1010 Multiplicand
X 1001 Multiplier
1010 Partial product
0000 Partial product
0000 Partial product
1010 Partial product
1011010 Final product
Character Representation
• ASCII – PC workstations
• EBCDIC – IBM Mainframes
• Unicode – International Character sets
Character Representation
• ASCII
• Used for PC workstations
• Expanded name
• American Standard Code for Information Interchange
• Area covered
• 7-bit coded character set for information interchange
• Characteristics/description
• Specifies coding of space and a set of 94 characters
(letters, digits and punctuation or mathematical symbols)
suitable for the interchange of basic English language
documents.
• Forms the basis for most computer code sets.
ASCII
Character Representation
EBCDIC
Used by IBM Mainframes
Expanded name
Extended Binary Coded Decimal Interchange Code
Proprietary specification developed by IBM
Characteristics/description
A set of national character sets for interchange of
documents between IBM mainframes.
Most EBCDIC character sets do not contain all of
the characters defined in the ASCII code
Character Representation
EBCDIC
Usage
Used by IBM Mainframes
Not much used outside of IBM and similar
mainframe environments.
When transmitting EBCDIC files between systems
care needs to be taken to ensure that the systems are
set up for the relevant national code set.
EBCDIC
Character Representation
Unicode
Used for International Character sets
Unicode can represent all of the world's characters in
modern computer use, including technical symbols
and special characters used in publishing.
Because each Unicode code value is 16 bits wide, it
is possible to have separate values for up to 65,536
characters.
Unicode-enabled functions are often referred to as
"wide-character" functions.
Character Representation
Unicode
The implementation of Unicode in 16-bit values is
referred to as UTF-16.
For compatibility with 8- and 7-bit environments,
UTF-8 and UTF-7 are two transformations of 16-bit
Unicode values.
THANK YOU!!!

You might also like