Thursday, February 28, 2013

Encoding and Decoding


Encoding and Decoding

To encode means to convert information or data into a form ready for processing.

To decode means to convert data back to a form where it can be understood.

Examples of encoding where data is encoded as it is input

1- An interactive program is run on a microcomputer and data is typed in at the keyboard. Circuitry in the keyboard encodes the characters as they are typed in.

2- A microprocessor controls a chemical process. Measurements are taken by instruments connected to the processor. An interface converts the data to binary data which the microprocessor can deal with .

Examples where data is encoded first and then input later

1- Information about foods is encoded into bar codes which are then printed on food labels. This data can then be input via a laser scanner on a point-of-sale (POS) terminal at the checkout .

2- A school sends details of all its new pupils to a computer bureau. There they are keyed on to a floppy disc (for key-to-disc). The disc is then used on the school's computer to add the data to the main files.

Examples of decoding

1- On a school data file, the names of the teachers are stored. For this two letters of each surname are used. Thus Mr Smith is stored as SM, Miss Small as SL and Mr Sanders as SA.

The computer has a reference file of these codes. To print out a name the computer uses the reference file to decode the two letters. It can then print out the full name.

2- An electronic circuit can be made to decode binary numbers into decimal numbers (see for binary numbers).

Worked questions

1- Give three examples of encoding data in such a way that it is both briefer and standardized.

(i) Post codes-a few letters and digits are used to identify any address e.g. SO9 identifies an area of Southampton; SO9 5NH is the University.

(ii) Bank branch numbers-any bank cheque has in the top right-hand corner a number which identifies the bank branch of the person who wrote the cheque e.g. 60-18-46 is the Romsey branch of the National Westminster Bank.

(iii) Dates of birth-these are often written as three two-digit numbers e.g. 03 07 38 would be 3 July 1938.

2- Pupil records for a school include the pupils' dates of birth. A form is filled in for each pupil. Data from the forms is to be entered into a computer. The instructions say 'Enter date of birth as three two-digit numbers-DAYIMONTH/YEAR .. /.. /..'.

For each of the following dates give a reason why they should not be accepted:

(a) 1/2/74

(b) 30/02/75

(c) 19/11/99

(a) 1/2/74 should not be accepted because the day and the month have only one digit each. The date should read 01/02/74.

(b) 30/02/75 is incorrect because this is 30th February and February has only 28 or 29 days.

(c) 19/11/99 is not acceptable as 1999 could not be a pupil's date of birth.