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

Lesson 03

The document discusses data representation in computers. It explains that computers store all types of information, such as numbers, text, graphics, and video, internally as sequences of 0s and 1s. It describes how binary and other number systems like decimal and octal are used to represent numeric data. Memory in computers consists of bits that are organized into bytes to store these binary representations of data in an efficient manner.

Uploaded by

Rohit Singh
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)
49 views11 pages

Lesson 03

The document discusses data representation in computers. It explains that computers store all types of information, such as numbers, text, graphics, and video, internally as sequences of 0s and 1s. It describes how binary and other number systems like decimal and octal are used to represent numeric data. Memory in computers consists of bits that are organized into bytes to store these binary representations of data in an efficient manner.

Uploaded by

Rohit Singh
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/ 11

Data Representation in the Computer

Notes

3
DATA REPRESENTATION IN THE
COMPUTER

Computer is not a human being. But how does it understand your instuctions? Did you
think about it any time? Computer understands only 1’s and 0’s. Whatever instruction or
input you are giving to computer it converts each instuction / input as 1’s and 0’s. With
the help of these two digits computer can represent video, picture and numbers also.

In this lesson, you will learn methods of data representation in a computer. You will also
learn different types of number systems in data representation.

OBJECTIVES
After reading this lesson you will be able to:

z explain about data representation.

z list the types of number system used in computer.

z convert from one number system to other.

3.1 DATA REPRESENTATION

Data representation refers to the method used to represent information stored in a computer.
Computer stores different types of information like number, text, graphics, video, sound,
charts, images etc.

All types of information stored in a computer are stored internally in the form of 0’s and
1’s. It is very interesting that only with 1 and 0 everything is represented. Computers use
numeric codes to represent all the information.

Computer Hardware Assembly and Maintenance 21


Data Representation in the Computer

Memory Structure in Computer:


z Memory consists of bits (0 or 1). A single bit can represent two pieces of information
Notes
(either 0 or 1).

z 1 Nibble is equivalent to 4 bits.

z 1 Byte is eqivalent to 8 bits, a single byte can represent 256 = 2*2*2*2*2*2*2*2 =


28 different things.

z Each byte has its own address.

Binary Numbers
Do you know the origin of the word “Bi”? It is a latin word. Do you know the meaning
of the latin word “Bi”? Bi means two. Binary numbers are 0’s and 1’s. Any positive
integer (whole number) can be easily represented by a sequence of 0's and 1's. Numbers
in this form are said to be in base 2 and these are called binary numbers.

Text
Text can be represented easily by assigning a unique numeric value for each symbol used
in the text. For example, the widely used American Standard Code for Information
Interchange (ASCII explained in section 3.3) defines 128 different symbols (all the
characters found on a standard keyboard, plus a few extra), and assigns each symbol to
a unique numeric code between 0 and 127. In ASCII, “A” is 65, “B” is 66, “a” is 97, “b”
is 98, and so forth. When you save a file as “plain text”, it is stored using ASCII. ASCII
format uses 1 byte per character. 1 byte gives only 256 (128 standard and 128 non-
standard) possible characters The code value for any character can be converted to base
2. Any written message made up of ASCII characters can be converted to a string of 0’s
and 1’s.

Graphics
Graphics that are displayed on a computer screen consist of pixels: the tiny “dots” of color
that collectively “paint” a graphic image on a computer screen. The pixels are organized
into many rows on the screen. In one common configuration, each row is 640 pixels long,
and there are 480 such rows. Another configuration is 800 pixels per row with 600 rows,
which is referred to as a “resolution of 800×600”. Each pixel has two properties: its
location on the screen and its colour.

A graphic image can be represented by a list of pixels. Imagine all the rows of pixels on
the screen laid out end to end in one long row. This gives the pixel list, and a pixel's
location in the list corresponds to its position on the screen. A pixel's color is represented
by a binary code, and consists of certain number of bits. In a monochrome (black and
white) image, only 1 bit is needed per pixel: 0 for black, 1 for white, for example. A 16
color image requires 4 bits per pixel. Modern display hardware allows for 24 bits per
pixel, which provides an array of 16.7 million possible colors for each pixel.

22 Computer Hardware Assembly and Maintenance


Data Representation in the Computer

Notes

Fig. 3.1: Pixels in Different Display Devices

3.2 NUMBER SYSTEM


Computer stores and processes two basic types of data viz., character and number. The
character type data includes alphabets and some special symbols. For example, student
name in class,roll number, etc.

Digital computers internally use binary (base 2) number system to represent data and
perform arithmetic calculations. The binary number system is very efficient for computers,
but not for humans. Representing even relatively small numbers with binary system
requires working with long strings of ones and zeroes.

3.2.1 Decimal and Binary Numbers


Have you heard about decimal numbers? In the decimal number system, there are ten
possible values that can appear in each digit position, and so there are ten numerals
required to represent the quantity in each digit position.

The decimal numerals are from zero to nine (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).

When you write decimal (base 10) numbers, you use a positional notation system. Each
digit is multiplied by an appropriate power of 10 depending on its position in the number:

For example:

843 = 800 + 40 + 3 = 8 × 100 + 4 × 10 + 3 × 1

= 8 × 102 + 4 × 101 + 3 × 100

Computer Hardware Assembly and Maintenance 23


Data Representation in the Computer

For whole numbers, the rightmost digit position is the one’s position (100 = 1). The
numeral in that position indicates how many ones are present in the number. The next
Notes position to the left is ten’s, then hundred's, thousand’s, and so on.

Table 3.1 shows decimals and their 4 bit binary equivalents.

Table 3.1: decimal and their 4 bit binary equivalents.

Decimal Pattern Binary Pattern( in 4 bit)


0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

10 1010

In a positional notation system, the number base is called the radix. Thus, the base ten
system that you normally use has a base of 10. When writing numbers in a base other than
ten, or where the base is not clear from the context, it is normal to specify the base using
a subscript. Thus, in a case where the base is not understood, decimal numbers would be
written like this:

12710 1110 567310

In binary, counting follows similar procedure, except that only two symbols 0 and 1 are
used. Thus, after a digit reaches 1 in binary, an increment resets it to 0 but also causes an
increment of the next digit to the left (i.e., 10).

Since binary is a base-2 system, each digit represents an increasing power of 2, with the
rightmost digit representing 20, the next representing 21, then 22, and so on. To determine
the decimal representation of a binary number simply take the sum of products of binary
digits and the powers of 2 which they represent. For example, the binary 100101 is
converted to decimal form as follows:

24 Computer Hardware Assembly and Maintenance


Data Representation in the Computer

1001012 = [ ( 1 ) × 25 ] + [ ( 0 ) × 24 ] + [ ( 0 ) × 23 ] + [ ( 1 )

× 2 2 ] + [ ( 0 ) × 21 ] + [ ( 1 ) × 2 0 ] Notes
1001012 = [ 1 × 32 ] + [ 0 × 16 ] + [ 0 × 8 ] + [ 1 × 4 ] + [ 0 × 2 ] + [ 1 × 1 ]

1001012 = 3710

3.2.2 Octal Number System


Octal (this word is derived from Latin word Octo meaning 8) or oct is the base 8 number
system uses digits (0-7), i.e. : 0, 1, 2, 3, 4, 5, 6, 7.

To determine the decimal representation of a octal number simply take the sum of
products of octal digits and the powers of 8 which they represent.

Example : Octal Number - 125708 converted to decimal equivalent as follows;

125708 = [(1 × 84) + (2 × 83) + (5 × 82) + (7 x 81) + (0 × 80)10]

= 4096 + 1024 + 320 + 56 + 0

= 549610

3.2.3 HexaDecimal Number System


Hexadecimal or hex is base 16 number system. It uses 16 distinct symbols

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

The alphabets (A to F) represents the values ten to fifteen.

for example - Hexadecimal Number 19FDE converted to decimal equivalent as follows;

19FDE = (1 x 164) + (9 x 163) + (F x 162) +(D x 161) + (E x 160)

= 65536 + 36864 +3840 + 208 +14

= 10646210

All four number systems are equally capable of representing any number.

3.2.4 Conversion from one Number System to Another

Decimal to Binary Conversion


You can use, successive division method for decimal to binary conversion. Successive
division requires dividing continuously by the base till the quotient equals to 0.

Computer Hardware Assembly and Maintenance 25


Data Representation in the Computer

Steps for conversion from Decimal to Binary


1. Divide the decimal number by 2.
Notes
2. Take the remainder and record it on the side.
3. Repeat until the decimal number can not be divided .
4. With the bits, record them from bottom to top so that the number will be the
number in base 2.

For example conversion of 9 into binary is as follows:

9/2 = 4 and remainder = 1 (first remainder is called LSB) (least Top


significant bit)

4/2 = 2 and remainder = 0

2/2 = 1 and remainder = 0

1/2 = 0 and remainder = 1 (last remainder is called MSB) (Most Bottom


significant bit)

Now, decimal 9 is equivalent to 1001 in binary number system.

Decimal to Octal Conversion


You can convert decimal to octal. Conversion requires dividing continuously by the base
you are converting (in this case it is 8) to until the quotient equals 0.

Steps for conversion from Decimal to octal


1. Divide the decimal number by 8.
2. Take the remainder and record it on the side.
3. Repeat until the decimal number can not be divided.
4. With the bits, record them from bottom to top so that will be the number in base 8.

For example, conversion of 19 into Octal as follows: Top


19/8 = 2 and remainder = 3 (first remainder is called LSB)
(least significant bit)

2/8 = 0 and remainder = 2 (last remainder is called MSB)


(Most significant bit) Bottom

26 Computer Hardware Assembly and Maintenance


Data Representation in the Computer

Now decimal 19 is equivalent to 23 octal number

(19)10 = (23)8
Notes
Decimal to Hexadecimal Conversion

Division method can be used for conversion from decimal to hexadecimal.

Steps for conversion from Decimal to Hexadecimal

1. Divide the decimal number by 16.

2. Take the remainder and record it on the side.

3. Repeat until the decimal number can not be divided.

4. With the bits, record them in order from bottom to top as that will be the number in
base 16.

5. In hexadecimal, 10,11,12,13,14,15 are equivalent to A, B, C, D, E, F respectively.

For example, conversion of 229 decimal into hexadecimal


229/16 = 14 and remainder = 5
14/16 = 0 and remainder = 14 (i.e., F= 14)
So, (229)10 = (E5)16

INTEXT QUESTIONS 3.1


Fill in the blanks

1. Computer understands .......................... number.

2. Binary number system has base of ..........................

3. Octal has range from 0 to ..........................

4. Decimal has base of ..........................

5. In hexadecimal, remainder 10 is equivalent to ..........................

3.3 CHARACTER REPRESENTATION: ASCII, EBCDIC

Even though many people used to think of computers as "number crunchers", people
figured out long ago that it is important to handle character data. Character data is not
just alphabetic characters, but also numeric characters, punctuation, spaces, etc. Most
keys on the central part of the keyboard (except shift, caps lock) are characters.

Computer Hardware Assembly and Maintenance 27


Data Representation in the Computer

3.3.1 ASCII (American Standard Code for Information Interchange)


ASCII stands for American Standard Code for Information Interchange. Computer can
Notes
only understand numbers. ASCII code is the numerical representation of a character such
as 'a' or @ or an action of some sort. ASCII was developed long time ago and now the non
printing characters are rarely used for their original purpose. Below is the ASCII
character table and this includes description of first 32 non printing characters. Table 3.2
shows ASCII table.

Table 3.2:ACII Table

ASCII Hex Symbol ASCII Hex Symbol


0 0 NUL 25 19 EM
1 1 SOH 26 1A SUB
2 2 STX 27 1B ESC
3 3 ETX 28 1C FS
4 4 EOT 29 1D GS
5 5 ENQ 30 1E RS
6 6 ACK 31 1F US
7 7 BEL 32 20 (space)
8 8 BS 33 21 !
9 9 TAB 34 22 ''
10 A LF 35 23 #
11 B VT
36 24 $
12 C FF
37 25 %
13 D CR
38 26 &
14 E SO
39 27 '
15 F SI
40 28 (
16 10 DLE
41 29 )
17 11 DC1
42 2A *
18 12 DC2
43 2B +
19 13 DC3
20 14 DC4 44 2C ,

21 15 NAK 45 2D -

22 16 SYN 46 2E .
23 17 ETB 47 2F /
24 18 CAN 48 30 0

28 Computer Hardware Assembly and Maintenance


Data Representation in the Computer

ASCII Hex Symbol ASCII Hex Symbol

49 31 1 79 4F O Notes

50 32 2 80 50 P
51 33 3 81 51 Q
52 34 4 82 52 R
53 35 5 83 53 S
54 36 6
84 54 T
55 37 7
85 55 U
56 38 8
86 56 V
57 39 9
87 57 W
58 3A :
88 58 X
59 3B ;
89 59 Y
60 3C <
61 3D = 90 5A Z

62 3E > 91 5B [

63 3F ? 92 5C \
64 40 @ 93 5D ]
65 41 A 94 5E ^
66 42 B 95 5F _
67 43 C 96 60 `
68 44 D
97 61 a
69 45 E
98 62 b
70 46 F
99 63 c
71 47 G
100 64 d
72 48 H
101 65 e
73 49 I
102 66 f
74 4A J
103 67 g
75 4B K
76 4C L 104 68 h

77 4D M 105 69 i
78 4E N 106 6A j

Computer Hardware Assembly and Maintenance 29


Data Representation in the Computer

ASCII Hex Symbol ASCII Hex Symbol


Notes 107 6B k 118 76 u

108 6C l 119 77 v

109 6D m 120 78 w

110 6E n 121 79 x

111 6F o 122 7A y

112 70 123 7B z

113 71 p 124 7C {

114 72 q 125 7D |

115 73 r 126 7E {

116 74 s 127 7F ~

117 75 t

3.3.2 EBCDIC
EBCDIC (Extended Binary Coded Decimal Interchange Code) is a character encoding
set used by IBM mainframes. EBCDIC uses the full 8 bits available to it. So, parity
checking cannot be used on an 8 bit system. Also, EBCDIC has a wider range of control
characters than ASCII.
The character encoding is based on Binary Coded Decimal (BCD). The contiguous
characters in the alphanumeric range are formed up in blocks of up to 10, from 0000
binary to 1001 binary. Non alphanumeric characters are almost all outside the BCD
range. There are four main blocks in the EBCDIC code page: 0000 0000 to 0011 1111
is reserved for control characters; 0100 0000 to 0111 1111 are for punctuation; 1000
0000 to 1011 1111 for lowercase characters and 1100 0000 to 1111 1111 for uppercase
characters and numbers.

INTEXT QUESTIONS 3.2


Fill in the blanks:

6. Nibble = ................. bits.


7. Octal numbers uses digits from ................. to .................
8. Character representation in computer is done by using ................. code.
9. ASCII stands for .................
10. EBCDIC stands for .........................

30 Computer Hardware Assembly and Maintenance


Data Representation in the Computer

WHAT YOU HAVE LEARNT


Notes
In this lesson, you have learnt that computer understands only binary value, 0 or 1. You
can convert decimal number into binary number using division method. You can also
convert decimal numer into octal or hexa decimal number and vice versa. You have also
learnt that character and number represention in computer.

Some of the keypoints to remember


z Data representation refers to the method used to represent information stored in a
computer.
z Decimal number system uses digits 0 to 9
z Binary number system uses digits 0 and 1
z Octal number system uses digits 0 to 7
z Hexa decimal number system uses digits 0 to 9 and A to F.

TERMINAL EXERCISE
1. Convert the following decimal number into binary number.
a) 333 b) 24 c) 643
2. Convert the following decimal number into octal number.
a) 422 b) 78 c) 36
3. Convert the following decimal number into hexadecimal number.
a) 92 b) 54 c) 39

ANSWERS TO INTEXT QUESTIONS

3.1
1. Binary ( 0 or 1) 2. Two 3. 7

4. 10 5. A

3.2
6. 4 7. 0 to 7
8. ASCII
9. American Standard Code for Information Interchange
10. Extended Binary Coded Decimal Interchange Code.

Computer Hardware Assembly and Maintenance 31

You might also like