#### Order this CD Today to Experience the Full Multimedia State of the Art Technology*!*

Data Representation

Concepts of data represetationIn digital computers, data is handled by the peripheral devices in form of electronic circuits, magnetic form and optical form

Background

In digital computers, data is handled by the peripheral devices in form of electronic circuits, magnetic form and optical form

Binary number system

It has only 2 digits, that is '1' or '0' as earlier discussed.The binary number system is also a positional notation numbering system, but in this case, the base is not ten, but instead two. The following is an example of a binary number.

Each digit position in a binary number represents a power of two. For example considering the following binary number one one zero one zero base two

The positional notation of the this binary number can be presented as follows.

Starting from the right, the position value of 0 is 20, the position value of the next 0 is 21, the position value of 1 is 22, the position value of 0 is 23, the position value of 1 is 24, the position value of 1 is 25.

Note that place value of binary numbers goes up by in factors of two from right to left. The rightmost digit is the least significant bit and the left most bit is the most significant bit.

Octal Number system

Octal and hexadecimal number systems are higher number systems than decimal and binary number systems, instead of transmitting in digits of 1's and 0's between devices, the data can be encoded as octal or hexadecimal to improve transmission efficiency, a single octal or hexadecimal digit encodes more than one binary digit, this is automatic data compression hence storage media can save space.

This number system uses eight numbers ranging from 0 to 7.

Place value of octal numbers goes up in factors of eight from right to left.

An octal number is written with a base of 8 e.g. 1238

Hexadecimal Number system

This number system uses sixteen numbers ranging from 0 to 9 and letters A to F representing numbers 10 to 15 respectively.
Place value of hexadecimal numbers goes up in factors of sixteen.

Hexadecimal numbers have a base or radix of 16 e.g. 47

16

It is known as Base 16 system.

The following are some additional examples of hexadecimal numbers

INTRODUCTION

So far we have introduced the basic concepts of four number systems we have learnt; now we shall have a detailed look of how we can convert numbers from one system to another.

Conversion of Binary to Decimal

Converting a number from binary to decimal is quite easy. All that is required is to find the decimal value of each binary digit position containing a '1' and add them up.

Example 1: Let's convert to decimal the binary number 1011012.

To convert a binary number to decimal number, we proceed as follows: a) Write the place values of each digit starting from the right hand side to the left hand side, then multiply each digit by its corresponding place value.

b) Add up the products, the answer will be the decimal number in base 10.

Convert the following binary numbers to decimal numbers

a. 10111012

b. 111.0012

c. 1112

d. 0101.11002

INTRODUCTION

In the last lesson we learnt how to convert binary numbers into decimal numbers, in this lesson we will learn how to convert the decimal numbers into binary numbers.There are two methods used for converting a decimal number to binary.

a) Using successive/long division method

b) Using the place value method

INTRODUCTION

In the last lesson we learnt how to convert binary numbers into decimal numbers, in this lesson we will learn how to convert the decimal numbers into binary numbers.There are two methods used for converting a decimal number to binary.

a) Using successive/long division method

b) Using the place value method

This method is much easier to understand when visualized on paper. It relies only on division by two. The decimal number is continuously divided by 2, at each level of the division, the remainders which will always either be a 1 or a zero 0 is written to the right of the quotient. Read the series of the remainder digits starting from bottom upwards.

(i).Write the decimal number as the dividend inside an upside-down "long division" symbol. Write the base of the destination system (in our case, "2" for binary) as the divisor outside the curve of the division symbol.

(ii).Write the integer answer (quotient) under the long division symbol, and write the remainder (0 or 1) to the right of the dividend.

(iii).Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is 0.

(iv).Starting with the bottom remainder, read the sequence of remainders upwards to the top. You should have 100111002. This is the binary equivalent of the decimal number 156.

This can be illustrated in a table as shown Figure 35

Example 2: Let's convert the decimal fraction 156.62510 to binary.

Step 1

We have already learnt how to convert a whole decimal number into its binary equivalent, from the first example note that the whole part of the above decimal fraction is 15610 which is equivalent to 100111002

Step 2

Convert the fraction part (.62510) of the decimal number to binary{Voice over as text

(i). Multiply the decimal fraction (.625) by 2.

Zero point six two five times two equals one point two five

(ii). Disregard the whole number part of the previous result (the 1 in this case) multiply the fraction part (.25) of the product by 2 again. The whole number part of this new result is the second binary digit to the right of the point. We will continue this process until we get a zero as our decimal part or until we recognize an infinite repeating pattern.

The second binary digit to the right of the point is a 0.

So far,.625 = .10?? . . . (Base 2)

(iii). Disregarding the whole number part of the previous result (note that this result was .50 so there actually is no whole number part to disregard in this case), we therefore multiply (.50) by 2 once again. The whole number part of the result is now the next binary digit to the right of the point.

{Voice over as text appears on screen followed by animations [drop in] of Figure 37

The third binary digit to the right of the point is a 1.

[slide48]

So now we have .625 = .101?? . . . (Base 2).

{Voice over as text appears on screen below the objects on the screen}

(iv). We are finished in Step 3, because we had 0 as the fractional part of our result there. In this step equate the decimal fraction to its binary equivalent as shown below

{Voice over as text appears on screen followed by Figure 39 [below] dropping in time below the text}

(v). Add the whole part binary equivalent to the fraction part binary equivalent

{Voice over as text appears on screen followed by Figure 40 dropping in time below the text}

Therefore the binary equivalent of 156.62510 {animate first object containing the number} equals {animate the second object with the = sign} to 10011100.1012 {animate the last object with the binary number}

Example 1: Let's convert the decimal number 15610 to binary.

(i).Write the decimal number as the dividend inside an upside-down 'long division' symbol. Write the base of the destination system (in our case, '2' for binary) as the divisor outside the curve of the division symbol.

(ii).Write the integer answer (quotient) under the long division symbol, and write the remainder (0 or 1) to the right of the dividend.

(iii).Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is 0.

(iv).Starting with the bottom remainder, read the sequence of remainders upwards to the top. You should have 100111002. This is the binary equivalent of the decimal number 156

10

. This can be illustrated below.Using successive /Long division method

This method is much easier to understand when visualized on paper. It relies only on division by two. The decimal number is continuously divided by 2, at each level of the division, the remainders which will always either be a '1' or a zero '0' is written to the right of the quotient. Read the series of the remainder digits starting from bottom upwards.

Example: Using the place value method lets convert 25410 to binary

{Voice over as text appears below the table}

Step 1

Write down the place values up to 28 (256) which is the number immediately larger than 254 because 27 (128) is smaller than the 254.

Step 2

Starting from the left, subtract the place value from the number being converted, if the difference is a positive number or a 0, place 1 in the binary digit row, if the difference is negative place a 0 in the binary digit row as illustrated in the table below.

Binary digit 0 1 1 1 1 1 1 1 0

Note that when the difference is negative the number is the carried forward to the next lower place.

Step 3

The binary equivalent of 25410 equals 0111111102

{Voice over as text appears together with animation of the following objects, below the text}

Other number conversions are:

a. Conversion of binary and decimal numbers to octal and hexadecimal numbers

b. Conversion of octal numbers to hexadecimal numbers.

c. Conversion of octal and hexadecimal numbers to binary and decimal numbers

{voice over as text appears on screen}

For more information on the above number conversions refer to Longhorn Secondary Computer Studies pages9 to 22

Using Place Value method

To convert a decimal number to binary using the place value method, write down the place values of the binary in factors of 2 up to the value immediately larger or equal to the number being considered.Example: Using the place value method lets' convert 25410

to binaryStep 1 Write down the place values up to 2

8

(256) which is the number immediately larger than 254 because 27

(128) is smaller than the 254.Step 2

Starting from the left, subtract the place value from the number being converted, if the difference is a positive number or a 0, place 1 in the binary digit row, if the difference is negative place a 0 in the binary digit row as illustrated in the table below.

Binary digit 0 1 1 1 1 1 1 1 0

2

Step 3

The binary equivalent of 254

10

equals 0111111102

Other number conversions are:

a. Conversion of binary and decimal numbers to octal and hexadecimal numbers

b. Conversion of octal numbers to hexadecimal numbers.

c. Conversion of octal and hexadecimal numbers to binary and decimal numbers

INTRODUCTION

There are four possible subtraction in binary:

a) 0 - 0 = 0 (zero minus zero is zero)

b) 12 - 0 = 12 ( one minus zero is one)

c) 12 - 12 = 0 (one minus one is zero)

d) 102 - 12 = 12 (Borrow 1 from the next most significant bit to make 0

become 102 , hence 102 - 12 = 12 )

To find the sum of **101**2**+ 001**2 **Step 1**

Arrange the bits vertically as shown below

**Step 2**

Work from right to left as follows;One plus one is zero carry one , one plus zero plus zero is one, lastly one plus zero is one

Therefore;**101
**

**2**

**+ 001**

2

= 1102

Concept of data representation in an electronic circuit

We have already seen the representation of digital signals in form of electric pulses

Magnetic Media

Just like in digital circuits, the presence of a magnetic field in one direction on a magnetic media is interpreted as '1',while the field in the opposite direction is interpreted as '0'.

Optical Media

In optical devices, the presence of light is interpreted as '1' and the absence of light is interpreted as '0'. Optical devices use this technology to read or store data, for example a CD-ROM.The shinny surface when placed under a microscope has very tiny holes called pits. The areas that do not have pits are called lands.

The following Figure shows a laser beam reflected from the lands and pits, when the red arrow falls on a land its reflected and its interpreted as '1' when the blue arrows falls on pit its not reflected and its interpreted as '0'.

Reasons for use of Binary systems in computers

Due to the complexity of natural language computers do not understand or process human language directly. The human language must be first converted to a language the computer understands called the machine language before it can be processed. This language is in form of '1's and '0's. The following illustration shows the binary equivalent of the word "THE BINARY".

Example the word "THEN" is recognised by the computer as follows:

Use the letters given i.e. THE BINARY to make your own words and their binary conversions.

e.g. BRAIN.

Bits

The '0's and '1's are the BInary digiT also known as BIT. A bit is the smallest "unit" of data on a binary computer, which can either be a 'zero' (0) or a 'one' (1).

Byte

A group of eight bits makes BYTE

NIBBLE

A NIBBLE is a collection of four bits otherwise also known as half a byte.

WORD

A WORD is a group of 16 bits or more.

Two bytes can make a word as illustrated below.

WORD LENGTH

WORD LENGTH is the number of bits in a word. e.g. A 16 bit Word and a 32 bit Word have a word lenght of 16 bits and 32 bits respectively.

In the previous lesson, we learnt that computers can only understand machine language which is in form of '0's and '1's.

INTRODUCTION

Although computers understand binary numbers, complex types of data such as sounds and pictures can be represented using higher number systems to reduce the long strings of binary codes that take a lot of memory and processor time.The higher number system reduces streams of binary into manageable form which helps to improve the processing speed and maximise memory usage.The following picture illustrates that complex data such as sounds and pictures must first be converted into binary before being processed by the computer.

Number system is a set of symbols used to represent values with a common base

Decimal Number system

You've been using the decimal (base 10) numbering system for so long that you probably take it for granted. When you see a number like '123'; you don't think about the value 123; rather you generate a mental image of how many items this value represents. In reality however the number 123 represents

When we write decimal (base 10) numbers, we use a positional notation system. Each digit is multiplied by an appropriate power of 10 depending on its position in the number. We note that the place value of decimal numbers increases by factors of ten

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 the familiar zero through nine (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9). In a positional notation system, the number base or the base of a number is also called the radix.

Because this system has ten digits it's also called a **base ten number system.** Other examples of decimal numbers are:

By the end of the lesson the learner should be able to;

- Convert binary number to decimal number

NUMBER CONVERSION

Example 2: Let's convert the decimal fraction 156.625

10

to binary.Step 1

We have already learnt how to convert a whole decimal number into its binary equivalent, from the first example note that the whole part of the above decimal fraction is 156

10

which is equivalent to 100111002

Step 2

Convert the fraction part (.62510) of the decimal number to binary (i). Multiply the decimal fraction (.625) by 2.

So far we have .625 = .1 . . (Base 2).

(ii). Disregard the whole number part of the previous result (the 1 in this case) multiply the fraction part (.25) of the product by 2 again. The whole number part of this new result is the second binary digit to the right of the point. We will continue this process until we get a zero as our decimal part or until we recognize an infinite repeating pattern.The second binary digit to the right of the point is a 0.

So far we have .625 = .10 . (Base 2).

(iii). Disregard the whole number part of the previous result (note that this result was .50 so there actually is no whole number part to disregard in this case), we therefore multiply (.50) by 2 once again. The whole number part of the result is now the next binary digit to the right of the point.The third binary digit to the right of the point is a 1.

So now we have .625 = .101 (Base 2).

(iv).We are finished in Step 3, because we had 0 as the fractional part of our result there. In this step equate the decimal fraction to its binary equivalent as shown below:

(v). Add the whole part binary equivalent to the fraction part binary equivalent

Therefore the binary equivalent of 156.625

10

equals to 10011100.1012

##### Other Goodies for KCSE ONLINE Members*!*

Coursework **e-Content CD **covers all the topics for a particular class per year and costs **1200/-** ( Per Subject per Class ).

Purchase Online and have the CD sent to your nearest Parcel Service. Pay the amount to Patrick **0721806317** by **M-PESA** then provide your address for delivery of the Parcel.
Alternatively, you can use **BUY GOODS TILL NUMBER 827208 **Ask for clarification if you get stuck.

###### Install ADOBE Flash Player for Best Results

For Best results **INSTALL Adobe Flash Player** Version 16 to play the interactive content in your computer. Test the link below to find out if you have Adobe Flash in your computer.