# REPRESENTATION OF DATA

## REPRESENTATION OF DATA

All storage in modern digital computers is two state. This means that the smallest unit of the store is a device which can be set to one of two states and will stay in this state for as long as required.

Examples of two-state devices used as stores

1- A circuit known as a bistable which can be put either into a state where it outputs 5 volts or into another stale where it outputs 0 volts.

2- A 'magnetic bubble', a small area of material which can be magnetized either in the opposite direction to the surrounding material or in the same direction.

Usually the two states are represented by 1 and 0. A single 1 or 0 is a binary digit or bit. Each location of the immediate access store contains a number of bits. A word is the group of bits treated by a given computer as its working unit. Each location will contain one word.

A byte is a small group of bits treated as a unit. It is usually the number of bits needed to store one character. In many systems a byte consists of eight bits.

A character is a symbol such as a letter, a punctuation mark, a digit of a number, etc.

Alphanumeric characters are the letters of the alphabet and the digits 0 to 9 . In practice an alphanumeric character set will also usually include punctuation and other symbols such as £, +, &, etc.

Graphics characters-on some systems pictures and graphs are built up by printing carefully chosen characters of various shapes. These are called graphics characters.

Control characters-some devices, particularly printing devices, can be controlled by sending them special characters called control characters. These are not printed but instead cause the device to carry out some special function.

## Examples of control characters

1- A character sent to a line printer to cause it to move the paper to another page. 2 A character which causes the screen to clear on a visual display unit.

A character set is the complete set of all the different characters used by a given system.

## Examples of character sets

1- The character set for a computer terminal is all the characters on its keyboard or which it can print.

2- The character set for a computer language consists of all the characters which can be used in writing programs in the language.

A character string is a group of characters which are in an ordered sequence. A bit string is a group of binary digits in sequence.

## What a bit string represents

If a bit string is stored in a computer there are a number of possible things it may represent including:

1- A number.

2- A character or a string of characters.

3- An instruction.

4- The address of a location in store.

## Abbreviations-K and M

K is 1024-short for kilo

M is 1 million - short for mega

Notes:

1- 1024 is the nearest power of 2 to 1000: 1K= 210= 1024.

2- In practice 1 megabyte of store in a computer would be 1 048576 bytes. This is because 1 048 576 = K x K .

## Worked questions

1- How many bits are there in 4K bytes?

Number of bytes in 4K bytes =4 x 1024

= 4096

Number Worked of bits in 4K bytes = 4096x8

=32 768

2- Two computers are advertised. Computer A has 2100K bytes of memory. Computer B has 2 megabytes. Which computer has most store?

Computer A has 2100K bytes Computer B has 2 megabytes

This is 2 x 1024 bytes = 2084K bytes

Computer A has more store