You are on page 1of 176

INFORMATION

TECHNOLOGY
NOTES

MARICI MAHARAJH
Table of Contents
SECTION 1: COMPUTER FUNDAMENTALS AND INFORMATION
PROCESSING .................................................................................................................. 9
COMPUTER FUNDAMENTALS ............................................................................... 9
OBJECTIVE 1: EXPLAIN THE CONCEPT OF INFORMATION
TECHNOLOGY ......................................................................................................... 9
OBJECTIVE 2: Distinguish among the major types of computer systems in
terms of processing speed, storage and portability. ......................................... 9
WHAT IS A COMPUTER? ................................. Error! Bookmark not defined.
COMPUTER SYSTEMS ............................................................................................ 13
THE MAIN FUNCTIONS OF A COMPUTER SYSTEM ................................... 14
CATEGORIES OF COMPUTER HARDWARE...................................................... 15
THE CENTRAL PROCESSING UNIT (CPU) ................................................... 16
THE CONTROL UNIT (CU) ................................................................................ 16
THE ARITHMETIC / LOGIC UNIT (ALU) ..................................................... 17
MAIN MEMORY .................................................................................................... 17
PERIPHERAL DEVICES ........................................................................................... 19
TECHNICAL TERMS USED WITH THE STORAGE OF DATA..................... 19
BISTABLE DEVICES .............................................................................................. 20
COMPUTER DEVICES FOR INPUT AND OUTPUT .............................................. 21
INPUT DEVICES ..................................................................................................... 35
POINTING DEVICES ......................................................................................... 35
SCANNERS ........................................................................................................... 36
OTHER DEVICES ................................................................................................ 38
INPUT DEVICES ..................................................................................................... 40
MANUAL INPUT DEVICES .................................................................................. 40
DIRECT DATA ENTRY DEVICES ......................................................................... 41
OUTPUT DEVICES .................................................................................................. 43
SECONDARY STORAGE DEVICES AND MEDIA................................................. 21
SECONDARY STORAGE TERMS ......................................................................... 27
INTERFACE .............................................................................................................. 29
ADVANTAGES AND DISADVANTAGES OF STORAGE DEVICES............. 31
MAGNETIC MEDIA ................................................................................................. 31
OPTICAL STORAGE ............................................................................................... 32
HOW DATA IS STORED IN THE COMPUTER ................................................... 50
HOW DATA IS REPRESENTED .......................................................................... 50
BINARY NUMBER SYSTEM ................................................................................. 52

Page 1 of 176
CONVERTING A NUMBER FROM BASE 2 TO BASE 10 ............................... 52
CONVERTING A NUMBER FROM BASE 10 TO BASE 2 ............................... 53
BINARY ADDITION .............................................................................................. 54
BINARY CODED DECIMAL (BCD) ....................................................................... 55
REPRESENTING NEGATIVE NUMBERS .......................................................... 56
ONES COMPLEMENT ......................................................................................... 56
TWOs COMPLEMENT ........................................................................................ 57
SIGN AND MAGNITUDE .................................................................................. 57
ASCII CODES .......................................................................................................... 58
BINARY SUBTRACTION ...................................................................................... 59
OCTAL NUMBERS .................................................................................................... 61
CONVERTING FROM DECIMAL TO OCTAL ................................................. 61
CONVERTING FROM OCTAL TO DECIMAL ................................................ 63
ADDING OCTAL NUMBERS ............................................................................. 63
SUBTRACTING OCTAL NUMBERS ................................................................ 64
CONVERTING DECIMAL TO HEXADECIMAL ................................................ 64
CONVERTING HEXADECIMAL TO DECIMAL ................................................ 68
SOFTWARE .................................................................................................................. 72
OPERATING SYSTEM ........................................................................................... 73
Functions of an Operating System ...................................................................... 73
USER INTERFACE .................................................................................................. 75
SOFTWARE USER INTERFACE .......................................................................... 75
GRAPHICAL USER INTERFACE (GUI) .......................................................... 75
COMMAND DRIVEN INTERFACE .................................................................. 76
MENU DRIVEN INTERFACE ............................................................................ 76
HARDWARE USER INTERFACE...................................................................... 76
PROCESSING MODES ........................................................................................... 77
BATCH PROCESSING ........................................................................................ 77
ONLINE PROCESSING...................................................................................... 77
REAL-TIME PROCESSING ............................................................................... 78
TIME SHARING .................................................................................................. 78
MANAGING PROCESSES AND TASKS ............................................................ 78
1. MULTITASKING .......................................................................................... 78
2. MULTIPROCESSING ............................................................................... 78
3. MULTIPROGRAMMING .......................................................................... 78
APPLICATION SOFTWARE ................................................................................. 79
GENERAL-PURPOSE ........................................................................................... 79
SPECIALISED APPLICATION ......................................................................... 79

Page 2 of 176
CUSTOM-WRITTEN .......................................................................................... 79
INTEGRATED SOFTWARE .............................................................................. 80
DATA COMMUNICATION ........................................................................................ 81
1. NARROW-BAND ................................................................................................ 81
2. VOICE-BAND .................................................................................................. 81
3. BROAD-BAND................................................................................................. 81
1. SIMPLEX .......................................................................................................... 81
2. HALF-DUPLEX ............................................................................................ 81
3. DUPLEX (FULL DUPLEX) .......................................................................... 81
4. POINT-TO-POINT ................................................................................... 82
5. BROADCAST .............................................................................................. 82
PROTOCOL ................................................................................................................ 82
BLUETOOTH .............................................................................................. 82
Wi-Fi ............................................................................................................. 82
NETWORKS .................................................................................................................. 83
LOCAL AREA NETWORKS (LAN) ....................................................................... 83
WIDE AREA NETWORK (WAN) ......................................................................... 84
METROPOLITAN AREA NETWORK (MAN) ..................................................... 84
TRANSMISSION MEDIA .................................................................................... 84
TWISTED PAIR CABLES ........................................................................ 84
COAXIAL CABLE ....................................................................................... 85
FIBRE-OPTIC CABLE ............................................................................... 85
WIRELESS CONNECTIONS ................................................................................ 85
INFRA-RED SIGNALS ............................................................................ 85
MICROWAVE SIGNALS ......................................................................... 85
SATELLITE LINKS .................................................................................. 86
MODEM (MODULATOR/DEMODULATOR) ...................................................... 86
TERMS ASSOCIATED WITH DATA COMMUNICATION .......................... 86
1. UPLOAD........................................................................................................... 86
2. DOWNLOAD............................................................................................... 86
3. BULLETIN BOARD ................................................................................... 86
PROTECTING AND SECURING INFORMATION .............................................. 87
PASSWORDS ........................................................................................................... 87
ENCRYPTION ........................................................................................................... 88
PHYSICAL ACCESS RESTRICTIONS ............................................................... 88
SOFTWARE ACCESS RESTRICTIONS ............................................................ 88
VIRUS PROTECTION............................................................................................. 89
ANTI-VIRUS SOFTWARE ................................................................................... 89

Page 3 of 176
FIREPROOF CABINETS ........................................................................................ 89
FIREWALLS.............................................................................................................. 89
BACK-UP AND RECOVERY .................................................................................... 90
ARCHIVING .............................................................................................................. 90
DATA CORRUPTION .............................................................................................. 90
SOFTWARE RIGHTS ............................................................................................. 90
TROUBLESHOOTING AND COMPUTER MAINTENANCE .............................. 92
COMPUTER MAINTENANCE ............................................................................... 92
SCANNING DISKS FOR ERRORS ...................................................................... 92
DEFRAGMENTING OF THE FILE SYSTEM ..................................................... 92
BASIC TROUBLESHOOTING .............................................................................. 93
APPLICATIONS AND IMPLICATIONS OF IT ................................................... 99
EXPERT SYSTEMS.................................................................................................. 99
ROBOTS..................................................................................................................... 99
CAD – COMPUTER AIDED DESIGN ................................................................... 99
CADD – COMPUTER AIDED DESIGN AND DRAFTING ............................... 99
CAM – COMPUTER AIDED MANUFACTURING ............................................. 100
CAE – COMPUTER AIDED ENGINEERING ..................................................... 100
COMPUTER –ASSISTED ASSESSMENT (CAA) ............................................ 100
COMPUTER ASSISTED LEARNING (CAL) / COMPUTER AIDED
INSTRUCTION (CAI) ........................................................................................... 100
CML/CMI .................................................................................................................. 101
ADVANTAGES OF INFORMATION TECHNOLOGY IN EDUCATION ... 101
DISADVANTAGES OF INFORMATION TECHNOLOGY IN EDUCATION
..................................................................................................................................... 102
CLOUD COMPUTING ............................................................................................. 102
WEARABLE TECHNOLOGY ................................................................................. 102
SMART OBJECTS .................................................................................................. 103
CURRENT TRENDS IN TECHNOLOGY ................................................................ 104
TELECOMMUTING ................................................................................................ 104
VIDEOCONFERENCING AND TELECONFERENCING ................................. 104
ADVANTAGES .................................................................................................... 105
DISADVANTAGES............................................................................................. 105
TELECONFERENCING .......................................................................................... 105
MEASURES TO REDUCE INFORMATION MISUSE ........................................ 107
INFORMATION MISUSE ................................................................................... 107
UNAUTHORISED COLLECTION OF INFORMATION ................................ 107
INDUSTRIAL ESPIONAGE ............................................................................. 107

Page 4 of 176
ELECTRONIC ESPIONAGE ............................................................................. 107
ELECTRONIC SURVEILLANCE....................................................................... 108
ELECTRON EAVESDROPPING ........................................................................ 108
WAYS TO REDUCE MISUSE OF INFORMATION ....................................... 108
DATA PROTECTION LAWS ................................................................................ 108
PIRACY ...................................................................................................................... 109
COMPUTER FRAUD ................................................................................................ 109
Identity theft ........................................................................................... 109
Credit card fraud ..................................................................................... 109
INFORMATION TECHNOLOGY: JOB SKILLS AND CAREERS .................... 110
ROLES OF PERSONNEL IN COMPUTER RELATED PROFESSIONS ....... 110
PROGRAMMERS .................................................................................................. 110
SYSTEMS PROGRAMMER ................................................................................ 110
SYSTEM ANALYSTS AND DESIGNERS ..................................................... 110
MANAGERS ......................................................................................................... 110
DATABASE ADMINISTRATORS .................................................................. 110
NETWORK ADMINISTRATORS..................................................................... 111
DATA-ENTRY CLERKS ....................................................................................... 111
COMPUTER OPERATORS .................................................................................. 111
LIBRARIANS........................................................................................................ 111
TECHNICIANS .................................................................................................... 111
COMPUTER ENGINEERS .................................................................................. 111
CONSULTANTS ................................................................................................. 112
DATA COMMUNICATIONS SPECIALISTS ............................................... 112
COMPUTER TRAINERS .................................................................................... 112
ELECTRONIC DATA-PROCESSING AUDITORS (EDP) ........................... 112
PROBLEM SOLVING AND PROGRAM DESIGN.................................................. 113
INTRODUCTION TO PROGRAMMING ............................................................ 113
ALGORITHM PHASE ......................................................................................... 113
IMPLEMENTATION PHASE ........................................................................... 114
DEFINING THE PROBLEM .................................................................................. 114
INPUT – OUTPUT – PROCESSING (IPO) CHARTS or DEFINING
DIAGRAMS .............................................................................................................. 115
ALGORITHM DESIGN .......................................................................................... 119
PSEUDOCODE ......................................................................................................... 119
VARIABLES ............................................................................................................. 120
BASIC DATA TYPES FOR VARIABLES............................................................ 121
CHOOSING VARAIBLE NAMES .................................................................... 122

Page 5 of 176
ALGORITHMIC STRUCTURE.............................................................................. 122
READING AND WRITING IN ALGORITHMS ............................................... 123
WRITING INSTRUCTIONS ........................................................................... 123
PROMPTING INSTRUCTIONS ...................................................................... 123
OUTPUT INSTRUCTIONS .............................................................................. 123
OUTPUTTING A STRING CONSTANT ....................................................... 124
OUTPUTTING A STING CONSTANT AND A VARIABLE ...................... 124
CONVERTING THE IPO CHART TO AN ALGORITHM ................................ 124
CONTROL STRUCTURES ..................................................................................... 126
SEQUENTIAL STATEMENTS........................................................................ 126
SELECTION STRUCTURES ............................................................................. 127
INITIALISING A VARIABLE ............................................................................ 128
LOOPS ................................................................................................................... 132
FLOWCHARTS ........................................................................................................ 139
ARITHMETIC OPERATORS ................................................................................ 140
RELATIONAL OPERATORS ................................................................................ 141
CONDITIONAL AND LOOPING OPERATORS .............................................. 141
BOOLEAN OPERATORS ....................................................................................... 142
Truth table for NOT ......................................................................................... 142
Truth table for AND ......................................................................................... 142
Truth Table for OR ............................................................................................ 143
TESTING ALGORITHMS ..................................................................................... 143
DRY –RUN TESTING ......................................................................................... 143
TRACE TABLES ................................................................................................... 144
WHAT IS A COMPUTER PROGRAM? ............................................................... 145
COMPUTER LANGUAGES..................................................................................... 145
1. MACHINE LANGUAGE ............................................................................... 145
2. ASSEMBLY LANGUAGE / LOW LEVEL LANGUAGE....................... 146
3. HIGH LEVEL LANGUAGE....................................................................... 146
COMPARISON OF THE DIFFERENT LEVELS OF LANGUAGES ............... 147
GENERATION OF LANGUAGES ........................................................................ 148
IMPLEMENTING A PROGRAM ........................................................................... 150
TESTING AND DEBUGGING .............................................................................. 151
SYNTAX ERRORS .............................................................................................. 151
LOGIC ERRORS................................................................................................... 151
RUN-TIME ERRORS .......................................................................................... 151
TYPES OF TESTING ............................................................................................. 151
VALIDATION AND VERIFICATION ............................................................... 152

Page 6 of 176
DOCUMENTING PROGRAMS .............................................................................. 152
INTERNAL DOCUMENTATION .................................................................... 153
EXTERNAL DOCUMENTATION .................................................................... 153
PROGRAMMING IN PASCAL .............................................................................. 154
WRITING PROGRAMS IN PASCAL .............................................................. 154
DECLARING DATA TYPES............................................................................... 155
VARIABLES AND CONSTANTS .................................................................... 155
PASCAL RESERVED WORDS........................................................................... 156
PUNCTUATION .................................................................................................. 156
INITIALISING A VARIABLE ........................................................................ 157
DECLARING CONSTANTS .............................................................................. 157
MANIPULATING DATA ................................................................................... 157
INPUT AND STORAGE ..................................................................................... 157
PROCESSING .......................................................................................................... 158
OUTPUT ................................................................................................................ 158
CONTROL STRUCTURES ................................................................................. 159
EXAMPLE of Pascal Code: ................................................................................. 159
ARRAYS .................................................................................................................... 160
DECLARING ARRAYS........................................................................................ 160
FULL PASCAL PROGRAM WITH AN ARRAY .................................................. 162
PROCEDURES .......................................................................................................... 162
INFORMATION PROCESSING .............................................................................. 164
INFORMATION AS A COMMODITY ............................................................... 166
FORMS OF INFORMATION PROCESSING ................................................... 166
COMMERCIAL INFORMATION PROCESSING ......................................... 166
INDUSTRIAL INFORMATION PROCESSING .......................................... 167
SCIENTIFIC INFORMATION PROCESSING............................................ 167
SOURCES OF DATA .............................................................................................. 168
SOURCE DOCUMENT ........................................................................................ 168
TURNAROUND DOCUMENT ........................................................................... 168
DATA LOGGING ..................................................................................................... 168
VALIDATION AND VERIFICATION ............................................................... 169
DATA VERIFICATION ..................................................................................... 169
DATA VALIDATION ......................................................................................... 170
FILE ORGANISATION AND ACCESS ............................................................. 172
MASTER AND TRANSACTION FILES ........................................................ 173
FILE ORGANIZATION AND ACCESS METHODS ....................................... 174
SEQUENTIAL AND SERIAL........................................................................... 174

Page 7 of 176
RANDOM FILE ORDERING AND ACCESS .................................................. 174
INDEX SEQUENTIAL FILE ORDERING AND ACCESS .......................... 175

Page 8 of 176
SECTION 1: COMPUTER FUNDAMENTALS AND INFORMATION
PROCESSING

COMPUTER FUNDAMENTALS

OBJECTIVE 1: Explain the concept of Information Technology

Definition of Information Technology


Information Technology (IT) is the term used to describe the equipment
(hardware and software) that allows us to access, retrieve, convert, store,
organise, manipulate and present data and information. IT may also refer to
the use of such equipment and programs to produce the information.

Scope of Information Technology


➢ Telephone and radio equipment and switches used for voice
communications.
➢ Traditional computer applications that include data storage and
programs to input. Process, and output the data.
➢ Software and support for office automation systems such as word
processing and spreadsheets, as well as the computer to run them.
➢ Users’ PCs and software.
➢ Data networks and all associated communication equipment such as
servers, bridges, routers, hubs and wiring.
➢ Peripherals directly connected to computer information systems used
to collect or transmit audio, video or graphic information, such as
scanner and digitization.
➢ Voice response systems that interact with a computer database or
application.
➢ Computers and network systems used by users.

OBJECTIVE 2: Distinguish among the major types of computer systems


in terms of processing speed, storage and portability.

Page 9 of 176
The different categories of computers include super computers,

mainframes, desktops, mobile devices, embedded devices. Each type of

computer is made for a unique use, and they have varying capabilities.

SUPERCOMPUTER Supercomputers are large storage units

with tremendous memory and processing

capabilities. Supercomputers are

primarily used by large organisations that

need extensive memory systems. They

are expensive, fragile and require special

care. Usually housed in a special room

with a clean, dust free and temperature-

regulated environment. Example – Cray.

MAINFRAME Mainframe computers have less capacity

and power than supercomputer, but they

are notably more powerful and efficient

than person computers. Mainframe

computers can process billions of

Page 10 of 176
instructions in a matter of seconds, and

they can process large amounts of varying

data at once.

Example- IBM zEnterprise System.

DESKTOP SYSTEMS Any PC (Personal Computer) that is

designed to be placed on a desk and not

for portability is called a desktop.

Originally made for executing a single task

by a single user at a time. Today, a single

person can execute many tasks

simultaneously (multitasking).

Page 11 of 176
MOBILE DEVICES A mobile device is a general term for any

type of handheld computer. These

devices are designed to be extremely

portable, and they can fit in your hand.

Some mobile devices-like tablets, e-

readers, and smartphones – are powerful

enough to do many of the same things you

can do with a desktop computer.

Examples – laptops, notebooks, netbooks,

smartphones, tablets and game consoles.

EMBEDDED DEVICES An embedded device is an object that

contains a special-purpose computing

system. Embedded systems have

extensive applications in consumer,

commercial, automotive, industrial and

healthcare markets. An embedded

device’s operating systems will only run a

single application, which helps the device

to do its job. Examples of embedded

devices include dishwashers, banking ATM

machines, routers, point of sale terminals

and cell phones.

Page 12 of 176
OBJECTIVE 3: Explain the functions of the major hardware components
of a computer system.

THE BASIC COMPONENTS OF COMPUTERS

COMPUTER SYSTEMS
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

Page 13 of 176
can touch are all hardware. 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 nor

without software, you would just have an expensive piece of equipment that

does nothing.

FUNCTIONS OF A COMPUTER SYSTEM

THE MAIN FUNCTIONS OF A COMPUTER SYSTEM

Computers may be used for many different purposes. However, all


computers carry out four basic functions: input, processing, output and
storage.

INPUT Means turning data and instructions

into electronic form so the computer

Page 14 of 176
can process them.

PROCESSING The computer processes input data

according to input instructions. This

happens electronically in the Central

Processing Unit (CPU) of the

computer.

OUTPUT Means turning the results of

processing into a form, which people

can understand, or use. Either as

HARDCOPY OR SOFTCOPY.

HARDCOPY – printed output from a

computer.

SOFTCOPY – seen on the monitor.

STORAGE Means storing information ready for

the CPU to use. Information is

stored either electronically, or in

some other form, which the CPU can

read (such as magnetic form).

CATEGORIES OF COMPUTER HARDWARE


There are four main categories of computer hardware:

1. The processor - The Central Processing Unit (CPU). The speed of the

CPU is determined by:

• How many operations are carried out in one second

• How much data is processed in one operation

• How quickly information is sent to and from memory

Page 15 of 176
The number operations per second is measured in hertz (Hz),

megahertz (MHz), and gigahertz (GHz)

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)

• Main Memory

THE CONTROL UNIT (CU)


The Control Unit (CU) is the main part of the CPU, which controls the

operations of the CPU. It passes instructions to all the different parts of

the processor, so that they carry out the right tasks, in the right order.

FUNCTIONS OF THE CONTROL UNIT


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)

Page 16 of 176
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)


FUNCTIONS OF THE ARITHMETIC / LOGIC UNIT (ALU)

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.

MAIN MEMORY
FUNCTIONS OF MAIN MEMORY

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

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

Page 17 of 176
VOLATILE).

• ROM is used to store the commands which start up (boot up)

the computer.

• These instructions are programmed into the ROM chips by the

manufacturers

3. PROGRAMMABLE READ ONLY MEMORY (PROM)

• PROM is blank when it leaves the factory, and a programmer

adds the instructions later. Then they are fixed and cannot be

changed.

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

The diagram below shows the components of the basic computer system.

CU

ALU
INPUT OUTPUT

MAIN MEMORY

SECONDARY
STORAGE
Page 18 of 176
PERIPHERAL DEVICES
Peripherals device are those hardware devices that are externally connected

to the computer system.

TECHNICAL TERMS USED WITH THE STORAGE OF DATA

TERMS USED WITH THE DEFINITION


STORAGE OF DATA
BIT BIT is a unit of storage that has two

possible values, 0 and 1. It is the

smallest unit. This is short for

Binary Digit.

BYTE A group of bits big enough to store

one letter is called a byte. It is a

group of eight bits. Storage capacity

is measured in bytes.

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

Page 19 of 176
instruction is stored.

ADDRESS CONTENT The data or instruction that is

stored in a given address.

CHARACTER Any digit, letter or symbol.

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 210 (1024)

thousand

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)

Page 20 of 176
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 later.

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 1 to 8 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

Page 21 of 176
5 1
6 0
7 0
8 1
(Parity) 9 1

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

Page 22 of 176
➢ Data entry using a key-to-tape device

➢ Archiving data.

FLOPPY DISK

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

Since it has a small storage capacity of 1.44MB, it is typically used to store

documents so that they can be used on more than one computer. Like

magnetic tape, this is divided into tracks. However, these tracks are in the

form of concentric circles (circles shown below).

Page 23 of 176
TRACK – a ring-shaped are of disk

SECTOR- a wedge shaped are of disk

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

Page 24 of 176
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

randomly (directly).

MICROFILM

Microfilm can be used to hold tiny images – for example, of old newspapers

or other historical documents. These images can only be read by special

viewers.

Page 25 of 176
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 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:

Page 26 of 176
➢ 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.

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.

Page 27 of 176
➢ 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.

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

Page 28 of 176
INTERFACE
An interface is the connection between any two systems or parts that

allow them to communicate. Secondary storage is connected to the

processor via an interface.

An interface typically includes:

• A PORT – the plug-in slot that lets you connect the storage medium

into the computer.

• A BUFFER – a temporary area of memory that holds data while it is

being transferred to and from the processor.

Different devices require different interfaces, and this may mean

different types of plug-in sockets, different types of wires to

connect equipment, and different communications standards. Some

common interface standards include:

➢ SCSI – SMALL COMPUTER SYSTEM INTERFACE. It is a set of

standards for physically connecting and transferring data between

computers and peripheral devices. SCSI is most commonly used for

Page 29 of 176
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.

➢ FIREWAIRE – used with Apple Macintosh devices.

Page 30 of 176
ADVANTAGES AND DISADVANTAGES OF STORAGE DEVICES

MAGNETIC MEDIA

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 ➢ Not generally used
networks to backup with desktop
data on hard disks computers
➢ Low cost storage ➢ Slow – so only used
for network back-
ups
REMOVABLE ➢ Store much more data ➢ Other computers
DRIVES than floppy disk must have a Zip
➢ Very good for backing drive fitted to
up files read these disks
➢ Removable and ➢ Do not hold as
portable much data as hard
➢ Relatively cheap drives
➢ Generally not as
fast as hard drives

Page 31 of 176
OPTICAL STORAGE
STORAGE ADVANTAGES DISADVANTAGES
CD-ROM ➢ Stores large ➢ As CD is read-only,
amounts of data – data cannot be
up to 650 Mb per changed or deleted
CR-ROM ➢ Slower access times
➢ Very cheap to than hard drives
produce, ➢ Cannot read DVD
particularly on a
large scale
➢ Good way of
distributing
software
CD-R ➢ As with CD-ROM, a ➢ Must have a CD-R
CD-R stores large recorder to write
amounts of data to a disk
➢ Possible to add ➢ CD-R software has
data (write) to the varying capabilities
CR-R in 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
amounts of data to a disk
➢ CR-RW can be ➢ CD-RW does not

Page 32 of 176
erased and reused work in all CD
as many times as players
required
➢ Good for backing up
files
DVD ➢ Stores massive ➢ New technology, so
amount of data – to number of DVDs in
17 Gb use is smaller than
➢ Excellent for number of CD-
showing video ROMs
➢ DVD players can ➢ New technology, so
read CD-ROM price of drives
relatively expensive
➢ DVDs do not work in
CD-ROM drives

TYPE OF HOW IT STORES FEATURES MAIN TYPES


STORAGE DATA

Magnetic Magnetism (on Sequential access There are many sizes


tape plastic or tape) (slow) and types of tape, but
tape is rarely used in
Read-write
modern computer
access
systems
Removable from
the computer

Page 33 of 176
Floppy Magnetism (on a Direct access Floppy disks are
disk circle of plastic) available in several
Read-write
sizes, but they have
access
low storage capacity
Removable and are rarely used in
modern computers.
Low capacity

Hard disk Magnetism (on a Direct access


stack of metal
Read-write
disks inside the
access
computer case)
Usually fixed in
one machine

High capacity

Optical Microscopic pits Direct access CDs are used to store


disk burned into a music and large data
Read-only access
smooth surface by files.
unless you have
a laser. They are
the software to DVDs have even
invisible to normal
“burn” new data higher capacity and
vision
on to the disk are used to store very
large amounts of data
Removable
such as movies.
High capacity

Flash Microscopic Direct access Flash memory can be


memory packaged in a number
Silicon circuits Read –write
of ways, in sticks or
access
cards which can be
Removable plugged into a
computer with a
High capacity
suitable socket.

Page 34 of 176
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, 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.

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 TOUCH SCREEN – detects when you touch the display. This is an

easy way to select choices from an on-screen menu and perform other

simple tasks.

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

Page 35 of 176
find the exact position being indicated, and so you can select, activate

and manipulate items on the display, just as with a mouse.

6. 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 36 of 176
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.

Page 37 of 176
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

1. 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).

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

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

Page 38 of 176
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.

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

5. BIOMETRIC SYSTEM – biometric systems recognise a person’s

physical characteristics, for example, reading their fingerprints or

iris (eye) scan. They are mainly used for security purposes, for

example, to allow access to banks or military premises.

6. SENSORS AND REMOTE CONTROL – robots and automated

systems must be able to sense features of the environment – for

example, to detect where walls are – in order to move about and

perform other tasks. Sensors measure a range of features including

light, heat, pressure etc. and send them to the computer system.

Page 39 of 176
INPUT DEVICES

MANUAL INPUT DEVICES


INPUT ADVANTAGES DISADVANTAGES PICTURE
DEVICE
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 coordination
directly to the computer can be a problem
Can activate commands by Shifting between
selecting icons directly keyboard and mouse can
be confusing

JOYSTICK Ideal for games such as car User has to become


racing skilled at the sensitive
movement of the joystick

TOUCH User-friendly A limited number of


SCREEN Easy way to input options values can be displayed on
and choices one screen at a time
Can be used by children and More expensive than a
the physically challenged standard monitor
who are unable to use other
input devices

Page 40 of 176
SCANNER Relatively cheap and easy to The quality of the image
install depends on the quality of
Depending on use, flat bed the hard copy, scanner
or hand-held scanners can and scanner software
be chosen
KEY-TO-DISK Data can be prepared off- Requires many human and
line computer resources
Data can be validated by Expensive
the program as it is being
entered
VOICE The user can speak at The voice recognition
RECOGNITIO normal rates for dictation system must be trained
N SYSTEM to recognise voice
patterns
Software cannot
interpret all English
meanings

DIRECT DATA ENTRY DEVICES


INPUT DEVICE ADVANTAGE DISADVANTAGE PICTURE
BARCODE ➢ Fast and ➢ Details and
READER accurate in the order of
product data stored
identification on the strip
cannot be
➢ Data can be
changes
input much
easily
faster than it
takes to be ➢ The price of
keyed in the product
in not
➢ Not easily
included in
damaged and
the barcode
can normally

Page 41 of 176
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 ➢ Large amounts ➢ Same


SALE of data can be limitations
input very as for
quickly and barcode
accurately reader

OPTICAL ➢ Can speed up ➢ Accuracy of


CHARACTER the typing the text can
RECOGNITION process be poor
(OCR)
➢ Not
appropriate
for
handwritten
documents

MAGNETIC ➢ Is quick and ➢ Has limited


INK highly efficient applications
CHARACTER
RECOGNITION ➢ Both humans ➢ As the use
(MICR) and machines of cheques
can interpret becomes
obsolete, its

Page 42 of 176
the data use is in
decline
➢ Not easy to
forge

OPTICAL ➢ Data input is ➢ There are


MARK READER very fast and limitations
(OMR) accurate to 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 43 of 176
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

Page 44 of 176
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 ultra-fiche. 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.

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

Page 45 of 176
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 and forth, these pins strike the

ribbon causing dots to be made on the paper.

➢ NON – IMPACT PRINTERS

Page 46 of 176
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.

Page 47 of 176
➢ 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 48 of 176
Page 49 of 176
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 50 of 176
Page 51 of 176
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
(in base 10) 24 23 22 21 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

101112 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

Page 52 of 176
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

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
Write down
2 51 R 1 the

Page 53 of 176
remainders in
2 25 R 1 this
2 12 R 1 direction
2 6 R 0
2 3 R 0
2 1 R 1
0 R 1

Therefore 10310 = 11001112

BINARY ADDITION
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

Page 54 of 176
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)


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.

Page 55 of 176
8 9 6 DECIMAL

1000 1001 0110 BCD

896 = 1000100101102

+896 = 10101000100101102

-896 = 10111000100101102

REPRESENTING NEGATIVE NUMBERS


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

Page 56 of 176
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


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

Page 57 of 176
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
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:

Page 58 of 176
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

0 1 0 0 0 1 0 0

0 0 0 1 0 0 1 1 +

0 1 0 1 0 1 1 1

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

8710

BINARY SUBTRACTION
EXAMPLES:

1. 01 – 00

01

Page 59 of 176
00

102

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

Page 60 of 176
OCTAL NUMBERS
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
Write down
8 12 R 2 the
remainders in
8 1 R 4 this
0 R 1 direction

ANSEWER: 1428

8 985
Write down
8 123 R 1 the
remainders in
8 15 R 3 this
8 1 R 7 direction
0 R 1

Page 61 of 176
ANSWER: 17318

Page 62 of 176
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

Page 63 of 176
SUBTRACTING OCTAL NUMBERS
EXAMPLE:

7632

475-

7135

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

Page 64 of 176
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 70 / 16 4 6
result 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 after the
decimal point)

The remainder is
(0.375 multiplied
with 16, which is 6.
Repeat. Note here 4 / 16 0 4

Page 65 of 176
that 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 468
answer. 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 66 of 176
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)

Page 67 of 176
590 / 16 36 E (14 decimal)
36 / 16 2 4 (4 decimal)
2 / 16 0 2 (2 decimal)

ANSWER 24E

CONVERTING HEXADECIMAL TO DECIMAL


Steps:

1. Get the last digit of the hex number, call this digit the current
Digit.
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 current Digit 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

Page 68 of 176
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 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

Page 69 of 176
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
1 x 1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096

ANSWER 5425

Example 4
Convert the number FA8 HEXADECIMAL to HEXADECIMAL

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

ANSWER 4008

Example 5
Convert the number 8F HEXADECIMAL to DECIMAL

Page 70 of 176
DIVISION RESULT
F x 1 15
8 x 16 128

ANSWER 143

Example 6
Convert the number A0 HEXADECIMAL to DECIMAL

DIVISION RESULT
0 x 1 0
A x 16 160

ANSWER 160

Example 7
Convert the number 12 HEXADECIMAL to DECIMAL

DIVISION RESULT
2 x 1 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 71 of 176
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.

Page 72 of 176
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


The operating system is loaded on to the computer before any other

software. It controls all aspects of the operation of the computer including

the following functions:

Page 73 of 176
✓ Communication

✓ File transfer

✓ Resource Management

✓ File Management – data and instructions are held in secondary storage

as computer files. The operating system organises the files and allow

the user to choose ones to access.

✓ Security – the operating system controls some aspects of data security,

for example the password login to a network.;

✓ Memory management – primary storage holds the data and instructions

currently in use by the computer. The operating system ensures that

the correct data and instructions are copied into the main memory ready

to use.

✓ Device Management – the operating system controls the operation of

the peripheral devices.

✓ Input / Output Management – the computer system receives input from

devices such as the keyboard, and send signals to output devices such as

the monitor. The operating system organises this data flow.

✓ Process Management – a modern computer will typically have multiple

processes under way at the same time. These are organised by the

operating system.

✓ User Interface – the user interface is the system that allows you – the

user – to interact with the computer, to input instructions and data, and

receive results.

Page 74 of 176
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.

The user interface includes both software and hardware.

SOFTWARE USER INTERFACE


Three common software interfaces are graphical user interfaces, command

driven interfaces and menu driven interface.

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-

Page 75 of 176
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 this type of interface. DOS and

UNIX are some operating systems that use a command line interface.

MENU DRIVEN INTERFACE


These allow you to pick commands from lists of choices instead of typing

them. There are two type – Pop-up Menu and Pull-Down Menu. (Explained

above)

HARDWARE USER INTERFACE


Various hardware items make it possible for a person to work with the

computer.

1. Touch screen

Page 76 of 176
2. Non-visual interface, such as voice based or braille based input and

output systems, is designed to help people with restricted vision and

other disabilities that might make it difficult to use the computer.

3. Devices such as automated sensors and control devices can work

without a human user.

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.

Page 77 of 176
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.

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.

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

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

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

Page 78 of 176
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.

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.

Page 79 of 176
➢ 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 80 of 176
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.

Page 81 of 176
4. POINT-TO-POINT – communication connects two fixed points, and

other users cannot hear the signal. An example is a phone

conversation.

5. BROADCAST – communication is sent out from a central point, and

anyone who can pick up the signal can hear it. An example is a radio

station which can be heard by anyone with a radio.

PROTOCOL
Protocols are a set of rules and procedures governing the transmission and

receiving of data. Some international protocols are HTTP, PPP, TCP/IP, FTP,

Bluetooth and Wi-Fi.

Protocols are used to ensure that transmissions are coordinated with minimal

interference.

➢ BLUETOOTH – is a wireless technology standard for

communicating over short distances using short wavelength

radio transmissions. It is typically used to connect together

devices that belong to the same person.

➢ Wi-Fi – is a set of communication standards that allows

computers to connect (typically to the Internet) through

wireless signals. A Wi-Fi enabled computer can connect to the

internet when within range of a wireless network connected to

the Internet. A HOTSPOT is a place in range of a Wi-Fi

connection. If you are located in a ‘hotspot’ you can connect

wirelessly to the internet.

Page 82 of 176
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) connects computers within the same building,

or at most within buildings that are close together, for example a school.

Page 83 of 176
WIDE AREA NETWORK (WAN)
A Wide Area Network (WAN) connects computers that are spread out over

a large are such as an island, the whole Caribbean, or even across the ocean.

METROPOLITAN AREA NETWORK (MAN)


A MAN is slightly less common. It might connect the computers in a large

city, or a district.

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.

TRANSMISSION MEDIA
Networks are connected by physical cables that transmit the electronic

signals between computers.

➢ TWISTED PAIR CABLES – this type of cable is made up of pairs of

wires. In each pair the wires are twisted around each other. This type

of cabling has been used for many years. It is relatively inexpensive

and reliable.

Page 84 of 176
➢ COAXIAL CABLE – This type of cable is made of an inner conducting

cable, surrounded by insulation. It is more expensive than twisted

pair cable, but provides better insulation against electrical

interference.

➢ FIBRE-OPTIC CABLE – send signals in the form of light pulses. It

provides a reliable modern alternative to copper cables.

Twisted Pair Cable Coaxial Cable Fibre Optic

Cable

WIRELESS CONNECTIONS
Other network technologies send signals without the use of wires or cables.

➢ INFRA-RED SIGNALS – is a form of light that cannot be seen by the

human eye. Can be used to connect items that are close together,

typically in the same room.

➢ MICROWAVE SIGNALS – low-intensity microwaves are a form of

radio signal and can be used for communication. They work over

longer distances than infra-red, but need a direct straight line

between the items, without any solid obstacles.

Page 85 of 176
➢ SATELLITE LINKS – between satellites in orbit and aerials often use

microwaves, because there are no solid obstacles between earth and

sky.

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. 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 86 of 176
PROTECTING AND SECURING INFORMATION

Since information is so valuable, considerable effort is spent protecting it

from theft, fire, viruses, hackers, and 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

10. Software rights

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.

Page 87 of 176
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.

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.

Page 88 of 176
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.

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.

Page 89 of 176
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.

SOFTWARE RIGHTS
➢ PROPRIETY SOFTWARE – commercial software that you buy is

proprietary software. This is software that you are licensed to use.

You are not allowed to make changes to it, make copies of it or resell

it.

Page 90 of 176
➢ OPEN SOURCE SOFTWARE – commercial software is usually provided

in the form of executable files. But if you use open source software

you can get the source code as well. It is created by programmers

working for free, and everyone who uses it is allowed to make further

improvements.

Page 91 of 176
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.

Page 92 of 176
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.

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.

Page 93 of 176
➢ 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 Make sure that the thick cable from

tower 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 Turn both the brightness and

low contrast knobs (usually found on the

bottom of the monitor)

The computer has turned off the If you left the monitor on and come

monitor to save power back to find that it isn’t showing

Page 94 of 176
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

present” firmly plugged into the tower, then

press the key to continue (usually F1)

“CMOS battery failed”, CMOS Follow the instructions given. It is

checksum error (Defaults loaded)”. not necessary to enter any

(this is caused by a dead battery) information (since it will be lost when

the computer is turned off anyway).

Replace the battery (not necessarily

immediately).

“Invalid system disk. Replace the Either remove the disk or replace it

disk and press any key” with a boot diskette. Press any key

on the keyboard.

Page 95 of 176
➢ 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, 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 Make sure the keyboard is connected

keyboard but nothing happens to the correct slot. If it already was

connected, the OS may have crashed.

Page 96 of 176
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 Check to see if any of the SHIFT,

itself) a window, e.g. the run CTRL, ALT or Windows keys is stuck.

window or 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 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 Move the switch on the mouse if

erratically there is any, to another position.

Page 97 of 176
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 Open Windows Explorer. Right click

are told that the disk is not the icon for the floppy drive. Click

formatted “Format”, select the desired options

and then click start.

When you try to copy files to a Hold the disk with the label facing

disk or to delete files from it you down. Locate the square tab above a

get an error saying that the disk is small hole in a corner of the disk.

“Write Protected” Pull it down so that you can no longer

see the hole.

The computer is unable to read Use Scandisk to do a thorough scan

some (or all) of the files stored on of the floppy disk for bad sectors.

a disk If any are found, copy those files

that you can to another location and

do not store any more data on the

disk.

Page 98 of 176
APPLICATIONS AND IMPLICATIONS OF IT

EXPERT SYSTEMS
Expert systems are used in medicine. An expert system is a complex type of

software used to answer questions. Typically, expert systems are used for

diagnostics. Diagnostics means finding out the cause of a problem.

Expert systems are also used to diagnose problems in car servicing and

computer maintenance.

ROBOTS
Robots are used in factories where repetitive tasks must be carried out.

Robots work quickly and accurately. They use sensors to measure their

environment, and computer-controlled motors to make actions.

CAD – COMPUTER AIDED DESIGN


CAD system is a combination of hardware and software that enables

engineers and architects to design everything from furniture to airplanes.

CADD – COMPUTER AIDED DESIGN AND DRAFTING


CADD is the use of computers to create designs for engineering and

manufacturing, and the plans for buildings.

✓ Easy to revise, and make changes, and test the strength and

suitability of design.

✓ Allow rotations in three dimensions, so you can look at the planned

object from any angle.

Page 99 of 176
✓ Used to produce computer animation for special effects in movies.

CAM – COMPUTER AIDED MANUFACTURING


CAM is the use of computer software to control the machines and tools to

manufacture objects. CADD and CAM usually work together, so you can

design an object on the screen of the computer and then send the

instructions to a machine that will cut the object from a piece of metal.

CAE – COMPUTER AIDED ENGINEERING


CADD, CAM and other processes such as planning, analysis and simulated

testing, all combine to create a new modern industry called CAE.

✓ Cheaper to test out designs on the computer, rather than in real life.

EXAMPLE: a new bridge design will be planned and thoroughly tested on the

computer system before the design is approved to build a real bridge.

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

Page 100 of 176


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

Page 101 of 176


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.

CLOUD COMPUTING
Cloud computing is a modern use of Internet technology to carry out your

computing work. Instead of using software and files stored on your

computer, you use large capacity computers owned by large organisations

such as Google or Yahoo. You still need a computer of our own to connect to

the Internet, but most of the software and data is stored somewhere far

away. An example of a cloud computing software application is Google Docs.

ADVANTAGES

✓ Can be a cheap solution

✓ Good for people with small computer systems without much personal

storage capacity

✓ Can connect to your files from any computer, anywhere, so long as it

has an Internet link.

WEARABLE TECHNOLOGY
Wearable technology is clothing that has computer systems built into it. It

could be used for a serious purpose.

Page 102 of 176


Example: to monitor the blood pressure of an ill person, or to track the

speed of an athlete. It can also be used for fun – to create a T-shirt with a

moving light show on it.

SMART OBJECTS
A smart object is any object that sends out wireless signals that can be

picked up by local computer systems. Some have their own processors inside

them. Example: to monitor security tags.

Page 103 of 176


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.

Page 104 of 176


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.

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 being slow, the video and audio may not

be of very high quality.

TELECONFERENCING
Teleconferencing is a way of holding a meeting even if the people are in

different places. They might even be in different countries. They can

speak over a joint phone link.

✓ Teleconferences can save a lot of time and money because people do

not have to travel so much, and this is also better for the

environment.

Page 105 of 176


Page 106 of 176
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.

Page 107 of 176


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

ELECTRON EAVESDROPPING
Even is data is protected by passwords and other methods, some people will

make efforts to read other people’s private information.

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

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

Page 108 of 176


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

COMPUTER FRAUD
Fraud is a general term for any illegal deception or trick. Computers can be

used to commit fraud and swindle money from people.

➢ Identity theft – is when criminals pretend to be another person. By

stealing someone’s identity the criminal might be able to take money

from their bank account.

➢ Credit card fraud – is a form of identity theft where a criminal uses

another person’s credit card to buy goods or borrow cash.

Page 109 of 176


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

Page 110 of 176


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
➢ 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

Page 111 of 176


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 112 of 176


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.

Page 113 of 176


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


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

Page 114 of 176


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?’

Page 115 of 176


The answer to this question is essentially what should be listed in the

processing section.

EXAMPLE 1

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
num3
numbers 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

Page 116 of 176


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.

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

Page 117 of 176


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 118 of 176


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.

Page 119 of 176


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.

➢ 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 VARAIBLE. 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

Page 120 of 176


necessary to retain the existing value in a memory location, a different

variable must be declared to hold the new data value.

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

Page 121 of 176


CHOOSING VARAIBLE 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 122 of 176


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’

Page 123 of 176


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’

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 ‘sting’, <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 PRINT total

numbers

Page 124 of 176


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 125 of 176


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 126 of 176


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

Page 127 of 176


$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
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

Page 128 of 176


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

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

Page 129 of 176


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 130 of 176


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.

Page 131 of 176


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
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 basic structure of a loop is:

➢ Initialise the variable to some start value – this variable usually

determines whether or not the loop executes or not.

Page 132 of 176


➢ 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
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

Page 133 of 176


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:
THESE TWO
NUMBER = 1 STATEMENTS ARE
WHILE (NUMBER <= 3) DO EXECUTED ONLY
NUMBER = NUMBER + 1 IN THE LOOP
PRINT “THE NUMBER IS”, NUMBER
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:
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.

Page 134 of 176


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

Page 135 of 176


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

Page 136 of 176


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 executing at least once.

STRUCTURE OF THE REPEAT LOOP

STATEMENTS

DECISIO
FALSE N

TRUE

The general form of the REPEAT – UNTIL loop


REPEAT
<Statements>
UNTIL <condition is TRUE>

Page 137 of 176


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 138 of 176


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 139 of 176


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 140 of 176


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

Page 141 of 176


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

➢ 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

Page 142 of 176


Truth Table for OR
➢ If a 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

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

Page 143 of 176


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

Page 144 of 176


➢ 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

Page 145 of 176


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

Page 146 of 176


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

MACHINE LANGUAGE ➢ Programs execute ➢ Programming slow and


fast 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 ➢ Programming slower and


LANGUAGE faster and less more tedious than for
tedious than for high level languages.
machine language.
➢ Code is machine specific
➢ Code is easier to
learn, read and
understand than
for machine
language.

➢ Execution faster
than high level

Page 147 of 176


languages.

➢ More compact than


high level
languages.

HIGH LEVEL ➢ Programming ➢ Program executes


LANGUAGES faster and less slower.
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. Instead of using machine
specific code, they use statements in

Page 148 of 176


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.

Page 149 of 176


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.

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.

Page 150 of 176


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

Page 151 of 176


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.

Page 152 of 176


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:
➢ 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 153 of 176


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

Page 154 of 176


{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


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 e.g. 10, Integer
5, -3
REAL – numbers that include a Real
decimal point. E.g. 3.8, -0.5
CHARACTER - letters of the Char
alphabet, symbols, or anything
non-numeric.
STRING – a series of characters is String
called a string.
BOOLEAN – Holds a True/False Boolean
Value 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.

Page 155 of 176


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

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

Page 156 of 176


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.

Page 157 of 176


Example:
Readln(temp);
Read(a);

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’);

Page 158 of 176


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

Page 159 of 176


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.

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

Page 160 of 176


➢ 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_0f_array [index] := value;
Pascal Statement
Number_array[2]:=14;

Page 161 of 176


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.

Page 162 of 176


Program Calculate (input, output);
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;

Page 163 of 176


Begin
Writeln(‘ The Minimum mark ‘ , Min);
Writeln(‘ The Maximum Mark ‘ , Max);
End;
Begin
Initialise;
Determine;
OutputData
End.

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.

Page 164 of 176


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

Page 165 of 176


INFORMATION AS A COMMODITY
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.

Page 166 of 176


Electronic Banking is a very useful information processing system. Many

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


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.

Page 167 of 176


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.

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

Page 168 of 176


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.

Page 169 of 176


Double-Entry is where the same data is entered twice, sometimes by

different people. If the data is differing 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 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 depend 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

Page 170 of 176


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

Page 171 of 176


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 checks since the parity check

ensures that data is correctly transferred from one location to another.

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.

Page 172 of 176


➢ 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 173 of 176


➢ 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

Page 174 of 176


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.

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 175 of 176

You might also like