LESSON 1
REPRESENTATION OF DATA
DATA TYPES AND REPRESENTATION
Data is the raw material on which a computer operates. When some structure has been applied to it then the data
becomes information. Data can be coded in several formats.
The above code is pitman script. It reads “the joy of pitman script.” The codes below represent the alphabet
using sign language and Braille. Note codes are appropriate to the needs of the target group.
All kinds of information can be coded, the coding can be visual as in the above sign language, tactile as in the
Braille or even aural as in the music below.
All data for the computer is coded using numbers, consider the music script above the computer can reproduce
this music by simply connecting the computer via a midi interface to an appropriate musical instrument, because
each note is coded as a number as shown below.
Binary System
The binary system has two states: on and off or ‘1’ and ‘0’. It is relatively easy to detect if a system is switched on
or off hence the binary system is ideal for use in modern electronic digital computers.
In the decimal system the number 111 means
100 10 1 whereas in the binary system it means 421
1 11 111
note this has noting to do with the conversion from binary to decimal. It simply highlights the relative value of
each digit.
Groups of binary digits do not have to represent numbers. Computers process several types of data: numbers,
pictures, music, and colours. Binary digits are therefore used to represent such attributes as letters, punctuation
symbols, special characters to control different computer functions or colours on the screen.
In the late 1970’s the first microcomputers were 8 bit machines. This meant that their fundamental unit of data
was eight binary digits. The rapid growth in technology has introduced 16 bit, 32bit, and 64bit microcomputers.
A data representation system called ASCII (American Standard Code for Information Interchange) was set up to
code all data and information on the computer. The 8bit ASCII system is shown below.
Here is hello coded using the ASCII system note the decimal codes as well as the binary codes provided for your
convenience.
Every computer game, program, picture, or sound is stored in the computer as a series of binary digits. Because
humans don’t normally talk binary, if you want to be better at telling a computer what to do, you must learn to
understand binary and hexadecimal.
Terms such as “data representation,” “numbering systems,” and “hexadecimal” might seem intimidating; however,
as with anything new you learn, you just have to become familiar with these terms to understand them. Most
people are born with 10 fingers and 10 toes, so it’s no accident that people are most familiar with the base 10
numbering system. You might have counted on your fingers and even your toes. (Then again, you might still be
counting on your fingers and toes.) If people were born with only two fingers and two toes, maybe this computer
binary thing would be easier to understand. In any case, understanding numbering systems is quite simple if you
just take a deep breath, relax, and go through it one step at a time.
Before you get into numbering systems and data representations, think back to a concept you learned in
elementary school: powers of numbers.
You might remember that 2 squared equals 4 and is displayed with the power as a superscript, as 2 2. Remember
that raising a number to a positive power simply means multiplying that number by itself the number of times
specified by the power indicator (often called an exponent). The number 2 3, for example, is just 2 * 2 * 2. The
number 2 is multiplied by itself 3 times, giving a value of 8. In working with computers, multiplication is
represented with an asterisk (*).
That’s all there is to positive powers, with the exception of two special cases: the exponents (powers) 0 and 1.
First, raising a number to the 0 power always results in 1, no matter what the original number was. The number
100is 1. The number 20 is also1. Second, raising a number to the 1 power always results in the number itself. So 2 1is
always 2, and 161is always 16.
Numbers can also be raised to negative powers, which are used to represent fractional portions of numbers.
Raising a number to a negative power is similar to raising it to a positive power, with one final step. After you
multiply the number as many times as specified by the exponent, you divide that result into1. The number 2 -3is 1
divided by 2 cubed (2 * 2 * 2) and is equivalent to 125.For 10-4, the calculation is 1 / (10 * 10 * 10 * 10), or .00001.
In other words, you multiply 10 by itself 4 times, which gives you 10,000. Then divide that value into 1.
When you count in base 10, you start with 0 and count up to 9. Because there aren’t any more digits after 9, you
have to put a 1 in the tens column and then go back to 0 in the ones column, as shown in the following example:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,..., 99, 100
The process of counting in this manner is the same for any base. In base 2, you start counting at 0 and then go to 1.
When you get to 1, you have run out of digits, as you did at 9 in base 10. So you put a 1 in the twos column and go
back to 0 in the ones column. When you get to 11, you have to go to 100, as you do with 99 in decimal:
0, 1, 10, 11, 100, 101, 110, 111, 1000
Base 16 (hexadecimal) has more digits than base 2 or base 10. Counting still starts at 0 and continues in the same
column until you reach the highest possible value, F. Then you put a 1 in the sixteens column and set the ones
column back to 0:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12,..., FF, 100
The positional value of numbers in base 10.
The positional value of a number in base 2.