You are on page 1of 122

THE BASIC COMPONENTS OF COMPUTERS

WHAT IS A COMPUTER?

A computer is an electronic device that can accept data and instructions, process them or
store them for later retrieval, and sometimes generate output (usually based on the
processing).

ADVANTAGES OF USING COMPUTERS


1. Computers can perform calculations much more quickly and accurately than
humans.
2. Large amounts of data can be stored in a small amount of space.
3. Computers can work continuously and perform repetitive tasks well. Unlike their
human counterparts, computers do not get bored or tired.
4. Computers can simulate things that would take too long, be too dangerous or
simply impossible for humans to attempt.

DRAWBACKS OF USING COMPUTERS


1. The introduction of computers can cause redundancy in the workplace.
Employees may lose their jobs if a computer can do a job more efficiently and
ultimately more cheaply.
2. Computers make it easy for people to misuse information. Computers make it
easy to store large amounts of information about people. In some cases this
information can be freely and easily accessed and used for purposes for which it
was not originally intended.
3. Down time is when a computer breaks down or data becomes corrupted.
Businesses often rely so much on technology that when computers fail that have
no back-up manual systems and are temporarily rendered helpless as a result.
4. The introduction of computer systems in the workplace is expensive.
5. There is health risks associated with excessive or improper use of computers.

COMPUTER SYTEMS
A computer system is a combination of computer hardware and software. The hardware
consists of the physical components of the computer, such as the monitor or the
keyboard. In other words the parts of the computer you can touch are all hardware.

Page 1 of 122
Software is the term that is used to refer to the programs that run on the hardware.
Neither one is much use without the other, since without hardware you would not be able
to run software and without software you would just have an expensive piece of
equipment that does nothing.

A DIAGRAM OUTLINING HOW THE TYPICAL COMPUTER SYSTEM


FUNCTIONS

INPUT, OUTPUT, PROCESSING AND STORAGE

There are four stages when entering data (facts and figures), input, output, processing and
storage.

 INPUT- This is when raw data is input or entered into the computer.
 PROCESSING – At this stage the raw data is processed using the instructions
given in a program to make the output.
 OUTPUT – At this stage the information that was processed is ready for output
either as HARDCOPY OR SOFTCOPY.
 HARDCOPY – printed output from a computer.
 SOFTCOPY – seen on the monitor.
 STORAGE – After the data is processed, before it is output it can be stored for
later use.
The process described above is known as the COMPUTER SYSTEM.

CATEGORIES OF COMPUTER HARDWARE

Page 2 of 122
There are four main categories of computer hardware:
1. The Central Processing Unit (CPU)
2. Input devices, which allow data to be entered into the computer
3. Output devices, which are used for outputting (‘sending out’) data from the
computer
4. Storage devices, both primary and backing.

THE CENTRAL PROCESSING UNIT (CPU)


As the name suggests, the Central Processing Unit (CPU) is the part of the computer that
does the processing. It also controls the transfer of data between memory and the other
devices that make up the computer system. The CPU consists of:
• The Control Unit (CU)
• The Arithmetic Logic Unit (ALU)
• Memory

THE CONTROL UNIT (CU)


The Control Unit (CU) is the main part of the CPU, which controls the operations of the
CPU. It is used:
1. To direct the operations of the internal processor components (components that
process the data)
2. To control the flow of programs and data in and out of the primary memory (main
memory)
3. To read and interpret program instructions (instructions that allow the computer to
perform various tasks)
4. To control the flow of information to and from all the components of the
computer, e.g. input and output devices (I/O devices), disk drives and printers.

THE ARITHMETIC / LOGIC UNIT (ALU)


This is the part of the CPU that does the following:
1. Performs arithmetic operations. These operations include addition, subtraction,
division, multiplication, etc.
2. Performs logical operations. These operations include reasoning and performing
the comparison necessary to make decisions.

CENTRAL PROCESSING UNIT


The CPU of a computer can be divided into 3 main parts:
1. MEMORY
2. CONTROL UNIT (CU)

Page 3 of 122
3. ARITHMETIC LOGIC UNIT (ALU)

ALU

INPUT OUTPUT
DEVICE DEVICE
CU

MEMORY
UNIT

STORAGE DEVICES
Memory of a computer is used for storing programs and data. There are two types of
storage devices, they are:
1. PRIMARY STORAGE (MAIN MEMORY/IMMEDIATE ACCESS STORAGE)
There are two types of primary storage:
 RANDOM ACCESS MEMORY (RAM). The contents in this type of
memory are temporary and are lost when the computer is turned off (the data is
VOLATILE). RAM is used to store the instructions and data for currently running
programs and the operating system.
 READ ONLY MEMORY (ROM). This type of memory is permanent and the
data stored in it is not lost when the computer is turned off (the data is NON-
VOLATILE). ROM is used to store data that must not be lost even when the computer
is turned off, such as the commands which start up (boot up) the computer. These
instructions are programmed into the ROM chips by the manufacturers.

Page 4 of 122
2. SECONDARY STORAGE (BACKING STORAGE/AUXILIARY STORAGE
DEVICES)
Unlike primary storage, secondary storage is not done on chips. Some examples
are:
 Hard disks
 Magnetic tape
 Floppy disks
 Microfilm
 CDs
 DVDs
These devices are used to store programs, as well as data that is not being
processed, for later retrieval.

PERIPHERAL DEVICES
Peripherals device are those hardware devices that are externally connected to the
computer system.
TYPES OF COMPUTERS

Computers can be grouped into supercomputers, mainframes, minicomputers, and

microcomputers. These are grouped roughly in order of size and speed.

1. SUPERCOMPUTER is the general term given to the fastest computers in the

world. These computers are very large and may take up several rooms. Because

of their tremendous processing power, supercomputers are used in fields that

require vast amounts of complex mathematical calculations, such as simulating

and nuclear research.

2. MAINFRAME- like supercomputers, mainframes are very fast large-scale

computer systems. Mainframes have a large number of terminals and peripheral

Page 5 of 122
devices because they are used simultaneously by hundreds of persons. To meet

the demands of the large number of users, they have a large memory and large

storage capacity.

3. MINICOMPUTER – a minicomputer is a multipurpose computer system that is

smaller and slower than a mainframe. Minicomputers support fewer users than

mainframes. The distinction between the two is based mainly on size and number

of users.

4. MICROCOMPUTER – is a term used to refer to computers that contain a

microprocessor. You know this type of computer by it familiar name - the PC.

Microcomputers come in different types and sizes:

 The desktop

 The Laptop

PRIMARY STORAGE DEVICES AND MEDIA

RANDOM ACCESS MEMORY (RAM)


The content of RAM can be randomly accessed. This means that data from any location
in RAM can be accessed when needed instead of having to go through each location in
order until you get to the one you want. What is not apparent from its name, however, is
the fact that not only can the contents of RAM be read – they can also be written to.
The contents of RAM are lost when the computer is turned off.

READ ONLY MEMORY (ROM)


The contents of ROM cannot be changed when the ROM is being used by the computer.
They can only be read; hence the term read only. The contents of ROM are not lost when
the computer is turned off. As a result, ROM is used to store the commands and data that

Page 6 of 122
are executed each time the computer is turned on. Like RAM, the contents of ROM can
be accessed randomly.

Other types of ROM

PROGRAMMABLE READ ONLY MEMORY (PROM)


This type of ROM can be programmed with a special machine as opposed to using the
expensive masks needed to produce large volumes of ROM chips. Once a PROM chip is
programmed, however, its contents cannot be changed.

ERASABLE PROGRAMMABLE READ ONLY MEMORY (EPROM)


This type of ROM is designed so that its contents can be erased using ultra-violet light.
Then the chip can be reprogrammed. This can be done several times as opposed to a
ROM chip which can only be programmed once.

TECHNICAL TERMS USED WITH THE STORAGE OF DATA

 A BIT is a unit of storage that has two possible values, 0 and 1. It is the smallest
unit.
 A BYTE is a group of eight bits or one character
 A WORD is the size of data (or instruction) that the CPU can handle in a single
cycle
 WORD LENGTH/ WORD SIZE – the number of bits in a word.
 ADDRESS – the identification of a particular location in the memory where data
or instruction is stored.
 ADDRESS CONTENT – the data or instruction that is stored in a given address.
 CHARACTER – any digit, letter or symbol.

Page 7 of 122
BISTABLE DEVICES
A BISTABLE device is a device that can exist in one of two possible states. It can be
compared to an on/off switch. You would have already come across something that exists
in two states – a BIT. A Bit is a bi-stable device. Another example of a bi-stable device
is a key on a keyboard – it can be either up or down.

NUMBER OF BYTES
TERM SYMBOL APPROXIMATE ACTUAL
KILOBYTE KB 1,000 1 thousand 210 (1024)

MEGABYTE MB 1,000,000 1 million 220 (1,048,576)


GIGABYTE GB 1,000,000,000 1 billion 230 (1,073,741,824)
TERABYTE TB 1,000,000,000,000 1 trillion 240 (1,099,511,627,776)

COMPUTER DEVICES FOR INPUT AND OUTPUT

INPUT DEVICES

Input devices accept data signals and translate them for usage and storage in the computer
system.

POINTING DEVICES

1. The MOUSE is your pointing device. As you move the mouse on its pad, a

pointer on the monitor screen moves in the same direction as the mouse does.

2. A JOYSTICK is a lever that can give you a similar control over things on the

screen, but its behaviour is different from that of a mouse. The joystick is more

than just a pointing device.

Page 8 of 122
3. A TRACK PAD is a small, flat, square pad below the space bar, upon which you

place your finger. As you move your finger across the track pad’s surface, the

pointer moves across the screen.

4. A LIGHT PEN looks like a pen with a wire attaching it to the computer system.

When you point at a position on the screen, the software can find the exact

position being indicated, and so you can select, activate and manipulate items on

the display, just as with a mouse.

5. A GRAPHICS TABLET or GRAPHICS PAD is a flat rectangular pad between 6

and 30 inches wide. It works with a stylus which you move along the surface of

the pad, to produce drawings in the computer. The graphics tablet is used mainly

for COMPUTER-AIDED DESIGN (CAD) and drawings.

SCANNERS
A scanner reads picture-type information into the computer. There are a number of

different devices referred to as scanners.

1. A HAND-HELD SCANNER reads in the picture while being dragged over it.

2. A FLATBED SCANNER, the original picture is laid flat upon the scanner’s

surface, and the picture is captured in a similar manner to that of a photocopy

machine.

3. A SHEET-FED SCANNER feeds the original picture in through rollers. The

scanner reads the picture as the paper goes through. The original must be on a

flexible sheet of paper.

Page 9 of 122
4. A BARCODE READER is a device that reads a pattern of bars representing the

code number of the item on which it is printed. The barcode reader usually passes

a small laser beam over the pattern and reads in the pattern off reflected light.

5. A MAGNETIC STRIPE READER scans information in the form of a magnetic

stripe, usually on the surface of a card such as a bank card or credit card.

6. An OPTICAL MARK READER (OMR) can recognize the position of a mark or

set of marks on paper. Usually used in the correction of multiple choice papers.

7. OPTICAL CHARACTER RECOGNITION (OCR) is a device that senses the

presence of text by recognizing the characters. When the document is scanned, a

photo-electric device reads the characters, which are then converted to electrical

signals. The signals represent patterns that give an indication of the characters

involved. It is used in reading postal codes.

8. MAGNETIC-INK CHARACTER RECOGNITION (MICR) identifies data

printed using special ink having good magnetic qualities used in the processing of

bank cheques.

9. POINT OF SALE TERMINALS (POS) – these are terminals to which input

devices like bar code readers are connected, that process transactions as soon as

the data is read, i.e. at the “point of sale”. Such a terminal is known as a Point Of

Sale Terminal. It is connected to a database that allows it to retrieve and update

information about a product. Cash registers can be a point of sale terminal.

OTHER DEVICES

Page 10 of 122
1. The TOUCH SCREEN/TERMINAL – a touch screen/terminal is a light sensitive

screen that can detect when a person touches it, as well as the area of the screen

that was touched. Various options are available on the screen and the user presses

the one he/she wants. The system uses the location of the area that was pressed to

determine the correct option. It is very easy to use and as a result, users do not

require training.

2. The MICROPHONE is a device that functions in much the same way as the

microphone you see used on stage. When you talk your sound waves causes a

diaphragm to vibrate. These vibrations are converted into electrical impulses that

are then transmitted to the computer. One application for which a microphone is

used is in Voice Data Entry (VDE).

3. VOICE DATA ENTRY (VDE) is the process by which a person speaks to the

computer through a microphone as a means of entering data. A voice recognition

program converts the spoken words into text.

4. KEY-TO-DISK SYSTEM – consists of a keyboard, a screen and a disk, as well as

a processor to verify and validate that data. A data-entry clerk types in the data

using the keyboard. The data may be typed a second time in order to verify it.

The data is then saved on a disk. The data from the disk can then be transferred to

the high-speed computer in an entire batch. This is a form of batch data entry.

5. The DIGITAL CAMERA is a device that utilizes a lens in order to take a


photograph by capturing light on some sort of media. Digital cameras use digital
methods to capture and store images. The data is then stored on a digital media
such as memory cards, floppy disks, etc.

Page 11 of 122
Page 12 of 122
INPUT DEVICES: ADVANTAGES AND DISADVANTAGES

MANUAL INPUT DEVICES


INPUT DEVICE ADVANTAGES DISADVANTAGES
KEYBOARD  Most common means of  Data entry can be time-
entering text consuming
 Relatively inexpensive  Continued use can
cause repetitive strain
injury
 Errors in transcription
are common
 Speed of input depends
on the user’s experience
MOUSE  Commands can be given  Hand-to-eye
directly to the computer coordination can be a
 Can activate commands problem
by selecting icons  Shifting between
directly keyboard and mouse
can be confusing
JOYSTICK  Ideal for games such as  User has to become
car racing skilled at the sensitive
movement of the
joystick
TOUCH SCREEN  User-friendly  A limited number of
 Easy way to input values can be displayed
options and choices on one screen at a time
 Can be used by children  More expensive than a
and the physically standard monitor
challenged who are
unable to use other input
devices
SCANNER  Relatively cheap and  The quality of the
easy to install image depends on the
 Depending on use, flat quality of the hard
bed or hand-held copy, scanner and
scanners can be chosen scanner software
KEY-TO-DISK  Data can be prepared off-  Requires many human
line and computer resources
 Data can be validated by  Expensive
the program as it is being
entered
VOICE  The user can speak at  The voice recognition
RECOGNITION normal rates for dictation system must be trained
SYSTEM to recognise voice
patterns
 Software cannot

Page 13 of 122
interpret all English
meanings

DIRECT DATA ENTRY DEVICES


INPUT DEVICE ADVANTAGE DISADVANTAGE
BARCODE READER  Fast and accurate in  Details and the order of
product data stored on the strip
identification cannot be changes
easily
 Data can be input
much faster than it  The price of the product
takes to be keyed in in not included in the
barcode
 Not easily damaged
and can normally
still be read if they
care creased or not
stuck onto a flat
surface

 Can be printed using


a normal printer and
ink and so are cheap
to produce

POINT OF SALE  Large amounts of  Same limitations as for


data can be input barcode reader
very quickly and
accurately

OPTICAL CHARACTER  Can speed up the  Accuracy of the text


RECOGNITION (OCR) typing process can be poor

 Not appropriate for


handwritten documents

MAGNETIC INK  Is quick and highly  Has limited


CHARACTER efficient applications
RECOGNITION (MICR)
 Both humans and  As the use of cheques
machines can becomes obsolete, its
interpret the data use is in decline

 Not easy to forge

OPTICAL MARK  Data input is very  There is limitations to

Page 14 of 122
READER (OMR) fast and accurate the number of
responses

 Incorrect or
inconsistent marking of
the sheet may result in
the data being rejected

OUTPUT DEVICES

1. SPEAKERS – used for sound output.

Page 15 of 122
2. MONITOR – a VISUAL DISPLAY UNIT (VDU) is a television like device that

most people call the computer screen or monitor. Images are displayed on the

monitor using PIXELS in the form of little tiny dots of light. The screen

RESOLUTION refers to the number of pixels that are displayed on the screen at

the same time. It is given as a figure such as 640 * 480. There are two types of

monitors: CATHODE RAY TUBES (CRT) and LIQUID CRYSTAL DISPLAY

(LCD). CRT uses similar technology to the television. LCD screens are much

thinner and use a lot less energy and as a result are used in portable devices such

as laptops.

3. GRAPHICS PLOTTERS – Like printers graphics plotters are devices that can

produce output on paper. However they operate on a different principle. Instead

of producing images and text using print heads, inked ribbons or laser, they use

something a bit more low-tech – pens. It draws lines on paper using different

coloured pens. Plotters are frequently used in COMPUTER –AIDED DESIGN

AND DRAFTING.

4. COMPUTER OUTPUT ON MICROFILM (COM) – The data to be stored is

loaded in a microfilm recorder that displays the output on a screen for it to be

photographed by a high speed camera. The recording process is very quick

indeed. The photograph may be stored on microfilm, microfiche or ultrafiche. A

microfilm stores large amounts of textual or picture information in a format with a

vastly reduced size.

5. PRINTERS – another popular output device is the printer. Printers can be placed

into two categories: IMPACT PRINTERS and NON-IMPACT PRINTERS.

Page 16 of 122
 IMPACT PRINTERS are printers that transfer data onto paper by hitting

the paper with some part of the printer in a similar way to a typewriter.

Impact printers tend to be very noisy. The characters to be printed are

pressed against an inked ribbon onto the paper. There are two types of

impact printers: LINE PRINTERS and CHARACTER PRINTERS. Both

types of impact printers print on perforated paper.

 LINE PRINTERS

Line printers are printers that can use multiple print hammers to print an

entire line of text at one time. This type of printer is a high speed printer

which prints an entire line at a time. Speed for line printers is measured in

lines per minute (lpm). They are normally connected to mainframe,

minicomputers and network systems for printing in manufacturing

distribution and shipping applications.

 CHARACTER PRINTERS

Character printers are printers that print a character at a time. It is slower

than a line printer. Two main types of character printers are:

 DAISY WHEEL PRINTERS. These printers use a wheel

containing characters that rotates until the right character is facing the

paper. A hammer is then used to force the character into the ink

ribbon onto the paper. It can print high quality text but not graphics.

 DOT MATRIX PRINTERS. These have a print head capable of

firing tiny pins arranged in a matrix. As the print head moves back

Page 17 of 122
and forth, these pins strike the ribbon causing dots to be made on the

paper.

 NON – IMPACT PRINTERS

Non – impact printers are printers that print using methods that do not

involve striking the paper or an ink ribbon. They are generally faster

than most impact printers and a lot quieter.

 INKJET PRINTERS. Inkjet printers work by spraying

thousands of small dots of electrically charged ink onto a page to

form images. Inkjet printers produce relatively high print

qualities and can accommodate colour, text and graphics.

 LASER PRINTERS – Laser printers form images by charging

thousands of dots on a drum with a very high intensity laser

beam. Toner (dried ink) becomes affixed to these charged points

and when paper is pressed against the drum, an image is formed.

The images are permanently fused to the paper using a heating

unit. Laser printers produce very high quality prints, including

text, graphics and colour but they tend to be the most expensive

non-impact printers.

 THERMAL PRINTERS – are printers that print by using heat.

Some thermal printers use a special heat-sensitive paper. Heat is

then applied to the paper to form text and graphics. This type of

printer has low-maintenance cost since you do not have to buy

new ink, toner or print ribbon. Fax machines use this principle.

Page 18 of 122
Page 19 of 122
SECONDARY STORAGE DEVICES AND MEDIA

From magnetic tape and hard disks to CD-ROMS and DVD-ROMS, several secondary

storage devices are available - each with a slightly different use. What all have in

common is that each is used to store programs and data so that they can be retrieved at a

later time.

MAGNETIC TAPE

Magnetic Tape is used for storing large amounts of data. It is especially useful for this

purpose since it is very cheap. Magnetic tape comes in the form of a reel or cartridge and

is made of plastic that is coated with a metal oxide.

The tape is divided into parallel rows known as TRACKS. Tracks one to eight each store

a bit in a byte. Track nine is called the PARITY TRACK. It is used as a method of

checking the accuracy of the data. Each group of nine bits (one on each track) is known

as a FRAME.

FRAME

TRACK NO.
1 0
2 1
3 0
4 1
5 1
6 0
7 0
8 1
(Parity) 9 1

Page 20 of 122
There are two types of PARITY: ODD PARITY and EVEN PARITY. If data is stored

using Odd parity, then the number of ones in each frame should always be odd. So

when each byte is being recorded, the computer checks the number of ones. If it was

Even, the corresponding bit in the parity track is set to one, therefore making the

number of ones odd. If it was odd, the parity track is set to zero. Therefore when the

computer is reading the tape and it comes across a group of bits with an even number of

ones, it will know that something is wrong. Even parity works in a similar manner.

Magnetic Tape is high-density, high-speed and has a large capacity. It is read using a

magnetic tape drive. Data is accessed sequentially, which means that the data is

accessed in order in which it was stored. Magnetic tape is used for:

 Backing up the hard disk

 Data entry using a key-to-tape device

 Archiving data.

Page 21 of 122
FLOPPY DISK

A floppy disk (diskette) is a removable disk that everyone is familiar with. Since it has a

small storage capacity, it is typically used to store documents so that they can be used on

more than one computer. The data is stored on a flat, round, plastic disk coated with

magnetic material. Like magnetic tape, this is divided into tracks. However these tracks

are in the form of concentric circles (circles shown below).

A floppy disk must be formatted before it can be used for storing data. This is the process

of preparing the disk for use in the computer. N.B. when you format a disk you lose all

the information on the disk. Data can be accessed sequentially or directly. With direct

access (random access) you can jump straight to data at a particular location instead of

going through all the locations before that one.

Precautions needed with floppy disks

1. Don’t place the disk on a device that has or generates a magnetic field (e.g.

speaker).

2. Don’t place the disk in hot or wet places.

Page 22 of 122
HARD DISK (FIXED)

A hard disk is a large capacity, rigid magnetic disk that is used for storing data. Data is

read from or written to a hard disk using an arm-like device known as a read/write head.

This is a device that is used to write data to the disk (store it on the disk) and to read data

from the disk. Data can be read from/written to a hard disk using either a moving

read/write head or a fixed head.

A moving read/write head moves on the track that corresponds to the data while the disk

is spinning. A fixed read/write head does not move. Instead, there is a fixed head for

each track. This gives the fixed-head system the advantage of having a faster access

time. The access time is the time it takes for the data to be accessed. This faster access

time is because of the faster seek time (the time it takes the read/write head to get to a

specific position on the disk).

The term hard drive refers to a collection of hard disks and read/write heads. Each disk

(or PLATTER) surface can have its own read/write head(s) in order to allow the quicker

transfer of data. Data can be accessed sequentially or randomly (directly).

OPTICAL DISK

Optical disks will eventually make the magnetic disk and magnetic tape technologies

obsolete. Instead of using a read/write head like those two storage devices, the optical

disk uses two laser beams. One beam writes to the recording surface by burning small

pits (holes) into the disk, while the other lower density beam is used to read the data from

the surface. Using this technology, which is a direct access method, data can be stored at

Page 23 of 122
very high densities, accounting for the huge storage capacities of these media. Optical

disks tend to be more reliable than the other secondary storage devices and they also cost

less. Four common forms of optical disks are:

1. COMPACT DISKS (CDs)

 Read only

 Write once, read many – CD-R

 Erasable – CD-RW

2. DVD- ROM ( DIGITAL VIDEO DISK READ ONLY MEMORY)

Like with the CD-ROMs, DVD-ROMs are also available in recordable and

rewriteable variations described below:

 DVD-R – these allow users to record on it once and read it many times.

 DVD-RAM – these allow users to record erase and read multiple times.

3. WORM – (Write once Read many)

As its name implies, it allows the user to write information unto it only once,

thereafter information can only be read, not changed. These types of disk are

commonly used for archival purposes.

4. MAGNETO – OPTICAL (MO) DISKS

This is a rewriteable optical disk that uses a combination of magnetic and optical

methods. These disks are read and written in magneto-optical drives. Because

these drives use both magnetic and optical technology, they are more expensive

that those that use just one of these methods. A magneto – optical disk is portable

and has a very large storage capacity.

Page 24 of 122
SECONDARY STORAGE TERMS

 A SECTOR is a pie-shaped section of a disk that contains the amount of data that

can be read at one time by the drive.

 A TRACK is:

 One of the concentric rings on a magnetic disk in which the data is stored.

 The spiral on a CD or DVD in which the data is stored.

 One of the parallel rows on a magnetic tape in which the data is stored.

 A CYLINDER is a parallel set of tracks in a hard drive that are accessible from

one position of the read/write heads.

 A BUFFER is an intermediate storage location where data is temporarily stores

until it is ready to be used. This is necessary because different parts of the

computer system operate at different speeds, e.g. the printer and the CPU.

 ACCESS TIME is the amount of time it takes to complete a request for data to be

retrieved from storage.

 DIRECT ACCESS is a way of accessing data that is done by going to the exact

location and reading only the required data, thereby avoiding data that came

before or after. Disk drives generally access data in this way.

 SERIAL ACCESS refers to accessing data in the order in which it was stored.

This method is slower than direct access but is used by magnetic tape drives. If it

turns out that the data was stored in a particular order, e.g. alphabetical or

chronological order, we say that the data was accessed sequentially.

 SCSI – SMALL COMPUTER SYSTEM INTERFACE. It is a set of standards for

physically connecting and transferring data between computers and peripheral

Page 25 of 122
devices. SCSI is most commonly used for hard disks and tape drives, but it can

connect a wide range of other devices, including scanners and CD drives.

 SATA – SERIAL ADVANCED TECHNOLOGY ATTACHMENT. It is a

computer bus primarily designed for transfer of data between a computer and

mass storage such as hard disk and optical drives.

 IDE – INTELLIGENT DRIVE ELECTRONICS or INTEGRATED DRIVE

ELECTRONICS. An IDE interface is an interface for mass storage devices, in

which the controller is integrated into the disk or CD-ROM drive.

Page 26 of 122
STORAGE ADVANTAGES DISADVANTAGES
FLOPPY DISK  Cheap  Smallest storage
 Used everywhere capacity (1.44Mb)
 Light, fits in a pocket  Reads/writes data
and portable slowly
HARD DRIVE  Stores/retrieves data  Not portable
quickly – much faster
than floppy disk
 Stores much more data
than floppy disks
 Cheap on a cost per
megabyte basis
TAPE  Used on many networks  Not generally used
to backup data on hard with desktop
disks computers
 Low cost storage  Slow – so only used
for network back-ups
REMOVABLE  Store much more data  Other computers must
DRIVES than floppy disk have a Zip drive fitted
 Very good for backing to read these disks
up files  Do not hold as much
 Removable and portable data as hard drives
 Relatively cheap  Generally not as fast
as hard drives
ADVANTAGES AND DISADVANTAGES OF STORAGE DEVICES
MAGNETIC MEDIA

Page 27 of 122
OPTICAL STORAGE
STORAGE ADVANTAGES DISADVANTAGES
CD-ROM  Stores large amounts  As CD is read-only,
of data – up to 650 data cannot be changed
Mb per CR-ROM or deleted
 Very cheap to  Slower access times
produce, particularly than hard drives
on a large scale  Cannot read DVD
 Good way of
distributing software
CD-R  As with CD-ROM, a  Must have a CD-R
CD-R stores large recorder to write to a
amounts of data disk
 Possible to add data  CD-R software has
(write) to the CR-R in varying capabilities
more than one session
 Good for backing up
file
CD-RW  As with CD-ROM,  Must have a CD-RW
CD-RW stores large recorder to write to a
amounts of data disk
 CR-RW can be erased  CD-RW does not work
and reused as many in all CD players
times as required
 Good for backing up
files
DVD  Stores massive  New technology, so
amount of data – to 17 number of DVDs in
Gb use is smaller than
 Excellent for showing number of CD-ROMs
video  New technology, so
 DVD players can read price of drives
CD-ROM relatively expensive
 DVDs do not work in
CD-ROM drives

Page 28 of 122
HOW DATA IS STORED IN THE COMPUTER

HOW DATA IS REPRESENTED

Computers cannot immediately use information presented in a written or typed format.

Instead, all data and instructions input into the computer have to be translated to codes

which the computer can store and use. These codes are created using various

combinations of two digits only, (called bits), namely a “0” and “1”. This system is

known as the BINARY NUMBER SYSTEM.

The binary method of coding data and instructions on the computer is only used in digital

computers. Data represented in this digital way is described as DISCRETE DATA.

The other type of electronic computer, called the analogue computer, represents numbers

using different strengths of voltage. Data represented in this way are rarely non-numeric

and are described as CONTINUOUS DATA.

Page 29 of 122
BINARY NUMBER SYSTEM

As you go from the rightmost bit (called the least significant bit) to the leftmost bit

(called the most significant bit), the place value increases by a factor of 2.

Increase by factor of 2

Place Value 16 8 4 2 1
4
(in base 10) 2 23
22 1
2 20

Digit 1 0 1 1 1
(in base 2)

CONVERTING A NUMBER FROM BASE 2 TO BASE 10

A table similar to the one shown above can be used to convert a binary number into a

decimal number. For example let us convert the number 10111 2 to base 10. To do this

you must follow a few simple steps:

 Write down the binary number with the digits well spaced.

 Above each digit, write its place value in base 10. So you would end up with

something looking like the table above.

 Multiply each digit by its place value and add the results together.

24 23 22 21 20

16 8 4 2 1

1 0 1 1 1

So 101112 = (1*16) + (0*8) + (1*4) + (1*2) + (1*1)

= 16 + 0 +4 + 2 + 1

= 2310

Page 30 of 122
CONVERTING A NUMBER FROM BASE 10 TO BASE 2

The method for converting from base 10 to base 2 is not as simple as the method given

above.

 Divide the decimal number by 2. Write down the quotient and the remainder.

 On the next row, divide the quotient from the previous row by 2. Write down

the new quotient and the remainder.

 Continue the process until the quotient is 0.

 Use the remainders (GOING FROM THE BOTTOM TO TOP) to write down

the binary digits (GOING FROM LEFT TO RIGHT).

Let us use the method to convert 10310 into binary.

2 103
2 51 R1 Write down the
2 25 R1 remainders in this
2 12 R1 direction
2 6 R0
2 3 R0
2 1 R1
0 R1

Therefore 10310 = 11001112

BINARY ADDITION

Page 31 of 122
EXAMPLE: 111 + 10 + 111 + 110

111
10
111
110
101102

 Add all the digits in the right most columns.

1+0+1+0 = 2

 Divide the results by 2

2/2 = 1 R 0

 Write the remainder as the result for this column and carry over the whole

number to be added to the next column.

 Repeat steps 2 and 3 for the remaining columns.

BINARY CODED DECIMAL (BCD)

Page 32 of 122
Using a straight binary code to represent integers can sometimes be very tedious,

especially when representing large numbers. Using the BINARY CODED DECIMAL

(BCD) method, decimal numbers can be converted to a binary form in a less tedious way.

The decimal number is treated as a set of digits which are individually converted to a

binary representation.

Note that when using BCD; each digit is represented using a four bit code. This is

the minimum needed to represent the maximum digit.

BCD negative and positive signs are represented using a 4-bit pattern which does

not represent any of the digits. One convention is:

 1010 or 1110 is used to represent the positive sign (+)

 1011 or 1111 is used to represent the negative sign (-)

Example: convert 89610 to BCD.

8 9 6 DECIMAL

1000 1001 0110 BCD

896 = 1000100101102

+896 = 10101000100101102

-896 = 10111000100101102

REPRESENTING NEGATIVE NUMBERS

Page 33 of 122
There are three main ways to represent negative numbers. They are:

1. ONES COMPLEMENT

2. TWOS COMPLEMENT

3. SIGN AND MAGNITUDE

ONES COMPLEMENT

Ones complement is a simple one step process.

Going from left to right simply change all the 1s to 0s and 0s to 1s.

For example, the one’s complement of 11101011, is 00010100

TWOS COMPLEMENT

To find the twos complement of a binary number is almost as easy as finding the ones

complement. In fact, it is exactly the same with the exception of one additional step. The

steps are:

 Find the ones complement of the binary number.

 Add 1

Example: find the twos complement of 100101012

 Ones complement of 10010101 = 011010102

 Add 1 = 011010112

The twos complement of 100101012 = 011010112

WHAT IS THE TWOS COMPLEMENT OF 000000002?

SIGN AND MAGNITUDE

Page 34 of 122
This is the simplest system of the lot. It is also the easiest to understand since it is very

similar to the way we represent decimal numbers. The leftmost bit is used as the sign bit.

All the other bits represent the magnitude of the number. So in the case of the example

(where we use 8 bits in total), 7 bits will be used to store the magnitude of the number

and the 8th bit will be the sign bit.

Steps:

 Find the binary of the number.

 If the number is positive use the sign bit (leftmost bit) as 0

 If the number is negative use the sign bit (leftmost bit) as 1

For example find the sign and magnitude of 45 and -45

45 = 00101101

-45 = 10101101

ASCII CODES

Page 35 of 122
The AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE is the

standard that PCs use when representing data. For example:

The ASCII code for D is 010001002. What is the binary for the ASCII code for W?

Steps:

D is the 4th letter of the alphabet and W is the 23rd. Therefore, in order to get the ASCII

code for W you have to add 19 (23-4) to the ASCII code for D. Obviously you cannot

just add a binary number to a base 10 number. Therefore you have to convert one of

them. It would be easier to convert 19 to binary and to add it to 01000100 2. The binary

for 19 is 000100112

01000100

00010011+

01010111

So the W is represented in ASCII by 0 1 0 1 0 1 1 12 or decimal by 8710

BINARY SUBTRACTION

Page 36 of 122
EXAMPLES:

1. 01 – 00

01

00

012

RULE: 1-0 = 1

2. 01 – 01

01

01

002

RULE: 1-1 = 0

3. 10001 -1011

01121

10001

1011

001102

Subtract the following binary numbers:

1. 111 -101 = 10

2. 1111 – 1101= 10

3. 1110 – 1011 = 11

4. 1010 – 111 = 11

OCTAL NUMBERS

Page 37 of 122
OCTAL NUMBERS are numbers to base 8. We therefore use the digits 0 to 7. Since the

number base or scale is 8, each digit of a number has a place value in terms of powers of

8.

CONVERTING FROM DECIMAL TO OCTAL

EXAMPLES:

8 98
8 12 R2 Write down the
8 1 R4 remainders in this
0 R1 direction

ANSEWER: 1428

8 985
8 123 R1 Write down the
8 15 R3 remainders in this
8 1 R7 direction
0 R1

ANSWER: 17318

Page 38 of 122
CONVERTING FROM OCTAL TO DECIMAL

In converting from octal numbers to denary numbers, we use the fact that each place
value is a power of 8.

EXAMPLES:
1. Convert 7438 to a decimal number
7*82 + 4*81 + 3*80
7*64 + 4*8 + 3*1
448+32+3
= 48310

ADDING OCTAL NUMBERS


EXAMPLE:
675 + 204 =
11
675
204+
11018

111
4763
215+
52008

SUBTRACTING OCTAL NUMBERS


EXAMPLE:

7632
475-
7135

Page 39 of 122
CONVERTING DECIMAL TO HEXADECIMAL
Steps:
1. Divide the decimal number by 16. Treat the division as an integer division.
2. Write down the remainder (in hexadecimal).
3. Divide the result again by 16. Treat the division as an integer division.
4. Repeat step 2 and 3 until result is 0.
5. The hex value is the digit sequence of the remainders from the last to first.

Note: a remainder in this topic refers to the left over value after performing an integer
division.

HEXADECIMAL 0 1 2 3 4 5 6 7 8 9 A B C D E F
DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Example 1
Convert the number 1128 DECIMAL to HEXADECIMAL

NOTES DIVISION RESULT REMAINDER (in


HEXADECIMAL)
Start by dividing the 1128 / 16 70 8
number by 16.

In this case, 1128


divided by 16 is 70.5. So
the integer division
result is 70 (throw out
anything after the
decimal point).

The remainder is (70.5 -


70) multiplied with 16;
or (0.5 times 16), which
is 8.
Then, divide the result 70 / 16 4 6
again by 16

(the number 70 on the


DIVISION column
comes from the previous
RESULT).

In this case,
70/16=4.375. So the
integer division result is
4 (throw out anything

Page 40 of 122
after the decimal point)

The remainder is (0.375


multiplied with 16,
which is 6.
Repeat. Note here that 4 / 16 0 4
4/16=0.25. So the
integer division result is
0.

The remainder is (0.25-


0) multiplied with 16,
which is 4.
Stop because the result
is already 0 (0 divided
by 16 will always be 0)
Well, here is the answer. 468
These numbers come
from the REMAINDER
column values (read
from bottom to top)

Side note: You can get the remainder of a division using the Modulus or % operator. Ie:
1128%16=8.

Example 2
Convert the number 256 DECIMAL to HEXADECIMAL

DIVISION RESULT REMAINDER (in HEX)


256 / 16 16 0
16 / 16 1 0
1 / 16 0 1

ANSWER 100

Page 41 of 122
Example 3
Convert the number 921 DECIMAL to HEXADECIMAL

DIVISION RESULT REMAINDER (in HEX)


921 / 16 57 9
57 / 16 3 9
3 / 16 0 3

ANSWER 399

Example 4
Convert the number 188 DECIMAL to HEXADECIMAL

DIVISION RESULT REMAINDER


(in HEX)
188 / 16 11 C (12 decimal)
11 / 16 0 B (11 decimal)

ANSWER BC

Note that here, the answer would not be 1112, but BC. Remember to write down the
remainder in hex, not decimal.

Example 5
Convert the number 590 DECIMAL to HEXADECIMAL

DIVISION RESULT REMAINDER


(HEX)
590 / 16 36 E (14 decimal)
36 / 16 2 4 (4 decimal)
2 / 16 0 2 (2 decimal)

ANSWER 24E

Page 42 of 122
CONVERTING HEXADECIMAL TO DECIMAL

Steps:
1. Get the last digit of the hex number, call this digit the currentDigit.
2. Make a variable, let's call it power. Set the value to 0.
3. Multiply the current digit with (16^power), store the result.
4. Increment power by 1.
5. Set the the currentDigit to the previous digit of the hex number.
6. Repeat from step 3 until all digits have been multiplied.
7. Sum the result of step 3 to get the answer number.

Example 1
Convert the number 1128 HEXADECIMAL to DECIMAL

MULTIPLICATION RESULT NOTES


8 x (16^0) 8 Start from the last digit of the
number. In this case, the
number is 1128. The last digit
of that number is 8. Note that
the power of 0 of any number is
always 1
2 x (16^1) 32 Process the previous, which is
2. Multiply that number with
an increasing power of 16.
1 x (16^2) 256 Process the previous digit,
which is 1, note that 16^2
means 16 x 16
1 x (16^3) 4096 Process the previous digit,
which is 1, note that 16^3
means 16 x 16 x 16
Here, we stop because there's
no more digit to process
ANSWER 4392 This number comes from the
sum of the RESULTS
(8+32+256+4096)=4392

Once discerned, notice that the above process is essentially performing this calculation:

1x(16^3) + 1x(16^2) + 2x(16^1) + 8x(16^0)

When doing this by hand, it is easier to start backward is because:

 Counting the number of digits takes extra time, and you might count wrongly.
 If you don't remember what a particular value of a power-of-16 is, it's easier to
calculate it from the previous power value. For instance, if you don't remember

Page 43 of 122
what the value of 16^3 is, then just multiply the value of 16^2 (which you'll likely
already have if you started backward) with 16.

Example 2
Convert the number 589 HEXADECIMAL to DECIMAL

MULTIPLICATION RESULT
9 x (16^0) 9
8 x (16^1) 128
5 x (16^2) 1280

ANSWER 1417

If you want to be a speed counter, it's beneficial to memorize the values of the smaller
power of 16s, such as in this table

POWER OF 16s RESULT


16^0 1
16^1 = 16 16
16^2 = 16x16 256
16^3 = 16x16x16 4096
16^4 = 16x16x16x16 65536

Example 3
Convert the number 1531 HEXADECIMAL to DECIMAL
(This time, let's use the table of the power-of-16s above.)

MULTIPLICATION RESULT
1x1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096

ANSWER 5425

Page 44 of 122
Example 4
Convert the number FA8 HEXADECIMAL to HEXADECIMAL

MULTIPLICATION RESULT
8x1 8
A x 16 (remember that hex A=decimal 10) 160
F x 256 (remember that hex F=decimal 15) 3840

ANSWER 4008

Example 5
Convert the number 8F HEXADECIMAL to DECIMAL

DIVISION RESULT
Fx1 15
8 x 16 128

ANSWER 143

Example 6
Convert the number A0 HEXADECIMAL to DECIMAL

DIVISION RESULT
0x1 0
A x 16 160

ANSWER 160

Example 7
Convert the number 12 HEXADECIMAL to DECIMAL

DIVISION RESULT
2x1 2
1 x 16 16

ANSWER 18

Example 8
Convert the number 35432 HEXADECIMAL to DECIMAL

2x(16^0) + 3x(16^1) + 4x(16^2) + 5x(16^3) + 3x(16^4) =


2 + 3x16 + 4*256 + 5*4096 + 3*65536 =
2 + 48 + 1024 + 20480 + 196608 =
218162

Page 45 of 122
SOFTWARE
Software is a general term for the various kinds of programs, installation files and
documentation that together are used to operate computers and related devices.
A piece of software is commonly called a program, software program or software
package. Program is a sequence of instructions that a computer can interpret and execute.
Software can be classified into two main categories: system software and application
software.

System Software is the category of software used to operate and maintain a computer
system including the operating system, utility programs and program language
translators.
Application software is the category of software that performs specific end-user tasks to
solve every-day problems, inform and entertain.
OPERATING SYSTEM
An Operating System is a group of programs that work interactively to manage the
resources of a computer. Microsoft Windows, Linux and Mac OS are examples of
Operating System Software.
Functions of an Operating System
 Communication
 File transfer
 Resource Management
 File Management
 Security

Page 46 of 122
USER INTERFACE
A user interface can be thought of as a link between user and computer. It allows the user
and the computer to communicate with each other. The goal of a user interface is to be
easy to use while allowing tasks to be performed efficiently. Two common software
interfaces are graphical user interfaces and command driven interfaces.

GRAPHICAL USER INTERFACE (GUI)


This type of interface allows the user to interact with the computer by selecting options,
normally displayed on-screen as ICONS, using a point-and-draw device, usually a
mouse. The way the GUI works, is often summarized by the word WIMP (Windows,
Icons, Menus and Pointer)
A Window is a part of the screen through which we can see either an application
program or an OS program running.
An Icon is a small picture or image that represents an action to be carried out.
Activating the icon causes the action to be carried out. It can be activated by double
clicking on the icon, causing the action associated with the icon to be started.
A Menu is an onscreen list of available command choices. A menu-bar stretching across
the top of a screen (or window) contains the names of available pull-down menus.
Another type of menu is a pop-up menu. A pop-up menu appears on your display screen
at the point where your mouse is positioned. It is usually activated by a right click.
A Pointer is an onscreen symbol that shows the current position of the pointing device.
The pointing device is the primary means of interacting with a computer running a GUI.
It is used to move the pointer around the screen to carry out actions such as selecting
icons and menu options, dragging and clicking, among other things.

COMMAND DRIVEN INTERFACE


These allow users to communicate with the computer by typing in commands in their
exact SYNTAX (format) using a keyboard. Each command has a particular structure or
syntax. In order to execute a command, the user must not only remember what
commands exists; they must also remember the syntax. This is a main draw back with

Page 47 of 122
this type of interface. DOS and UNIX are some operating systems that use a command
line interface.
PROCESSING MODES
Data can be processed in four ways, depending on the data and what is required at the end
of the process.
BATCH PROCESSING
These process data in batches at one time- not as single items. The entire process can
normally be broken down into three steps:
 Gathering the data
 Recording the data on a storage medium and
 At a later time, processing the data in bulk.
The payroll system, for example normally requires the collection of data over a period of
time with the actual processing of the pay being done only at the end of the month.

ONLINE PROCESSING
These provide a direct link between the user and the computer processor via an input
device. In these systems the data is processed as soon as it is available. It requires the
computer to be online. An example of a system that uses online processing is the airline
reservation system.
REAL-TIME PROCESSING
Real-time processing is where jobs and transactions are processed immediately. It is used
when data is very time-sensitive or when users need immediate access to data. It is
commonly used for online reservation systems.
TIME SHARING
Time sharing is used when a system has more than one user at a time. It allocates CPU
processing time to each user, one at a time.

Page 48 of 122
MANAGING PROCESSES AND TASKS
The operating system manages many processes and tasks at the same time, to make the
computer faster, more efficient and multifunctional. It does this in several ways.
MULTITASKING - Multitasking is when one processor performs several tasks at the
same time in order to complete an operation. Most word processing programs can be set
up to save a document as you are writing; this is an example of multitasking.
MULTIPROCESSING - Multiprocessing is when two or more processors run one
program. Multiprocessing is often faster and more efficient than using one processor to
run a program.
MULTIPROGRAMMING - Multiprogramming is when one processor runs more
than one program at the same time. They could be programs you have launched or
programs that run in the background.

APPLICATION SOFTWARE
Application programs or application software, are programs that allow a computer to
carry out specific tasks, but they are not essential for the computer to work.
GENERAL-PURPOSE applications are flexible and can be used for a variety of
different tasks. For example, a word-processing package is general purpose software
because it can be used to write letters, reports, stories, etc. General-purpose software is
often fairly cheap and reliable.
SPECIALISED APPLICATION can only be used for one task. An application
program like Skype is intended solely for Internet-based telephony and as such is
considered special-purpose. Another example is a payroll package.
CUSTOM-WRITTEN or custom software is software that is created by programmers on
behalf of a company to meet its unique requirements.
Advantages:
 Software is tailored to suit the needs of the user.

 The user has close control over revisions and can modify the software as needed.

 The program may run fast as the code is optimized for a specific purpose only.

Page 49 of 122
Disadvantages of developing custom software as compared with purchase packaged
software are:
 It is more costly

 Longer development time; package software would be readily available.

 It may have flaws during a period of initial use whereas package software would
have been tested extensively.

INTEGRATED SOFTWARE – is a single program that contains a range of different


functionalities. Example: Microsoft Office.
Advantages of purchasing and using integrated software rather than using multiple
single-purpose application include:
 It needs less space for installation as the software is installed as one application.

 Data can be easily shared among applications using a range of built-in features.

 Users get value for money as it costs less to purchase the integrated application
rather than multiple packages.

Disadvantages:
 The integrated software does not have all the features of the individual single-
purpose applications.

 Some integrated software packages do not include all the applications that may be
required.

Page 50 of 122
DATA COMMUNICATION

Data Communication is the transmission of data from one location to the other in order to
enable communication between the locations. Data communication is achieved through
the use of computers, transmission cables, satellite and wireless technology.

The data is transmitted via data communication channels. These channels are categorized
according to their BANDWIDTH (volume of data that can be transmitted through the
channel each second). There are three categories of channels. These are:

1. NARROW-BAND – data is transmitted at a slow speed, e.g. telegraph


transmission. (just over 10 characters per second)
2. VOICE-BAND – telephone lines are utilized, allowing data to be transmitted at
rates up to 8,000 characters per second.
3. BROAD-BAND – broad-band uses fibre-optic cables, microwave and satellite
transmission of data.

There are various types of communication systems that vary according to the direction in
which data can be transmitted. These are:
1. SIMPLEX - data can only be transmitted in one direction.
2. HALF-DUPLEX – data can be transmitted in both directions, but not at the same
time.
3. DUPLEX (FULL DUPLEX) – data can be transmitted in both directions at the
same time and independent of each other.

PROTOCOL
Protocols are a set of rules and procedures governing the transmission and receiving of
data. Some international protocols are HTTP, PPP, TCP/IP and FTP.
Protocols are used to ensure that transmissions are coordinated with minimal interference.

Page 51 of 122
NETWORKS
A network is a group of computers and peripheral devices that are connected to each
other by cables or wireless electronics. Networks reduce costs and increases efficiency
by allowing the sharing of programs, data and peripheral devices. In some cases there are
special computers called servers that are dedicated to the managing of particular
resources.

LOCAL AREA NETWORKS (LAN)


A Local Area Network (LAN) is made up of two or more computers connected to each
other within the same geographical area but not necessarily within the same building.
LANs are usually used by small or medium size businesses. LANs are usually connected
using twisted pair cables or coaxial cables.

LAN TOPOLOGIES
How computers on a network are connected together determines its topology. The most
common topologies for a LAN are:
1. LINE OR BUS
2. STAR
3. RING

LINE OR BUS TOPOLOGY


This is a single line or cable with nodes at different points. Information can be
transmitted in either direction from any PC to another. The problem here is that several
stations may want to transmit down the same line simultaneously and there has to be the
same strategy for deciding who gets the line. Before a station begins to transmit, it
checks that the channels is not busy, if it is, it has to wait before transmission can begin.
Once it begins, transmission, it listens for other nodes also beginning transmission. If the
transmitted message collides with another, both stations abort and wait a random period
of time before trying again.

Page 52 of 122
 ADVANTAGES
1. Extending the network is easy.
2. It requires less hardware to setup.
3. It is easy to configure.
4. New equipment can be added to it.
 DISADVANTAGES
1. Any problems with the main cable may cause the whole network to
malfunction.
2. Packets of data may collide, resulting in loss of information.

Page 53 of 122
STAR TOPOLOGY
All the computers on the network are connected to one another through a central HUB. A
HUB is a hardware device to which a number of computers can be connected. Data is
transmitted from one computer to the other by packets. A packet containing the addresses
of the sender and the receiver is first sent to the central hub, which then sends the packet
to the designated computer.

 ADVANTAGES
1. Adding new devices to the network is easy
2. If a computer stops working, the network is not affected.
3. If one piece of cable is damaged, only one computer is affected.
 DISADVANTAGES
1. It requires more cabling
2. If the central computer or server malfunctions, the entire network
will fail.
3. Only one computer on the network can send data at any particular
time.

Page 54 of 122
RING TOPOLOGY
The cable is connected to all the computers on the network. The ends of the cable are
then connected together to form a loop or ring. Data is passed from one computer to the
next by means of a token (electronic signal), which is passed around the ring, giving each
computer an opportunity to send data. A computer can send data only when it is
possession of the token.

 ADVANATAGES
1. If a computer stops working, the other computers can continue to
communicate.
2. Communication is usually faster than with a line network.
 DISADVANTAGES
1. If the main cable is damaged, the entire network goes down.
2. The entire network has to be shut down for any maintenance to be
carried out.
3. The network becomes very difficult to maintain if it gets very
large.

Page 55 of 122
WIDE AREA NETWORK (WAN)
A Wide Area Network (WAN) is a network that covers a wide geographical area. WANs
use a combination of fibre-optic cables and telephone lines, as well as satellite and
microwave technology, to transmit data.
Fibre-optic cables are extremely thin cables that allow extremely fast and accurate
transmission of large volumes of data.

DISADVANTAGES OF NETWORKING
1. Networks are expensive to set up. In addition, configuring a network is a very
complex process that may require an additional employee.
2. Security problems. People may be able to access shared information that they are
not supposed to see by hacking into computers on the network.

Page 56 of 122
MODEM (MODULATOR/DEMODULATOR)
A modem is a device that can convert digital signals into analogue and vice versa. The
speed of a modem is measured in bits per second (bps).

TERMS ASSOCIATED WITH DATA COMMUNICATION

1. UPLOAD – this is the process by which one computer, the host, sends a file to a
remote computer via communication channels.
2. DOWNLOAD – this is the process by which a computer obtains a file from a
host computer via communications channels.
3. POINT-TO-POINT TRANSMISSION – this is the process by which data is sent
from one location to another.
4. BROADCAST TRANSMISSION – this is the process by which data is
transmitted in such a way that any person with the correct equipment can receive
it. This means that it is difficult to control who receives the data.
5. BULLETIN BOARD – this is a centralized computerized location to which
remote computers can connect. Once connected, a user can upload messages and
files or download those posted by other users.

Page 57 of 122
PROTECTING AND SECURING INFORMATION

Since information is so valuable considerable effort is spent protecting it from theft, fire,
viruses, hackers, data loss and data corruption. Numerous methods are used to protect
and secure information. The most widely used of these methods are:

1. Using Passwords
2. File Encryption
3. Physical Access Restriction
4. Software Access Restriction
5. Using Firewalls
6. Back-up and recovery
7. Using fireproof cabinets
8. Archiving
9. Virus protection

PASSWORDS
A password is a combination of characters used to prevent unauthorized computer
access. A person wishing to secure a computer or individual files on the computer
can set a password. In order for access to be granted, the correct password must be
entered.

ENCRYPTION
Encryption is the process of encoding information so that it bears no similarity to the
original in order to secure it. Files are encrypted using a key provided by the person
who wants to encrypt the information. In order to read encrypted information, it must
first be decrypted. This is the process of decoding encrypted information in order to
obtain the original information.

Page 58 of 122
PHYSICAL ACCESS RESTRICTIONS
Physical access restrictions are used to prevent unauthorized persons from gaining
physical access to stored information. Examples of physical access restrictions are:
 Housing the computer or removable storage in a room or building. This area
would be secured using locks and a combination or surveillance cameras,
alarms and security guards.
 Locking manual files or removable storage in a cabinet or vault.

SOFTWARE ACCESS RESTRICTIONS


This is quite simply the process of restricting access to software. This may be done using
passwords or encryption.
Installation keys are also used for software access restrictions, they are also used to cut
down on software piracy. This is the unlawful copying of computer software.

VIRUS PROTECTION
A virus is a malicious program that is designed to corrupt the files on a person’s computer
and or prevent the computer from working properly. Computers may be protected from
viruses by avoiding using computers or disks that are suspected of having a virus and by
using up-to-date anti-virus software.

ANTI-VIRUS SOFTWARE
An anti-virus program is a special type of software that tries to detect and remove viruses
that are on a computer or removable storage media.

FIREPROOF CABINETS
A fireproof cabinet is a cabinet that is designed to withstand the high temperatures of a
fire. It is used to protect manual files and removable storage media.

Page 59 of 122
FIREWALLS
A firewall is a program that identifies certain weaknesses in networked computers and
tries to prevent them from being exploited. This makes it much more difficult for hackers
to gain unauthorized access to the computer. Therefore firewalls help to keep the data on
these computers secure.

BACK-UP AND RECOVERY


Backing up data is the process of making a copy of the data and storing it on another
storage medium.

ARCHIVING
When data has remained unchanged for a long time and is not accessed on a regular
basis, it is said to be inactive. If this data is taking up valuable space, you might want to
store it in a separate location instead. This is what is known as archiving the data.

DATA CORRUPTION
When something causes data to become lost or damaged, this data is said to be corrupted.
Data may be corrupted by:
 A computer virus
 Wilful acts of employees
 Computer malfunction.
 Power surges or outages.
 Poor methods for updating data.

Page 60 of 122
TROUBLESHOOTING AND COMPUTER MAINTENANCE
COMPUTER MAINTENANCE
When you use a computer over a period of time, problems may develop which, even
though they are usually not serious, may accumulate and cause a noticeable deterioration
in the performance of the computer. The operating systems come with tools to help you
get rid of these problems and keep your computer in good working order. Some of these
tools include:
SCANNING DISKS FOR ERRORS
When the computer is turned off without being shut down properly or when a program
crashes, chances are that there will be file errors on your disk. Disks do not last forever
so some part will go bad. Data saved on these locations may not be recoverable. To
prevent or at least reduce the chance of these things happening, your hard drives should
be scanned for file errors as well as physical defects. If file errors are detected, the
scanning program fixes them. If physical errors are discovered, the program does the
equivalent of putting up warning signs around the areas saying that no data should be
stored there. The tools in windows that would allow you to scan and fix errors on disk are
called SCANDISK.
DEFRAGMENTING OF THE FILE SYSTEM
After you have used your computer for a while, especially if you copy, move and delete
files a lot, the files on your computer become fragmented. When files are heavily
fragmented, it causes the computer to run slower since it has to be going all over the disk
to find the parts of a file.
Defragmentation is the process by which the computer takes the fragments of files and
reorganises them on a hard drive so that they are stored contiguously.

Page 61 of 122
BASIC TROUBLESHOOTING
 THE COMPUTER (TOWER) IS NOT TURNING ON

POSSIBLE CAUSE TRY THIS


Power switch is not pressed. Check to see if the power indicator on the
tower is on. If it isn’t, press the power
button firmly.
Loose power cord Make sure that the power cord is pushed in
the back of the tower and that it is plugged
into a working electrical socket.
The power supply is not working Place your hand close to the fan on your
computer, next to where the power cord is
plugged in. If a breeze is coming from the
fan then the CPU is on. If not, the power
supply is not working.

 THE MONITOR IS NOT WORKING

POSSIBLE CAUSE TRY THIS


The monitor is switched off Check to see if the power indicator on the
monitor is on. If it isn’t, push the power
button (for the monitor) firmly.
Loose power cable Make sure that the power cord is in the
back of the monitor and that it is plugged
into a working electrical socket.
Monitor is not connected to the tower Make sure that the thick cable from the
monitor is present and is connected to the
correct part of the tower.
Loose cables Try gently rocking the cables at the back of
the monitor back and forth while the switch
is to the “ON” position. If the monitor
flickers, push in the cables more securely.
The brightness or contrast is too low Turn both the brightness and contrast knobs
(usually found on the bottom of the

Page 62 of 122
monitor)
The computer has turned off the monitor If you left the monitor on and come back to
to save power find that it isn’t showing anything (even
though the switch is to “ON”), move the
mouse and/or push a button on the
keyboard.

 THE SYSTEM IS NOT BOOTING UP

ERROR TRY THIS


“Keyboard error or no keyboard Make sure that the keyboard is firmly
present” plugged into the tower, then press the key
to continue (usually F1)
“CMOS battery failed”, CMOS Follow the instructions given. It is not
checksum error (Defaults loaded)”. (this necessary to enter any information (since it
is caused by a dead battery) will be lost when the computer is turned off
anyway). Replace the battery (not
necessarily immediately).
“Invalid system disk. Replace the disk Either remove the disk or replace it with a
and press any key” boot diskette. Press any key on the
keyboard.

 THE PRINTER IS NOT WORKING

POSSIBLE CAUSE TRY THIS


The printer has no power Check to see if the power indicator on the
printer (if there is any) is on. If it isn’t,

Page 63 of 122
make sure that the power supply is
connected to the printer and that it is
plugged on into a working socket. Push the
power button on the printer.
Printer cable is not connected Make sure that one end of the printer cable
is connected to the printer and that the
other is connected to the back of the tower.
If both ends were already connected, try
pushing them in more firmly.
Printer is out of ink Replace and try printing again.

 THE KEYBOARD IS NOT WORKING PROPERLY

ERROR TRY THIS


You press the keys on the keyboard but Make sure the keyboard is connected to the
noting happens correct slot. If it already was connected,
the OS may have crashed. Try moving the
mouse to see if the mouse pointer moves.
If it doesn’t you may have to restart the
computer.
All the text is in capitals Check the CAPS-LOCK light to see if it is
on. If it is, press the CAPS-LOCK key to
turn CAPS-LOCK off.
When you press a letter key (by itself) a Check to see if any of the SHIFT, CTRL,
window, e.g. the run window or ALT or Windows keys is stuck.
Windows Explorer opens

 THE MOUSE IS NOT WORKING PROPERLY

ERROR TRY THIS


The mouse pointer is not moving Make sure the mouse is connected to the
correct slot. If it was already connected
check to make sure that the OS hasn’t
crashed by pressing CTRL+ALT+DEL
once and see if the Task Manger appears. If

Page 64 of 122
it doesn’t, the OS has crashed. If it does,
the mouse may need to be replaced or
reinstalled. Either way, you may have to
restart the computer.
The mouse pointer is moving erratically Move the switch on the mouse if there is
any, to another position.
Take out the ball from the mouse, if it has
one, and clean the inside of the mouse.

 A FLOPPY DISK IS NOT WORKING PROPERLY

ERROR TRY THIS


When you try to access a disk you are Open Windows Explorer. Right click the
told that the disk is not formatted icon for the floppy drive. Click “Format”,
select the desired options and then click
start.
When you try to copy files to a disk or to Hold the disk with the label facing down.
delete files from it you get an error Locate the square tab above a small hole in
saying that the disk is “Write Protected” a corner of the disk. Pull it down so that
you can no longer see the hole.
The computer is unable to read some (or Use Scandisk to do a thorough scan of the
all) of the files stored on a disk floppy disk for bad sectors. If any are
found, copy those files that you can to
another location and do not store any more
data on the disk.

Page 65 of 122
APPLICATIONS AND IMPLICATIONS OF IT

COMPUTERS IN EDUCATION
Hardware and software used in education
HARDWARE REQUIREMENTS SOFTWARE REQUIREMENTS
Computers (stand alone and networked) Word processing for creating documents
Printers (laser, inkjet and sometimes Web and video conferencing software
character printers)
Devices for learning such as concept CAI/CAL software for a variety of subjects
keyboards, voice synthesisers and levels (simulations, tutorials)
Database software for managing student
records
Spreadsheets for grading students’ marks
CML (COMPUTER MANAGED
LEARNING) software which is used as an
administrative tool for creating timetables,
etc.

COMPUTER –ASSISTED ASSESSMENT (CAA)


This is the use of computers to assist in the marking of examination scripts, such as
multiple choice papers. An electronic reader sensitive to shading can assess which boxes
have been marked, and give a score accordingly.
COMPUTER ASSISTED LEARNING (CAL) / COMPUTER AIDED
INSTRUCTION (CAI)
This is the use of computers and appropriate computer software to allow student to learn
at their own pace, and/or to create a more interesting learning environment in which
teaching material is presented. There are two basic forms of CAL/CAI:
 TUTORIALS: these are self-paced, self-instructional programs that guide the
student through new material, acting as their tutor.
 SIMULATIONS: these use multimedia to demonstrate a realistic-looking and
sounding outcome, based on a specific scenario.

CML/CMI

Page 66 of 122
COMPUTER MANAGED LEARNING AND COMPUTER MANAGED
INSTRUCTION are other tools used in educations. However, unlike CAI and CAL,
CML and CMI is used as an administrated resource rather than an instructional one – to
organise students’ data and timetables, and in libraries to manage indexes.

ADVANTAGES OF INFORMATION TECHNOLOGY IN EDUCATION


 CAI AND CAL use multimedia that makes learning more interesting interactive.
 Students can learn on their own and at their own pace even in the absence of a
teacher.
 Feedback is immediate after answering the question or at the end of a simulation.
 Abstract concepts can often be explained more clearly with the use of multimedia.
 Dangerous experiments can be done through simulation.

DISADVANTAGES OF INFORMATION TECHNOLOGY IN EDUCATION


 It reduces face to face interaction with others
 Computer aided instructions are set up in a pre-defined order; hence students can
only follow in that order. This may sometimes be restrictive, not allowing for
creative flow in lessons.

Page 67 of 122
CURRENT TRENDS IN TECHNOLOGY

TELECOMMUTING
Telecommuting is a term used to refer to when an employee works off-site using a
computer and a communication channel to communicate with the office
network/computer.
Advantages associated with telecommuting
The reduced commuting means reduced cost, less stress (from not having to put up with
rush hour traffic) and is more convenient for the employee. All that is required is a
connection to the office network via a communication channel. The most common
method of doing this is via a modem, telephone line and remote networking software.
Disadvantage associated with telecommuting.
The employee may have to absorb resulting additional telephone and electricity costs.
There is also the initial cost of setting up the computer system, both at home and at the
office, to support telecommuting. The most serious disadvantage is lack of supervision.
Since the employee can work when he/she wishes, and may be distracted by things such
as telephone calls, television, there may be a loss of productivity. Also there may be the
problem of reduced social interaction between employees.

VIDEOCONFERENCING AND TELECONFERENCING


Both videoconferencing and teleconferencing use the same principle as telecommuting-
they use computer technology and telecommunication channels so that businessmen and
businesswomen can reduce the need to travel.
Videoconferencing is the use of computer, video, audio and communications technology
to enable people in different locations to see and talk to one another. It is used by
organisations to conduct meetings involving individuals who are located at various
locations in the world. All that is need are computers with microphones and digital video
cameras (or webcams) and a communications channel from one location to the next. The
communication channel is usually established using a modem and a telephone line.

Page 68 of 122
ADVANTAGES
Videoconferencing offers people the advantage of convenience, productivity gains and
reduced travel time and cost.
DISADVANTAGES
An increase in telecommunication cost and loss of personal contact is experienced. Also
is the connections are slow, the video and audio may not be of very high quality.

TELECONFERENCING
Teleconferencing is similar to videoconferencing except there is no video.

Page 69 of 122
MEASURES TO REDUCE INFORMATION MISUSE
INFORMATION MISUSE
Since computers make it easy to collect, store and share information, they also make it
easy to misuse it. For example, is collected on people who use the internet, whether they
know it or not.
Information may be misused in the following ways:
 By collecting information about people without their permission
 When unauthorised persons are able to view and/or change information
 By using information for purposes other than those for which it was intended.

UNAUTHORISED COLLECTION OF INFORMATION


A lot of information that is collected is done so without the permission of the people
involved. Some examples of unauthorised collection of information are electronic
eavesdropping, industrial espionage and surveillance.
INDUSTRIAL ESPIONAGE
This is when secret information is obtained by spying on competitors or opponents.
ELECTRONIC ESPIONAGE
This is the use of electronic devices to monitor electronic communication between two or
more groups, without the permission of any of the communicating parties. Data may ne
encrypted before it is transmitted to prevent eavesdropping on that data.
ELECTRONIC SURVEILLANCE
Computer surveillance involves the use of technology to gather information from the user
and from the computer, often without the user’s knowledge. Examples of computer
surveillance include:
 Loss of privacy for the user
 Lack of security
 Potential misuse of information – possibly for monetary gain

WAYS TO REDUCE MISUSE OF INFORMATION


 Enforcing data protection laws
 Utilising security systems
 Keeping information accurate and up to date
 Having severe penalties for when employees and employers divulge private
information

Page 70 of 122
DATA PROTECTION LAWS
These laws are designed to protect individuals and organizations. Data protection laws
generally state that personal data must:
 Be obtained and processed fairly and lawfully
 Be held for specified purposes
 Not be used for any reason incompatible with its original purpose
 Be relevant and adequate
 Be accurate and up to date
 Not be kept longer than necessary
 Be made available to the individual concerned and provision made for corrections
 Be kept secure

PIRACY
Software piracy is the copying of programs without consent of the owner.

Page 71 of 122
INFORMATION TECHNOLOGY: JOB SKILLS AND CAREERS

ROLES OF PERSONNEL IN COMPUTER RELATED PROFESSIONS

PROGRAMMERS
 Write applications programs or system programs
 Test and debug programs
 Prepare the installation of CD-ROMS
 Maintain programs

SYSTEMS PROGRAMMER
 Design systems programs
 Write systems programs
 Test and debug programs

SYSTEM ANALYSTS AND DESIGNERS


 Interview users who need information for a computer system
 Review the manual or computerised system to find a solution
 Define and design the computer hardware and software system
 Inform management on the status of the project
 Work with the programmers to develop and test the system
 Assist in documenting the system and the training of users

MANAGERS
 Make sure jobs in the department are done correctly, on time and within the
budget
 Prepares budgets for the department
 Manage the human resources within the department

DATABASE ADMINISTRATORS
 Designs and develop database applications
 Control access to the data
 Keep the data up to date

NETWORK ADMINISTRATORS
 Set up the network
 Develop and/or install the software that is used on the network
 Grant access privileges
 Monitor the use of the network

DATA-ENTRY CLERKS
 Transfer data from source documents onto machine-readable media or directly
into the computer
 Verify previously entered data

COMPUTER OPERATORS
 Start up and shut down the computer equipment

Page 72 of 122
 Supervise data-entry operators
 Back up data files on a regular basis
 Mount tapes, load printer paper, change ribbons, etc.

LIBRARIANS
 File, store and distribute data files, tapes, diskettes, compact disks, etc.
 File archived material
 File and distribute hard copies
 File documentation for programs

TECHNICIANS
 Assemble and service computer equipment
 Find and fix computer problems

COMPUTER ENGINEERS
 Design computer configurations
 Determine the network cabling requirements and layout
 Determine the power requirements for the computer department
 Design computer chips
 Design and develop processes for the manufacturing of computer parts

CONSULTANTS
 Advise clients on solutions to their problems
 Identify the best source for procurement of hardware and software

DATA COMMUNICATIONS SPECIALISTS


 Determine the requirements associated with the data communication using WANs
and/or LANs
 Set up the teleconferencing equipment

COMPUTER TRAINERS
 Train people to use computer hardware and software
 Develop training manuals
 Examine and mark examination scripts

ELECTRONIC DATA-PROCESSING AUDITORS (EDP)


The main responsibility of an electronic data processing auditor (EDP) is to monitor and
assess the compliance of all aspects of the information system and to report and issue
corrective action requests for non compliance to standard operating procedures. Other
duties are to:
 Determine the accuracy of processed data
 Inspect methods to ensure that procedures and routines are adhered to.

Page 73 of 122
Page 74 of 122
PROBLEM SOLVING AND PROGRAM DESIGN
INTRODUCTION TO PROGRAMMING
SOLVING THE PROBLEM
You should first think about a method and develop an algorithm to solve the problem. An
ALGORITHM is a sequence of precise steps, which results in a solution.
Problem solving is usually broken down into two phases:
ALGORITHM PHASE
In this phase, there are three steps:
1. Clearly define the problem that you want to solve.
2. Design an algorithm that is precise and well thought out to solve the problem.
3. Test your algorithm. You must make sure your algorithm works correctly before
you can write a program for it.

IMPLEMENTATION PHASE
In this phase, there are three steps:
1. Translate your algorithm into a programming language. Example Pascal. This
translation must be correct and free of:
 SYNTAX ERRORS, which are the errors resulting from incorrect
use of the programming language syntax.
 LOGIC ERRORS made by the programmer, such as those made
by using wrong signs or arithmetic operators.
2. Test the program to make sure it produces the correct results.
3. Document the program. Here you write comments on how to use the program, as
well as comments within the program on how it works.

DEFINING THE PROBLEM

Page 75 of 122
When a problem is first analysed, the objectives should be specified first, this is, what the
program is meant to do. The following four steps are used to organise and summarise a
programs objectives.
1. Specify the output – what kind of output are you expecting from this program? Is
it in readable form or is it for input to another program?

2. Specify the input – since you know what the output is you can specify what the
input should be.

3. Specify the processing – what processing should be done on the input to get the
necessary output?

INPUT – OUTPUT – PROCESSING (IPO) CHARTS or DEFINING DIAGRAMS


A formal approach to defining a problem is to construct a DEFINING DIAGRAM / IPO
CHART. A defining diagram is a table with three columns, which represents the three
components: INPUT, OUTPUT and PROCESSING. The input is the source data that
is provided. The input can be easily identified by the keyword that precedes it – given,
read or accept. The output is the end result required. Keywords that help identify the
output are, print, display, produce, output. The processing column is a list of what
actions are to be performed to achieve the required output. If this is done properly
writing the ALGORITHM (a sequence of instructions which rigorously defines a
solution to a problem) would be fairly straightforward. If you are unsure of what goes
under the processing column, you can ask yourself the following question:
“What do I have to do with the inputs in order to produce the desired output?’
The answer to this question is essentially what should be listed in the processing section.

EXAMPLE 1

Page 76 of 122
You are given a problem of finding the sum of three numbers.

DEFINING DIAGRAM
INPUT PROCESSING OUTPUT
num1  Read three numbers TOTAL
num2
 Add the three numbers
num3
together

 Output the total of the


three numbers

The first step is to identify the input (that is, the data that is given). The keyword, read,
identifies the input as three numbers, that is, any three numbers. A name must be given to
refer to each number. We can call them A, B, C or num1, num2 num3. Any name will do
once you are consistent when referring to the numbers by name.
The next step is to identify the output. The keyword, print, identifies the output as the
total (or sum) of the three numbers.
The final step in defining this problem is to list the processing steps. This is you would
list all the actions that must be performed in order to get the desired results. What do you
have to do to the numbers in order to print their total?
1. We must first get the numbers

2. We must then calculate their sum

3. We must then print the total.

NOTE THAT:
1. In the defining diagram, the actions must be listed in a logical sequential order.

2. All the necessary actions must be explicitly stated. For example, the read action
and the print action must not be assumed.

Page 77 of 122
The processing section is NOT the solution to the problem. It is simply a list of the
things that must be done in order to solve the problem.

EXAMPLE 2
You are given the problem of finding the average temperature on a particular day.
However, you are told to ask the user to input the maximum and minimum temperature
readings. You then calculate and output the average temperature. This is calculated by
(maximum temperature + minimum temperature) divided by 2
INPUT PROCESSING OUTPUT
Max_temp  Prompt for max Average_temp
Min_temp temperature, min
temperature

 Read max_temp,
min_temp

 Calculate average temp

=(max_temp +
min_temp)/2

Page 78 of 122
ALGORITHM DESIGN
An Algorithm is the step-by-step instructions required to obtain the solution to a problem.
It must have a set of rules, must be explicit and have a clear stopping point. It is really
used to expand the processing part of the IPO chart in PSEUDOCODE or pseudo-
English. The algorithm should start with a title and end with the keyword END.
A good algorithm should be:
 Correct – it should accept all inputs (even invalid inputs) and output a correct
answer or meaningful response or message.

 Simple – each step of the algorithm should perform one logical step in solving the
problem.

 Clear – the algorithm should be easy to read and understand.

 Precise – the algorithm should present the solution steps precisely and concisely
without referring to low level details.

 Easy to implement – the algorithm should be relatively easy to translate into a


programming language.

 Efficient – the algorithm should enable the program code to produce results
quickly, depending on the problem size, and not waste any memory or time.

PSEUDOCODE
The statements, keywords, variables, loops and subroutines used to define the steps of an
algorithm.
Terms to be familiar with:
 Statements and keywords - related lines of code form a statement. Each statement
has a beginning and an end. Instructions within the statement are called
keywords.

 Variables – store data for the program to work with. A variable could contain text
or numerical values. Examples are Total, num1, score, etc

Page 79 of 122
 Conditional statement – provide a choice such as ‘if … then ... else’. They make
decisions in the program.

 Loops – allows parts of a program to be repeated. Examples are ‘while … do’,


‘for … do’, ‘repeat … until’

 Subroutines – group parts of a program together.

VARIABLES
A Variable is the name that represents a piece of data that can take many possible values.
If the variable is used in the entire program it is called a GLOBAL VARIABLE. If it is
used in one part of the program, it is called a LOCAL VARIABLE. In the examples
above num1, num2, num3, total, min_temp, max_temp and average_temp are all
variables.
NOTE
When new values are placed into previously assigned memory locations, the old
values are replaced by the new ones. Therefore, if it is necessary to retain the
existing value in a memory location, a different variable must be declared to hold
the new data value.

Page 80 of 122
BASIC DATA TYPES FOR VARIABLES
DATA TYPE DESCRIPTION EXAMPLES
Integer Whole numbers, both 23, -50, 0
positive and negative
Real All numbers including 15.7, -19.4, 4.234
fractions
Character Keys on the keyboard A, d, $,? , 4
String Characters put together ‘Hello world’
Boolean True or false TRUE or FALSE

CHOOSING VARIABLE NAMES


It is good practice to choose variable names that reflect the kind of data that is being
stored. It helps in understanding the solution better, if the variable names reflect what
they store.

ALGORITHMIC STRUCTURE
Every algorithm should have the following sections, in the stated order;
HEADER: Algorithm’s name or title.
DECLARATION: a brief description of algorithm and variables used. That is,
a statement of the purpose, as well as initialization of
variables.
BODY: sequence of steps
TERMINATOR: an end statement

Page 81 of 122
READING AND WRITING IN ALGORITHMS
WRITING INSTRUCTIONS
Commands used to input data are READ and INPUT.
Syntax: READ <VARIABLE NAME>
Example: Read Name, Read Num1, Read Radius

PROMPTING INSTRUCTIONS
Prompting statements are used along with input statements to request or notify the user to
enter data into the computer. These statements are usually displayed on the screen.
Prompting instructions usually precede input instructions.
Commands used to prompt the user are PRINT or WRITE
Syntax: PRINT <string>
Example: PRINT ‘Enter student name’

OUTPUT INSTRUCTIONS
These instructions display/output data that is in the computer’s memory. Commands used
to output data are PRINT or WRITE. You can output string variables and numeric
variables as follows.
Syntax: PRINT <variable name>
Example: PRINT Name
The value of a variable is printed, for example, ‘Jane’

OUTPUTTING A STRING CONSTANT


When a string constant is printed, the exact characters within the quotation marks are
printed.
Syntax: PRINT ‘String’
Example: PRINT ‘I am a SACC student’

Page 82 of 122
OUTPUTTING A STING CONSTANT AND A VARIABLE
It may become necessary to output a label for a variable to identify what is being printed.
For example, if $5.00 is printed by itself, you may not know what it means unless a
description or label goes along with it, such as:
The total cost is: $5.00
Syntax: PRINT ‘string’, <variable>
Example: PRINT ‘The total cost is:’, Cost

CONVERTING THE IPO CHART TO AN ALGORITHM


Example: Find the sum of three numbers.
Processing in IPO Chart Algorithm
Read three numbers READ num1, num2, num3
Add the three numbers together Total = num1 + num2 + num3
Output the total of the three numbers PRINT total

Example: Find the average temperature.


Prompt user to enter max_temp and min_temp
READ max_temp, min_temp
Average_temp = max_temp + min_temp / 2
PRINT average_temp

Page 83 of 122
CONTROL STRUCTURES
A structure is a basic unit of programming logic. A structure can be a sequence, a
selection or a loop (that is, repetition).
SEQUENTIAL STATEMENTS
Sequential statements are statements which are executed one after the other, from the first
line to the last line.
EXAMPLE:
Write an algorithm to add two numbers
Print ‘Please enter two numbers’
Read Num1, Num2
Sum Num1 + Num 2
Print ‘Sum of the two numbers = ‘, Sum

Page 84 of 122
SELECTION STRUCTURES
IF… THEN or IF… THEN … ELSE statements. They allow decisions to be made, based
on some condition that evaluates to TRUE. In the case of IF… THEN … ELSE,
alternatives are executed if the condition is FALSE.

IF … THEN CONSTRUCT
The IF … THEN construct contains a condition which is tested before an action can be
undertaken. If the condition holds TRUE, then the action is taken. Otherwise, the
instruction statements between IF … THEN and ENDIF are not taken but are ignored.
SYNTAX:
IF <CONDITION> THEN
<Action to be taken if condition is TRUE>
ENDIF
EXAMPLE:
A company gives out bonuses based on the amount of income generated by their sales
representatives per month. Once the income is greater than $5000.00, a bonus of 10% of
the generated income is given to the employees. Read the income generated and print the
bonus.
PRINT ‘ENTER THE INCOME GENERATED’
READ INCOME_GENERATED
IF INCOME_GENERATED > 5000 THEN
BONUS INCOME_GENERATED * 10%
PRINT ‘BONUS’, BONUS
ENDIF

N.B – CASE 1
We must be aware of where the PRINT statement is placed. If it is placed within the
IF… THEN- ENDIF construct, only if the income generated is greater than $5000.00
is the bonus printed.
PRINT ‘ENTER THE INCOME GENERATED’
READ INCOME_GENERATED
IF INCOME_GENERATED > 5000 THEN
BONUS INCOME_GENERATED * 10%
ENDIF
PRINT ‘BONUS’, BONUS

Page 85 of 122
N.B – CASE 2
In this case, the PRINT statement is placed outside the IF-THEN-ENDIF construct.
So the word BONUS is printed regardless of whether the bonus is actually calculated
or not.

INITIALISING A VARIABLE
It may sometimes be necessary or wise to initialise a variable, that is, to give the variable
a starting or initial value.
BONUS = 0
PRINT ‘ENTER THE INCOME GENERATED’
READ INCOME_GENERATED
IF INCOME_GENERATED > 5000 THEN
BONUS INCOME_GENERATED * 10%
ENDIF
PRINT ‘BONUS’, BONUS

N.B – CASE 3
In case 3, if the income generated is less than or equal to $5000.00 and no bonus is
calculated then the bonus printed will be $0.00. This is because the figure has
previously been stored in memory
QUESTIONS:
A car rental firm leases its cars for $250.00 per day. The manager gives a discount based
on the number of days that the car is rented. If the rental period is greater than or equal to
7 days then a 25% discount is given. Read the rental period and print the discount given.
PRINT ‘ENTER RENTAL PERIOD’
READ RENTAL_PERIOD
IF RENTAL_PERIOD >=7 THEN
DISCOUNT (250 * RENTAL_PERIOD) * 25%
PRINT ‘DISCOUNT’, DISCOUNT
ENDIF

Page 86 of 122
Write an algorithm to read the score of a student in an exam and determine whether the
student has passed. If the score is greater than or equal to 50, the student has passed.
Print “PASS” if the student has passed.
PRINT ‘ENTER STUDENT MARK’
READ MARK
IF MARK >= 50 THEN
PRINT ‘PASS’
ENDIF

THE IF – THEN – ELSE CONSTRUCT


The syntax for the IF-THEN -ELSE construct is as follows:
IF <Condition> THEN
<One or more instructions which will be carried out if the condition is
TRUE>
ELSE
<One or more instructions which will be carried out if the condition is
FALSE>
ENDIF
EXAMPLES:
Input the age of a person. If the age is greater than 35, output “old person” otherwise
output “young person”
PRINT “ENTER THE AGE”
READ AGE
IF AGE > 35 THEN
PRINT “OLD PERSON”
ELSE
PRINT “YOUNG PERSON”
ENDIF

Page 87 of 122
A student is given a 5% discount off the fees for a course if the fees are paid before 30
days. Read a fee and the number of days. Output the fee, discount amount and fee less
the discount amount.
PRINT “ENTER THE FEE AND THE NUMBER OF DAYS”
READ FEE, DAYS
IF DAYS < 30 THEN
DISCOUNTAMT = FEE * 5/100
ELSE
DISCOUNTAMT = 0
ENDIF
AMTDUE = FEE – DISCOUNTAMT
PRINT “FEE”, FEE
PRINT “DISCOUNT AMT”, DISCOUNTAMT
PRINT “FEE LESS DISCOUNT AMT”, AMTDUE

THE IF – THEN – ELSE -IF CONSTRUCT


The syntax for the IF-THEN –ELSE- IF construct is as follows:
IF <Condition> THEN
<One or more instructions >
ELSE
IF <condition> THEN
<One or more instructions>
ENDIF
ENDIF
EXAMPLE:
A stadium has four stands, A, B, C and D. The admission fee for stand A is $2.00, stand
B is $2.50, stand C is $4.00 and stand D is $5.00. Read a stand and the number of
spectators in the stand. Calculate and print the revenue for the stand.
PRINT “ENTER A STAND AND THE NUMBER OF SPECTATORS”
READ STAND, SPECTATORS
IF STAND = “A” THEN
REVENUE = SPECTATORS * 2.00
ELSE
IF STAND = “B” THEN
REVENUE = SPECTATORS * 2.50
ELSE
IF STAND = “C” THEN
REVENUE = SPECTATORS * 4.00
ELSE

Page 88 of 122
IF STAND = “D” THEN
REVENUE = SPECTATORS * 5.00
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
PRINT “STAND”, STAND
PRINT “REVENUE”, REVENUE

N.B. FOR EVERY IF STATEMENT THERE MUST BE A CORRESPONDING


ENDIF

LOOPS
Loops are useful for repeating parts of a program. That is, they will repeatedly execute a
section of a program until the end condition is satisfied. In order to exit from a loop, you
must have a method for checking to see if you have completed the task. Once a loop
terminates, control is returned to the first sentence after the block of sentences in the
loop.
The basis structure of a loop is:
 Initialise the variable to some start value – this variable usually determines
whether or not the loop executes or not.
 Test the variable against a condition.
 Execute the body of the loop.
 Update the value of the variable.

There are two types of loop statements:


 Indefinite – when you do not know in advance how many times to repeat the loop
(WHILE or REPEAT loops)
 Definite – when you know in advance how many times to repeat the loop (FOR
loop).

WHILE LOOP
User input ----- (then) ---- check condition ---- (then) ---- performs statements

REPEAT LOOP
User input ---- (then) ---- performs statements ---- (then) ---- check condition

WHILE - DO LOOP

Page 89 of 122
The WHILE –DO loop repeatedly executes a statement or a block of statements as long
as the condition is TRUE.
The condition in a WHILE loop is tested at the beginning of the loop, so it is possible
for the statement not to be executed at all.

The general form of the WHILE – DO LOOP is:


<An initial value for the condition>
WHILE <condition> DO
<Instructions which are to be repeated>
ENDWHILE

The initial value for the condition can be stored in a variable which is read or it can be a
value which is assigned to the variable. The initial value is necessary so that the
comparison for the condition can be made when the WHILE instruction is executed the
first time.
The termination constant is known as the DUMMY VALUE. A dummy value is not a
real value for the problem being solved. For example 999, could be the dummy value.

EXAMPLE:

NUMBER = 1 THESE TWO


WHILE (NUMBER <= 3) DO STATEMENTS ARE
NUMBER = NUMBER + 1 EXECUTED ONLY
PRINT “THE NUMBER IS”, NUMBER IN THE LOOP
ENDWHILE
PRINT “OUT OF LOOP”

AGE = 15
WHILE (AGE < 20) DO
PRINT “YOU ARE NOT 20 YEARS OLD”
AGE = AGE + 1
ENDWHILE
PRINT “YOU ARE OUT OF THE LOOP”

SELECTING THE CORRECT OPERATOR FOR THE CONDITION


1. Use = if all values except a particular value can cause the loop to be terminated.

EXAMPLE:
WHILE NO = 0 DO
The loop is repeated once, NO = 0, otherwise it is terminated.
2. Use <> if only one value is to be used for terminating the loop.

EXAMPLE:

Page 90 of 122
WHILE SCORE <> 999 DO
3. Use <= or < if the value to terminate the loop are less than the dummy value or
less than or equal to the dummy value respectively.

4. Use >= or > if the values to terminate the loop are greater than the dummy value
or greater than or equal to the dummy value respectively.

THE FOR LOOP


The FOR- LOOP is used for looping for a definite number of times.

THE GENERAL FORM OF THE FOR LOOP


FOR <VARIABLE> = <BEGINNING> TO <ENDING> DO
<INSTRUCTIONS WHICH ARE TO BE REPEATED>
ENDFOR
OR

FOR <VARIABLE> = <BEGINNING> TO <ENDING> STEP <INCREMENT> DO


<INSTRUCTIONS WHICH ARE TO BE REPEATED>
ENDFOR

FOR is the beginning and ENDFOR is the end of the loop. The loop variable is used to
count the number of times the loop is executed. The value of this variable starts at the
beginning value and is increased by one each time the loop is executed unless otherwise
directed by the step clause.
The step clause indicates how much the loop variable is to be increased or decreased by
each time the loop is executed. The step clause is not necessary if the increment is one.
When the end value is reached, the loop terminates and the instruction following
ENDFOR is then executed

EXAMPLE: Print a table to find the square and cube of all even numbers between 2
and 20 inclusive
PRINT “NUMBER”, “SQUARE”, “CUBE”
FOR NUMBER = 2 TO 20 STEP 2 DO
SQUARE = NUMBER * NUMBER
CUBE = NUMBER * NUMBER * NUMBER
PRINT NUMBER, SQUARE, CUBE
ENDFOR
EXAMPLE: Calculate the sum of all the odd numbers between 1 and 20. Print the
total

Page 91 of 122
SUM =0
FOR ODDNUMBER = 1 T0 20 STEP 2 DO
SUM = SUM +ODDNUMBER
ENDFOR
PRINT SUM

EXAMPLE: Write an algorithm to read 25 numbers and print the lowest


LOWEST = 999
FOR COUNT = 1 TO 25 DO
PRINT “ENTER A NUMBER”
READ NUMBER
IF NUMBER < LOWEST THEN
LOWEST = NUMBER
ENDIF
ENDFOR
PRINT “THE LOWEST NUMBER ENTERED IS”, LOWEST

REPEAT … UNTIL LOOP


The REPEAT loop is similar to the WHILE loop. It performs a calculation an
undetermined number of times by comparing a value against a condition until the
condition is FALSE. This condition is tested at the end of the loop, so the statement will
always be executes at least once.
STRUCTURE OF THE REPEAT LOOP

STATEMENTS

DECISIO
FALSE
N

TRUE
The general form of the REPEAT – UNTIL loop
REPEAT

Page 92 of 122
<Statements>
UNTIL <condition is TRUE>

EXAMPLE:
A number is given a value 1. Repeat the following calculation until the value reaches 10
or more, add 2 to the number and display the results.

A= 1
REPEAT
A=A+2
Print ‘The value of A is ‘, A
UNTIL A>= 10

Page 93 of 122
FLOWCHARTS
Flowcharts are diagrams that arrange the components of a problem in a logical sequence,
which helps to avoid logic errors. The shapes used are shown below. The shapes are
linked using arrowed lines that point to the next step in the sequence.

START / STOP

DECISION

INPUT / OUTPUT

PROCESS

Page 94 of 122
EXAMPLE:
Add the weights of two people to get a total weight.

Start

Enter
weight1,
weight2

TotalWeight = weight1 + weight2

Print ‘Total
weight’,
Totalweight

Stop

Page 95 of 122
ARITHMETIC OPERATORS
OPERATOR MEANING
+ ADDITION
- SUBTRACTION
* MULTIPLICATION
/ DIVISION

RELATIONAL OPERATORS
OPERATOR MEANING
< LESS THAN
> GREATER THAN
= EQUAL TO
<= LESS THAN OR EQUAL TO
>= GREATER THAN OR EQUAL TO
<> NOT EQUAL

CONDITIONAL AND LOOPING OPERATORS


OPERATOR PURPOSE
IF Compares a statement against a condition to see if it is TRUE or FALSE
THEN Executes an instruction when a condition is TRUE
AND Links two or more conditions that have to be met
OR Provides an extra condition
ELSE Executes an instruction should a condition be false
FOR Creates a loop that is carried out a known number of times
WHILE Creates a loop that is carried out an unknown number of times

BOOLEAN OPERATORS
When selection is based upon one or more expressions/decisions being TRUE or FALSE,
it is possible to combine the expression/decisions together using the Boolean operators.
TRUE – 1
FALSE - 0
Truth table for NOT
 With the NOT operator the result becomes the opposite. If it is TRUE it becomes
FALSE, vice versa.

A NOT
1 0
0 1

Truth table for AND


 If the value A is TRUE and the value B is TRUE, then the result of A AND B
is TRUE

Page 96 of 122
 If any one of the values is NOT TRUE then the result is FALSE

A B A AND B
1 1 1
1 0 0
0 1 0
0 0 0

Truth Table for OR


 If an value of A is TRUE, or any value of B is TRUE, then the result of A or B
is TRUE

 If both A and B are FALSE then the result is FALSE.

A B A OR B
1 1 1
1 0 1
0 1 1
0 0 0

Page 97 of 122
TESTING ALGORITHMS
Before you convert an algorithm to code, it is a good idea to check that it is complete and
logical. This can be done by using actual values on the algorithm. There are two ways to
do this: DRY –RUN TESTING and TRACE TABLES.
DRY –RUN TESTING
Dry-run testing is also known as desk checking. This is when you substitute values for
the variables and follow the instructions in the algorithm step by step to arrive at a
solution. A dry-run test will tell you if there are any logic errors in your algorithm.
EXAMPLE:
Read b, c
a=b+c
d=a*2+c
e=d–3
To conduct a dry run test, substitute actual values for the variables that are entered.
Assume b = 10 and c = 2
a = 10 + 2 = 12
d = 12 * 2 + 2 = 26
e = 26 – 3 = 23
If an algorithm contains logic errors, you will not be able to complete a dry run test.
EXAMPLE:
Read b, c
a=b+d
d=b*2+c
e=d–3
Using the same values for b and c, the dry run test would go as follows: a = 10 +?
No value has been calculated for d, and the computer cannot skip ahead to the next line to
figure out what d should be. This dry run test has revealed a logic error in the algorithm.
TRACE TABLES
Trace table is a very useful tool which allows you to see the state of your algorithm with
as much detail as you wish. They are tables that track each variable as it progresses
through the calculation. It will show you the output of each cycle of calculation within a
problem.
EXAMPLE:
Number = 0
Number2 = 1
While number <12 Do
Number = number + 3
Number2 = number2 + 2
Print number, number2
EndWhile

Page 98 of 122
The first step is to create a table with a column for each variable and one row per pass, so
the number of rows depends on how many times the calculations is carried out.
 The first row contains the initialised values

 The second row contains the values of number after 3 is added to it and the value
of number2 after 2 is added to it.

 The loop stops after number reaches 12.

Number Number2
0 1
3 3
6 5
9 7
12 9

WHAT IS A COMPUTER PROGRAM?


A computer program is a series of coded instructions for the computer to obey and
represent a method of processing data.
Programs can’t be written in English. They must first be written using a special language
called a programming language. A PROGRAMMING LANGUAGE (e.g. BASIC,
PASCAL, and C+) consists of a set of codes and rules which can be used to construct
commands for the computer. These commands are read and translated into electronic
pulses needed to make the computer work. Programs are written by programmers.
COMPUTER LANGUAGES
A computer language is a set of instructions used for writing computer programs. There
are THREE (3) levels of languages:
1. MACHINE LANGUAGE – this was the first language available for
programming. It varies from one computer to another, but the basic principles are
the same. MACHINE LANGUAGE PROGRAMS are written using a series of
0’s and 1’s i.e. using a BINARY SYSTEM. All programs written today must be
translated into machine language before they can be executed (used) by the
computer.
EXAMPLE: 110110001
2. ASSEMBLY LANGUAGE / LOW LEVEL LANGUAGE – these were
developed to replace the 0’s and 1’s of machine language with symbols that are
easier to understand and remember. Like with machine language, Assembly
language varies from one make of computer to another so that a program written
in one assembly language will not run on another make of computer.
EXAMPLE: LDA 300

Page 99 of 122
ADD 400
STA 500
3. HIGH LEVEL LANGUAGE – these differ from low level languages in that they
require less coding detail and make programs easier to write. High level
languages are designed for the solution of problems in one or more areas of the
application and are commonly described as application-oriented or problem-
oriented languages. High level languages are not machine dependant. Programs
written in a high level language must be translated to a form which can be
accepted by that computer, i.e. they must be converted into machine code. This is
achieved by means of a special program – either a COMPILER or an
INTERPRETER.
COMPILER: compilers translate high-level programs into machine code. Each
high level instruction normally converts into many machine instructions. The
input (i.e. the high level code) into the compiler is called the source code and the
output (i.e. the machine level code) is called the object code. The process of
converting high level language to machine language in this way is called
COMPILING.

INTERPRETERS: like the compiler, this is a special program which translates


code written in a high level language into machine language. In contrast to a
compiler, an interpreter does not translate the whole program prior to execution.
It translates the code line by line during the execution of the program. This has
the effect of slowing down the running of programs. With the compiler, all the
translation is done first, and then the object program is executed.

HIGH LEVEL COMPILER / MACHINE


LANGUAGE INTERPRETER LANGUAGE
SOURCE CODE OBJECT CODE

COMPARISON OF THE DIFFERENT LEVELS OF LANGUAGES

LANGUAGE ADVANTAGE DISADVANTAGE

Page 100 of 122


MACHINE LANGUAGE  Programs execute fast  Programming slow and
tedious.
 Code difficult to learn, read,
understand and correct.
 Code is machine specific
i.e. can’t be used in the
same form on other
computer models.
ASSEMBLY  Programming faster  Programming slower and
LANGUAGE and less tedious than more tedious than for high
for machine language. level languages.
 Code is easier to  Code is machine specific
learn, read and
understand than for
machine language.
 Execution faster than
high level languages.
 More compact than
high level languages.
HIGH LEVEL  Programming faster  Program executes slower.
LANGUAGES and less tedious.
 Code is easier to
learn, read,
understand and
correct.
 Language is more
English and math like
 Programmer doesn’t
need to know details
of the computer.

GENERATION OF LANGUAGES

GENERATION DESCRIPTION

FIRST GENERATION Machine language was used during this


period

SECOND GENERATION Assembly language was introduced and


used

THIRD GENERATION Third generation are high-level languages.

Page 101 of 122


Instead of using machine specific code,
they use statements in English that are east
for programmers to use. Examples –
Pascal, COBOL, FORTRAN, BASIC, C

FOURTH GENERATION These are the newest breed of


programming languages. They are often
described as very high level languages and
referred to as 4GLs. 4GLs are easy to
learn, easy-to-use languages that enable
users or programmers to code applications
much more quickly than they could with
lower level languages. Two examples are
DBASE and FOXPRO

FIFTH GENERATION This is built on the third and fourth


generation languages. They are sometimes
called non-procedural languages. This
means the programmer only need to write
the goals that have to be achieved and any
constraints or parameters that are required.
The computer solves the problem- it works
out the required steps. This is mainly used
in artificial intelligence. Example – Prolog.

IMPLEMENTING A PROGRAM
The five stages that ensure smooth progress in implementing a program is as follows:
 Stage 1: Create the source code.

 Stage 2: Interpret and compile.

 Stage 3: Link.

 Stage 4: Test and execute.

 Stage 5: Maintain the program.

Page 102 of 122


Stage 1: Create the source code.
This is when you write the program using a programming language. The code that is
written using a high level language or assembly language is known as SOURCE CODE.
Stage 2: Interpret and compile.
The computer does not understand high level source code. It requires an interpreter or
compiler to translate the source code into object code, which is a machine language it can
understand.
Stage 3: Link.
This is combining various pieces of code and data together to form a single executable
object code that can be loaded in memory. Linking can be done at compile time, at load
time and also at run time.
Stage 4: Test and execute.
Before you run or execute a program it should be tested on paper to see if it works
properly. If there are errors in the program it will not run properly.
Stage 5: Maintain the program.
Once you have a working program that fulfils its purpose, try to maintain it. It may need
extra features or could be restructured so it is easier to use. Go back to the program code
and modify it.

TESTING AND DEBUGGING


Programs are tested to pick up errors. There are three kinds of errors that can prevent a
program from working: logic errors, syntax errors and run-time errors. Debugging is the
process of fixing errors when you discover them.
SYNTAX ERRORS
Syntax errors occur when a mistake is made in the language rules or sentence structure of
the programming language. Examples of syntax errors include misspelling of a variable
or key word, and incorrect use of looping structures. Syntax errors stop the source code
from being converted to machine code.
LOGIC ERRORS
Logic errors occur when a programmer makes mistakes in the sequence of the program
sentences, such as using the wrong mathematical formula or wrong operator in an
expression. The program will usually compile.
RUN-TIME ERRORS
Run-time errors occur as the program compiles or ‘runs’. These errors are usually due to
unexpected events such as division by zero, or lack or memory for the computer to
manipulate the data.

TYPES OF TESTING

Page 103 of 122


Test your program before you execute it. You can do this in two ways:
 Testing on paper and

 Computer testing

Dry run tests and trace tables are methods of testing on paper. Dry run testing is a
method of checking that a program does not contain any logic errors. If the program uses
loops, you can use trace tables to trace the logic of a program through multiple values.
Computer testing is where you test a program on a computer by running it with as many
different types and combinations of data as possible.

VALIDATION AND VERIFICATION


Validation is where a program checks that the data a person has entered is valid, but it
cannot check the accuracy of the data entered. Example, if a user is required to enter an
eight digit password, the program can check that the user has entered eight digits, not
more or less. Other examples of validation are:
 Use data ranges to ensure a value falls in a specified range.

 Check that the correct format is used, such as a date or time format.

 Use a spell checker.

 Check that a field has not been left blank

 Check that the correct data type has been used, such as a numeric value and not
symbols.

Verification checks that the data entered is exactly correct. This is a time consuming
process and tends to be used only when data accuracy is crucial.

DOCUMENTING PROGRAMS
Documentation says what a program does and how it is used. A program is not much use
to a person if they do not know what it is or what it is used for.

INTERNAL DOCUMENTATION
Internal documentation is also called technical documentation. If you are looking at a
long and complex program that you did not write, internal documentation can help you
see how it works. There are several forms of internal documentation:

Page 104 of 122


 A programmer can insert comments into the code. Comments are sentences
intended for the user. Comments are useful for explaining a piece of code or
naming the program.

 Indentation, groups sets of statements to reveal the structure and flow of a


program.

 White spaces are spaces in a program created by indentation and by writing


statements on separate lines instead of on one line. White spaces help to make
programs clear and easy to follow.

 Identifiers are used by different items of data in a program. Good identifiers


clearly indicate the nature of the data.

EXTERNAL DOCUMENTATION
External documentation is often called user documentation or user manuals. User
manuals provide installation instructions, operation instructions and any other technical
specifications that a user might need to run or install a program.

Page 105 of 122


PROGRAMMING IN PASCAL
WRITING PROGRAMS IN PASCAL
The basic structure of a Pascal program looks like this:
PROGRAM Title (input, output);
CONST
{Declare constants that will be used in the program}
VAR
{Declare all variables that will be used in the program}
BEGIN
{Program statements}
END.

The PROGRAM part is where you name the program. You can give the program any
name you want, but it should be as relevant as possible. For example if the program
calculates the average outdoor temperature, you may want to name is as follows:
PROGRAM Average_Temp (input, output);
In the CONST and VAR sections, you declare all the constants and variables that you
will be using in the program.
You write the input, output and processing instructions between BEGIN and END.
Every statement ends with a semi-colon (;)
There is a period (full stop) after END.

Example: Write a program to add two numbers and output the results.
PROGRAM addition (input, output);
VAR
Num1, Num2, Sum: REAL;

BEGIN
{User enters the two numbers}
WRITELN(‘Please enter a number’);
READLN(num1);
WRITELN(‘Please enter a number’);
READLN(num2);
Sum:= num1 + num2;
WRITELN(‘Sum of the two numbers = ‘ , Sum);
READLN;
END.
DECLARING DATA TYPES

Page 106 of 122


To write a program, you need to know how to take data and use it to create a structure
that can solve a problem this is called manipulating data. To do this, you need to know
what data types can be manipulated.

DATA TYPE PASCAL KEYWORD


INTEGER – whole numbers eg. 10, 5, -3 Integer
REAL – numbers that include a Real
decimal point. Eg. 3.8, -0.5
CHARACTER - letters of the alphabet, Char
symbols, or anything non-numeric.
STRING – a series of characters is String
called a string.
BOOLEAN – Holds a True/False Value Boolean
or Yes/No

VARIABLES AND CONSTANTS


 CONSTANTS - the data holds the same value throughout a program, such as the
number of seconds in a minute or your name.

 VARIABLE- the data value is not known until it is entered or it changes


throughout a program, such as the outdoor temperature or students’ marks in a
test.

DECLARING VARIABLES
To declare a variable in a program, state the identifier then the data type.
Variable_identifier: data type;

RULES FOR A VARIABLE IDENTIFIER OR VARIABLE NAME


 It must start with a letter of the alphabet.

 It can include upper and lower case letters, numbers and the underscore
symbol.

 It cannot have spaces or punctuation marks.

 It must not be a word that is reserved for the programming language, such as
integer.

 It cannot be a plural word.

 It should be short and simple.

Page 107 of 122


 Pascal is not case sensitive.

PASCAL RESERVED WORDS


And, array, begin, case, const, div, else, end, file, for, function, if, label, mod, nil, not, of,
or, procedure, program, repeat, then, to, until, var, while, with

PUNCTUATION
Put a SEMICOLON at the end of any declaration or statement in Pascal.

INITIALISING A VARIABLE
Sometimes you may want a variable to hold a particular value at the start of a program,
such as zero. So you initialise that variable when you declare it. Variable are usually
initialised when using loops.
Pascal syntax to initialise a variable:
Identifier: = value;
Counter: =0;
This statement is called an assignment statement.

DECLARING CONSTANTS
You use the CONST section to declare a constant at the start of a Pascal program.
Pascal syntax to declare const:
Const_identifier:= value;
Year:=2010;

MANIPULATING DATA
In a programming language, an instruction that is a single word is called a command. A
set of instructions is called a construct. In a Pascal program, you put all the input,
processing and output instructions between BEGIN and END and after you have
declared the variables and constants. These instructions are called executable statement.

INPUT AND STORAGE


Input and storage instructions tell the computer to take in data that is entered by a user,
and then store it so it can be used to solve a problem or perform a calculation. Your
pseudocode may contain these words for input statements: read, enter, input. In Pascal
you use READ or READLN.
The command READLN will automatically move to the next line after it has read data
from the current line whereas READ the cursor will remain on the same line.
Example:
Readln(temp);
Read(a);

Page 108 of 122


PROCESSING
Processing instructions perform the calculations. In other words, they manipulate the
data that was read or declared. Use the operators in the table below to create arithmetic
expressions in Pascal:
OPERATOR MEANING
* Multiplication
/ Real division (will return a result as a real number)
MOD Modulus(divides two numbers and returns the
remainder)
DIV Integer division (divides two numbers and returns
the integer value)
+ Addition
- Subtraction

OUTPUT
Output instructions tell the computer to display information on the screen, usually the
results of a calculation. Your pseudocode may contain these words for output statements:
output, display, write or print. In Pascal you use WRITE or WRITELN. Similar to the
READLN, WRITELN will automatically move to the next line when the data had been
displayed in the current line.
Example:
WRITE (‘Total Price’);
WRITELN (‘Total Price’);
WRITELN (‘Total Price of item is’ , price);

CONTROL STRUCTURES
Control Structures deal with conditional statements and loops in Pascal. Here is a
reminder of how to use conditional statements when solving a problem.

Page 109 of 122


 The IF – THEN construct is used when you want to compare a value against a
condition. If the condition is TRUE a specific action is carried out.

 If the problem contains more than one option – another action that must be carried
out should not be TRUE – use the IF-THEN-ELSE construct.

 If you want to test more than one condition at a time, you use the AND and OR
constructs.

EXAMPLE of Pascal Code:


Write a Program to enter a number between 1 and 10 and subtract 2. If the result is less
than 5, multiply it by 4 and display the result of the multiplication.
Program One_to_Ten (input,output);
Var
Num, result1, result2: Integer;
Begin
Writeln(‘Enter a number between 1 and 10’);
Readln(num);
Result1:= num – 2;
If result1 < 5 Then
Begin
Result2 := result1 * 4;
Writeln(‘The Result is ‘, result2);
End;
End.
ARRAYS
WHAT IS AN ARRAY?
An ARRAY is a group of data items that are all the same type, such as integers. Arrays
are used to store more than one value in a variable. An array uses several storage
locations to store variables of the same type, but the array has ONE name. You refer to
each storage location using the name of the array and a subscript or index.
In an array, the subscript or index tells the computer where to locate data in the array.

DECLARING ARRAYS
You declare an Array like you declare any other variable but you also declare how many
variables you want in the array.
Syntax:
Array_Name: Array [Lower Number .. Upper Number] Of Data Type;

 ARRAY_NAME is the Identifier you give to the array.

Page 110 of 122


 The Keyword ARRAY tells you that an array is being declared.

 The number range [LOWER_NUMBER .. UPPER_NUMBER] is the number of


variables you want in the array. These values are not the values stored in the
array. They are the subscripts or indices.

 OF DATA TYPE tells the computer what kind of data type you want stored in the
array, such as integers.

Example of Pascal Declaration:


Program First_Array (input, output);
Var
Number_array : array[1..20] of integer;
Begin
.........
End.
ASSIGNING A VALUE TO AN ARRAY
Syntax:
Name_of_array [index] := value;
Pascal Statement
Number_array[2]:=14;

Page 111 of 122


FULL PASCAL PROGRAM WITH AN ARRAY
Write a program to read in the marks of 10 students and store them in an array MARKS.
Calculate the sum and average of those numbers.
Program Calculate (Input,Output);
Var
Sum, N : Integer;
Average: Real;
Marks : Array[1..10] of Integer;
Begin
Sum:=0;
For N := 1 to 10 Do
Begin
Writeln(‘Please enter a Mark’);
Readln(Marks[N]);
Sum := sum + Marks[N];
End;
Average := Sum /10;
Writeln(‘ The sum is ‘, sum);
Writeln(‘ The Average is ‘,Average);
End.

PROCEDURES
Procedures are just like small programs sometimes they are called sub-programs. They
help the programmer to avoid repetitions. A procedure starts off with a Begin and ends
with an End; It can also have its own variables, which cannot be used with the main
program.

Example of a Program with a Procedure and Array


Write a program to read in the marks of 10 students and store them in an array MARKS.
Determine and print the maximum and minimum mark.

Program Calculate (input, output);

Page 112 of 122


VAR
Min, Max, N : Integer;
Marks : Array[1..10] of integer;

Procedure Initialise;
Begin
Max :=0;
Min := 999’
End;
Procedure InputData;
Begin
Writeln(‘Please enter a mark’);
Readln(Marks[N]);
End;
Procedure Dertemine;
Begin
For N := 1 to 10 Do
Begin
InputData;
If (Marks[N] > Max) Then
Max := Marks[N];
If (Marks[N] < Min) Then
Min := Marks[N];
End;
End;
Procedure OutputData;
Begin
Writeln(‘ The Minimum mark ‘ , Min);
Writeln(‘ The Maximum Mark ‘ , Max);
End;
Begin
Initialise;
Determine;
OutputData
End.

Page 113 of 122


INFORMATION PROCESSING
Information processing describes the many ways that data is gathered and interpreted.
The output depends on the interpretation of the input.
Example, an alarm system uses sensors to detect movement in a room. If there is
movement, this data is processed to set off a siren.
Information processing has many benefits that make our lives easier and more efficient:
 It makes a lot of tasks easier and faster. Example, you are able to pay bills online.
 A lot of data is stored during information processing. Stored data is quick and
easy to access and it does not have to be processes or examined again.
 It results in AUTOMATION. Multiple tasks are performed without you even
knowing about them. These tasks require little or no control by humans.
 It enables sharing and analysis of information.

There are some disadvantages to information processing. It can be very expensive to set
up initially because of the hardware, software and technical requirements.

Once information is collected, it is often communicated directly to the person who wishes
to use it. In order for it to be useful, information must be:
 Relevant: it must be what the user needs to know, and be up-to-date

 Accurate: it must be as correct as possible

 Timely: information should be provided for problem-solving before a critical


stage is reached and opportunities are lost

 Complete: it must represent a complete picture of a problem or solution.

 In an appropriate medium: it should be delivered using an appropriate


communication medium, whether by printed material or storage devices

 Cost-effective: the value of information should be more than the cost involved in
its collection.

INFORMATION AS A COMMODITY

Page 114 of 122


An information commodity is an item of information that can be bought or sold. For
example, with online information you may have to pay a charge every time that you
access that information.

FORMS OF INFORMATION PROCESSING


Information is processed in several ways. CONTROL SYSTEMS regulate themselves or
other devices.
 Household appliances, such as microwaves and washing machines, use control
systems to sense when they should start operating, how they should operate and
when to stop.

 Traffic lights are programmed to control the flow of traffic. Many traffic lights
also contain sensors that can tell when there are cars waiting at a red light and
change it to green.

 Alarm systems use heat and motion sensors to determine whether an intruder is in
a room.

 Thermostats sense when the temperature is below a set value and switch the
heating on. They switch off when the temperature reaches another set value.

COMMERCIAL INFORMATION PROCESSING


In business and commerce, information processing is important to keep track of
transactions and records.
Electronic Banking is a very useful information processing system. Manu banks offer
an internet banking service, which allows you to conduct transactions from your bank
account online. You can also do an Electronic Funds Transfer (EFT). EFT transfers
money from one account to another without using cash or cheque. Many people use bank
cards to make purchases. This is an example of EFT.

INDUSTRIAL INFORMATION PROCESSING

Page 115 of 122


Computers automate tasks and do them more efficiently and effectively than humans.
They control robots to package products or assemble cars and electronics.

SCIENTIFIC INFORMATION PROCESSING


Expert systems help scientists process data. Other examples of scientific information
processing;
 Weather forecasting systems collect weather data all over the world and use the
data to predict weather patterns.

 Health-care professionals use automated processing systems to keep track of


patient records. They also use robots to perform heart and eye surgery.

 Laboratories have machines that can read and process data from samples. For
example a machine can analyse a blood sample and find its blood type.

SOURCES OF DATA
To create information from data, you must get that data from a suitable source. Data can
be captured using MACHINE-READABLE or HUMAN READABLE documents.
Machine Readable documents are documents that a computer can read.
Human Readable documents are documents that a human can read.

SOURCE DOCUMENT
A SOURCE document is a document used to capture information by writing it down.
Source documents are human readable. The best example is a form, which may be a hard
copy or softcopy.

TURNAROUND DOCUMENT
A TURNAROUND document is human readable and machine readable. A machine
creates it and a human adds more data or uses it as input for something else. The
document is then read by a computer, which updates or processes records with the new
data. This means that a machine creates it as output, which you modify, and the machine
uses that modified document as input again. Examples are utility bills.

Page 116 of 122


OMR and OCR are used together with Turnaround documents.

DATA LOGGING
Data logging is a method of automatic data capture where a reading from a sensor is input
at regular intervals. This data can then be processed to provide analysis of the
environment. A data logging system consists of sensors connected via an interface to a
computer and some data logging software. The sensors will take measurements and at
required intervals the software will record the data. The results can then be displayed as a
graph or a table.

VALIDATION AND VERIFICATION


Errors are part of any computer information system. There are several approaches to
dealing with the problems that errors cause, specifically detecting when errors occur (so
that they can be corrected) and preventing errors (so that they do not occur).
A human error during data input can be accidental or deliberate:
 Accidental errors are errors that are not made on purpose.

 Deliberate errors are errors made on purpose, usually for gain or to cause disorder.

There are two ways to prevent data errors caused by humans: data verification and data
validation.

DATA VERIFICATION
Data verification ensures that data entered into a computer contains no errors at all. It is a
very thorough way of making sure the data entered is correct. Two methods of data
verification are DOUBLE-ENTRY and PROOFREADING.
Double-Entry is where the same data is entered twice, sometimes by different people. If
the data is differs between the two entries, it does not get processed. It can be expensive
and time-consuming to use this method, but it does not ensure very accurate data capture.
Proofreading checks the data entered against the data on the original source document.
The person entering the data reads the source document and checks that it matches what

Page 117 of 122


was entered into the computer. Sometimes a second person will check the entered data.
This is very time consuming.

DATA VALIDATION
Data validation uses a variety of checks to make sure that data is as accurate and
complete as possible. It does not check the complete accuracy of data, but it does help
ensure that fewer mistakes are made. If the data does not pass the checks, the program
may return an error or the field will not be filled in. the checks depends on the type or
nature of data that is entered.
The most common methods are:
RANGE CHECKS
A range check ensures that numbers entered fall within a specific range. Example: if you
are entering times of the day, you may need to check that the values for hours cannot go
higher than 24. If someone enters 2500 by mistake, that values will not compute.
REASONABLENESS CHECKS
Reasonableness checks ensure that data is reasonable – not completely unrealistic. If you
are entering information into a payroll system, a reasonableness check will ensure that
you do not enter extra zeros by mistake.
DATA TYPE CHECKS
This ensures that the right type of data had been entered. They ensure that only numbers
have been entered or that only symbols and letters have been entered. A field that
captures the age of a person may have a character check that rejects the input of letters or
symbols.
CONSISTENCY CHECKS
This compares data you have entered against other data you have entered. If you enter a
person’s year of birth and their age in separate fields, a consistency check will ensure that
the two fields corresponds with each other. Consistency checks can be used to make sure
that false or dishonest data has not been entered.

PRESENCE CHECKS

Page 118 of 122


Documents and forms have required fields and optional fields. A required field is one
that has to contain a value whereas an optional field can be left blank. In an application
for a bank account, your identity number and address will be required fields and your cell
phone number may be an optional field. A presence check is used to ensure that the
required fields contain data.
LENGTH CHECKS
A length check determines whether the entered data is correct length – the right number
of digits. Area codes and phone numbers usually have a fixed length. If a number is
entered that is longer or shorter than this length, the program will return an error.
CHECK DIGIT
A check digit is an extra digit added to the end of a code. It is used to detect errors
arising from transcription and also to ensure that codes originally produced by a
computer are re-entered into another computer correctly. It is calculated from the other
digits in the number. Check digits are included in barcode numbers.
PARITY CHECKS
All data is transmitted as a sequence of 1s and 0s. A common type of error that occurs
during data transmission is that a bit is swapped from a 0 to a 1 or a 1 to a 0 by electrical
interference. Parity checks detect this type of error, by adding an extra digit to data to
make the total number of 1s (or 0s) either odd or even. Note that a parity check can also
be considered a verification check rather than a validation check since the parity check
ensures that data is correctly transferred from one location to another.

Page 119 of 122


FILE ORGANISATION AND ACCESS
This relates to the use of records, fields and files.
 A record is a collection of related data items (possibly of different types) stored
in fields and treated as a single entity for processing.

 A field contains a single data item, and many fields comprise a record. Each field
has a name and one is the key field used to identify the record.

 A data file is a collection of records holding the same type of information but
about different objects or individuals.

A file has three important characteristics:


 Whether it is permanent or a temporary file.

 The way in which the records of the file are organized on the secondary storage
device. This is called file organisation.

 The way in which records are accessed. (or located).

MASTER AND TRANSACTION FILES


A MASTER FILE is a permanent file which is kept up-to-date and stores the main
information, summary data and key fields in the data.
The Master File contains two types of data:
 Permanent data, such as employee personal data, payroll data employee status and
job title.

 Less permanent data, which is updated on a regular basis, such as hours worked
and taxes deducted.

A TRANSACTION FILE is a temporary file which is used to update the master file
after a certain time (at the end of the day or week for example). The transaction file
updates the master file. The records in the transaction file are used to perform three
important operations:
 ADD: put a new record into the master file

 UPDATE: change the contents of a record or a field that already exists.

Page 120 of 122


 DELETE: remove a record from the master file.

There is also another file, known as the change file or TRANSACTION LOG, which
keeps a record of changes to the transaction file.

FILE ORGANIZATION AND ACCESS METHODS


SEQUENTIAL AND SERIAL
SEQUENTIAL FILE ORDERING is where records are stored in a logical order, such
as alphabetical order.
SERIAL FILE ORDERING is similar to sequential file ordering, except the records are
not stored in any order. They are simply stored one after the other as they are added,
similar to new items on a to-do-list. This type of ordering is often used to capture
transactions as they occur during the day.
SEQUENTIAL ACCESS means accessing records one by one in the order they are
stored until the right one is reached. This type of access is used with sequential file
ordering. SERIAL ACCESS works the same way- the records are read one by one in the
order they are stored until the desired record is found.

RANDOM FILE ORDERING AND ACCESS


RANDOM FILE ORDERING, also known as direct access file ordering, is where files
are stored in any order. The computer maps where all this data is stored so you can
immediately access it when you search for it. RANDOM ACCESS, or DIRECT
ACCESS, allows you to access the record you want without having to go through any
others. The computer locates the data item using the indices.

INDEX SEQUENTIAL FILE ORDERING AND ACCESS


INDEX SEQUENTIAL FILE ORDERING uses an indexed file to store records. In
other words, records are stored in this file in sequential order and a set of indices are used
to refer to each item stored in the file. This file ordering is a combination of sequential
and random file ordering and is used when records need to be stored in sequence but
individual records must be quickly accessible.

Page 121 of 122


INDEX SEQUENTIAL FILE ORDERING uses both types of access to search for
records. Sequential access is used to go through each record, and direct access is used to
find a specific record.

Page 122 of 122

You might also like