KCSE ONLINE

Esoma Online Revision Resources

Data Representation - Computer Studies Form 3

Data Representation

Concepts of data representation

In 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


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

 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 254

10

to binary
Step 1 Write down the place values up to 2

8

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

7

(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


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


Step 3
The binary equivalent of 254

10

equals 011111110

2


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 1012+ 0012 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

= 110

2


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 10011100

2



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

2


LESSON OBJECTIVES
 

By the end of this lesson the learner should be able to explain:
1 Binary Coded Decimal Code symbolic representation
2 Extended Binary Coded Decimal Interchange Code
3 American Standard Code for Information Interchange

This is a type of representation where a character be it a letter, number or symbol is represented by a group of bits. The most commonly used coding schemes are:
a. Binary Coded Decimal (BCD)
b. Extended Binary Coded Decimal Interchange Code (EBCDIC)
c. American Standard Code for Information Interchange (ASCII)

There are four basic arithmetic operations that can be applied on numbers namely; addition, subtraction, multiplication and division.
In computers all these operations are performed within the CPU by the ALU. It performs the binary arithmetic operations.
In this topic we shall only cover binary addition and subtraction.


In computers we can represent signed binary numbers by prefixing an extra sign bit to a binary number.

In decimal numbers a signed number has a prefix "+" for a positive number and "-" for a negative number.

In binary a positive number may be presented by prefixing a digit 0 and a negative number may be presented by prefixing a digit 1.

Example
A six bit binary equivalent of 2710 is 0110112 to show that it is positive we add an extra bit (0) to the left of the number i.e. (0)0110112 , to show that it is negative we add an extra bit (1) to the left of the number i.e. (1)0110112 . The problem with this method is that 0 can be represented in two ways using six bits as, (0)0000002  and (1)0000002

LESSON OBJECTIVES
By the end of this lesson the learner should be able to:
1. Carry out binary subtraction.



There are four possible subtraction in binary:
{Voice over as text appears}
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 )

There are five possible additions in binary:
a) 0 + 0 = 0 (zero plus zero is zero)
b) 0+12 = 12( one plus zero is one)

c) 12+0 = 12( zero plus one is one)
d) 12+ 12= 102 {one plus one is read as zero carry one}
e) 12+ 12+12=
112(one plus one plus one is read as 1 carry 1)

Example
A six bit binary equivalent of 2710 is 0110112 to show that it is positive we add an extra bit (0) to the left of the number i.e. (0)0110112 , to show that it is negative we add an extra bit (1) to the left of the number i.e. (1)0110112. The problem with this method is that 0 can be represented in two ways using six bits as, (0)0000002 and (1)0000002
There are four basic arithmetic operations that can be applied on numbers namely; addition, subtraction, multiplication and division.
In computers all these operations are performed within the CPU by the ALU. It performs the binary arithmetic operations.
In this topic we shall only cover binary addition and subtraction2

There are only five possible additions in binary
a) 0 + 0 = 0 (zero plus zero is zero)
b) 0 + 12=12(zero plus one is one)
c) 12+ 0=12(one plus zero is one)
d) 12+ 12 = 102(one plus one is read as 0 carry 1)
e) 12+ 12+ 12 = 112 (one plus one plus one is read as 1 carry 1)

Example
To find the sum of 1012 + 0012
Step 1
Arrange the bits vertically as shown below
Figure 48
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
1012 + 0012 equals 1102

The term complement refers to a part which together with another makes up a whole. In Geometry complementary angles add up to 900 e.g. 330 is complementary / complement of 67o.
In binary numbers the ones complement is the bitwise NOT applied to the number. The bitwise NOT is a unary operator ( it operates only on one operand) and performs logical negation to each bit, e.g. The bitwise NOT of 11012 is 00102 , The bitwise NOT of 00000000 is 111111112
In other words 0's are changed (negated) to 1's and 1's are changed (negated) to 0's. This operation is what is referred to as one's complement.

Example; Using 8 bit binary notation, find the ones complement of 2710 Step 1 Convert the absolute value of 2710 into its binary equivalent as illustrated below.

From the table we see that 2710 is equivalent to 110112

Step 2
To convert this answer into an 8 bit binary notation, add zeros to the left as illustrated below.

Step 3
Find the bitwise NOT of the 8 bit answer from step 2.

Step 4
Therefore the ones complement of 2710 using an 8 bit binary notation is 111001002

The main purpose of using ones complement in computers is to enable us perform binary subtraction easily.

Example; To get the difference in 710-410 using the ones complement we proceed as follows.


INTRODUCTION
 

The twos complement of a number is obtained by getting the ones complement then adding 1.
Example 1 : To find the twos complement of 2710
 

Step 1
Convert 2710 into its binary equivalent as discussed earlier.


Thus 2710 is equivalent to 110112

Step 2
To convert this answer into an 8 bit binary notation, add zeros to the left as illustrated below.

Step 3
Find the bitwise NOT of the 8 bit answer from step 2.

Step 4


Add 1 to the right hand side of the ones complement of 2710.


Therefore the twos complement of 2710 is equivalent to 000111012

Example 2: Using twos complement to work out 710-410 in binary form
Step 1:Rewrite the problem (710-410) as 710 +(-410)
Step 2:Convert 410 into its binary equivalent i.e. The binary equivalent of 410is 000001002
Step 3:Find the ones complement of the binary number in step 2
Step 4:Find the twos complement of the binary number in step 3 NOTE: From the above, the twos complement depicts a negative number.

Step 5:Get the binary equivalent of 710 and add to the twos complement of 410
Therefore the twos complement of 710-410 in binary form equals to 000000112

Introduction

In Form 1 we learnt that the most commonly used computers today are digital computers. We also learnt that data and instructions cannot be entered and processed directly using the natural language, but they must first be converted and transmitted in form of electric pulses represented by two distinct states, ON and OFF. The ON state may be represented by "1" and the OFF state by" 0". These are the only two states that a computer can understand.

The ON and OFF can be converted to a digital signal and can be represented graphically as a square wave as shown below,

Binary Coded Decimal (BCD)
It's a four bit code used to represent numeric data e.g. 7 = 01112 It's used in simple electronic devices such as calculators, watches and microwave ovens.
Its major limitation is that it can only be used to represent a maximum of 16 (24 ) characters.

 

Due to this limitation a standard Binary Coded Decimal, an enhanced format of BCD that represents more characters was developed. It's a six bit representation scheme that could represent up to a maximum of 64 characters, e.g. letter A can be represented as 110002 using standard BCD. Standard Binary Coded Decimal tables

Extended Binary Coded Decimal Interchange Code (EBCDIC)

This is an enhanced form of the standard BCD, it's a eight bit character coding scheme that can represent up to a maximum of 256 (28 ). Its mostly used in computers, e.g the EBCDIC representation for letter A is 100000012

American Standard Code for Information Interchange (ASCII)

This is a seven bit coding scheme that can represent a maximum of 128 (27 ) characters. Due to the limitation of number of characters that could be represented an eighth bit was added to enhance ASCII into an eight bit coding scheme. The maximum number of characters increased to 256 (28 ).


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

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

Sample Coursework e-Content CD

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.

Search

Subject Menu