Professional Documents
Culture Documents
WHAT IS A COMPUTER?
A computer is an electronic device that can accept data and instructions, process them or
store them for later retrieval, and sometimes generate output (usually based on the
processing).
COMPUTER SYTEMS
A computer system is a combination of computer hardware and software. The hardware
consists of the physical components of the computer, such as the monitor or the
keyboard. In other words the parts of the computer you can touch are all hardware.
Page 1 of 122
Software is the term that is used to refer to the programs that run on the hardware.
Neither one is much use without the other, since without hardware you would not be able
to run software and without software you would just have an expensive piece of
equipment that does nothing.
There are four stages when entering data (facts and figures), input, output, processing and
storage.
INPUT- This is when raw data is input or entered into the computer.
PROCESSING – At this stage the raw data is processed using the instructions
given in a program to make the output.
OUTPUT – At this stage the information that was processed is ready for output
either as HARDCOPY OR SOFTCOPY.
HARDCOPY – printed output from a computer.
SOFTCOPY – seen on the monitor.
STORAGE – After the data is processed, before it is output it can be stored for
later use.
The process described above is known as the COMPUTER SYSTEM.
Page 2 of 122
There are four main categories of computer hardware:
1. The Central Processing Unit (CPU)
2. Input devices, which allow data to be entered into the computer
3. Output devices, which are used for outputting (‘sending out’) data from the
computer
4. Storage devices, both primary and backing.
Page 3 of 122
3. ARITHMETIC LOGIC UNIT (ALU)
ALU
INPUT OUTPUT
DEVICE DEVICE
CU
MEMORY
UNIT
STORAGE DEVICES
Memory of a computer is used for storing programs and data. There are two types of
storage devices, they are:
1. PRIMARY STORAGE (MAIN MEMORY/IMMEDIATE ACCESS STORAGE)
There are two types of primary storage:
RANDOM ACCESS MEMORY (RAM). The contents in this type of
memory are temporary and are lost when the computer is turned off (the data is
VOLATILE). RAM is used to store the instructions and data for currently running
programs and the operating system.
READ ONLY MEMORY (ROM). This type of memory is permanent and the
data stored in it is not lost when the computer is turned off (the data is NON-
VOLATILE). ROM is used to store data that must not be lost even when the computer
is turned off, such as the commands which start up (boot up) the computer. These
instructions are programmed into the ROM chips by the manufacturers.
Page 4 of 122
2. SECONDARY STORAGE (BACKING STORAGE/AUXILIARY STORAGE
DEVICES)
Unlike primary storage, secondary storage is not done on chips. Some examples
are:
Hard disks
Magnetic tape
Floppy disks
Microfilm
CDs
DVDs
These devices are used to store programs, as well as data that is not being
processed, for later retrieval.
PERIPHERAL DEVICES
Peripherals device are those hardware devices that are externally connected to the
computer system.
TYPES OF COMPUTERS
world. These computers are very large and may take up several rooms. Because
Page 5 of 122
devices because they are used simultaneously by hundreds of persons. To meet
the demands of the large number of users, they have a large memory and large
storage capacity.
smaller and slower than a mainframe. Minicomputers support fewer users than
mainframes. The distinction between the two is based mainly on size and number
of users.
microprocessor. You know this type of computer by it familiar name - the PC.
The desktop
The Laptop
Page 6 of 122
are executed each time the computer is turned on. Like RAM, the contents of ROM can
be accessed randomly.
A BIT is a unit of storage that has two possible values, 0 and 1. It is the smallest
unit.
A BYTE is a group of eight bits or one character
A WORD is the size of data (or instruction) that the CPU can handle in a single
cycle
WORD LENGTH/ WORD SIZE – the number of bits in a word.
ADDRESS – the identification of a particular location in the memory where data
or instruction is stored.
ADDRESS CONTENT – the data or instruction that is stored in a given address.
CHARACTER – any digit, letter or symbol.
Page 7 of 122
BISTABLE DEVICES
A BISTABLE device is a device that can exist in one of two possible states. It can be
compared to an on/off switch. You would have already come across something that exists
in two states – a BIT. A Bit is a bi-stable device. Another example of a bi-stable device
is a key on a keyboard – it can be either up or down.
NUMBER OF BYTES
TERM SYMBOL APPROXIMATE ACTUAL
KILOBYTE KB 1,000 1 thousand 210 (1024)
INPUT DEVICES
Input devices accept data signals and translate them for usage and storage in the computer
system.
POINTING DEVICES
1. The MOUSE is your pointing device. As you move the mouse on its pad, a
pointer on the monitor screen moves in the same direction as the mouse does.
2. A JOYSTICK is a lever that can give you a similar control over things on the
screen, but its behaviour is different from that of a mouse. The joystick is more
Page 8 of 122
3. A TRACK PAD is a small, flat, square pad below the space bar, upon which you
place your finger. As you move your finger across the track pad’s surface, the
4. A LIGHT PEN looks like a pen with a wire attaching it to the computer system.
When you point at a position on the screen, the software can find the exact
position being indicated, and so you can select, activate and manipulate items on
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
SCANNERS
A scanner reads picture-type information into the computer. There are a number of
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
machine.
scanner reads the picture as the paper goes through. The original must be on a
Page 9 of 122
4. A BARCODE READER is a device that reads a pattern of bars representing the
code number of the item on which it is printed. The barcode reader usually passes
a small laser beam over the pattern and reads in the pattern off reflected light.
stripe, usually on the surface of a card such as a bank card or credit card.
set of marks on paper. Usually used in the correction of multiple choice papers.
photo-electric device reads the characters, which are then converted to electrical
signals. The signals represent patterns that give an indication of the characters
printed using special ink having good magnetic qualities used in the processing of
bank cheques.
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
OTHER DEVICES
Page 10 of 122
1. The TOUCH SCREEN/TERMINAL – a touch screen/terminal is a light sensitive
screen that can detect when a person touches it, as well as the area of the screen
that was touched. Various options are available on the screen and the user presses
the one he/she wants. The system uses the location of the area that was pressed to
determine the correct option. It is very easy to use and as a result, users do not
require training.
2. The MICROPHONE is a device that functions in much the same way as the
microphone you see used on stage. When you talk your sound waves causes a
diaphragm to vibrate. These vibrations are converted into electrical impulses that
are then transmitted to the computer. One application for which a microphone is
3. VOICE DATA ENTRY (VDE) is the process by which a person speaks to the
a processor to verify and validate that data. A data-entry clerk types in the data
using the keyboard. The data may be typed a second time in order to verify it.
The data is then saved on a disk. The data from the disk can then be transferred to
the high-speed computer in an entire batch. This is a form of batch data entry.
Page 11 of 122
Page 12 of 122
INPUT DEVICES: ADVANTAGES AND DISADVANTAGES
Page 13 of 122
interpret all English
meanings
Page 14 of 122
READER (OMR) fast and accurate the number of
responses
Incorrect or
inconsistent marking of
the sheet may result in
the data being rejected
OUTPUT DEVICES
Page 15 of 122
2. MONITOR – a VISUAL DISPLAY UNIT (VDU) is a television like device that
most people call the computer screen or monitor. Images are displayed on the
monitor using PIXELS in the form of little tiny dots of light. The screen
RESOLUTION refers to the number of pixels that are displayed on the screen at
the same time. It is given as a figure such as 640 * 480. There are two types of
(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
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
AND DRAFTING.
5. PRINTERS – another popular output device is the printer. Printers can be placed
Page 16 of 122
IMPACT PRINTERS are printers that transfer data onto paper by hitting
the paper with some part of the printer in a similar way to a typewriter.
pressed against an inked ribbon onto the paper. There are two types of
LINE PRINTERS
Line printers are printers that can use multiple print hammers to print an
entire line of text at one time. This type of printer is a high speed printer
which prints an entire line at a time. Speed for line printers is measured in
CHARACTER PRINTERS
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.
firing tiny pins arranged in a matrix. As the print head moves back
Page 17 of 122
and forth, these pins strike the ribbon causing dots to be made on the
paper.
Non – impact printers are printers that print using methods that do not
involve striking the paper or an ink ribbon. They are generally faster
text, graphics and colour but they tend to be the most expensive
non-impact printers.
then applied to the paper to form text and graphics. This type of
new ink, toner or print ribbon. Fax machines use this principle.
Page 18 of 122
Page 19 of 122
SECONDARY STORAGE DEVICES AND MEDIA
From magnetic tape and hard disks to CD-ROMS and DVD-ROMS, several secondary
storage devices are available - each with a slightly different use. What all have in
common is that each is used to store programs and data so that they can be retrieved at a
later time.
MAGNETIC TAPE
Magnetic Tape is used for storing large amounts of data. It is especially useful for this
purpose since it is very cheap. Magnetic tape comes in the form of a reel or cartridge and
The tape is divided into parallel rows known as TRACKS. Tracks one to eight each store
a bit in a byte. Track nine is called the PARITY TRACK. It is used as a method of
checking the accuracy of the data. Each group of nine bits (one on each track) is known
as a FRAME.
FRAME
TRACK NO.
1 0
2 1
3 0
4 1
5 1
6 0
7 0
8 1
(Parity) 9 1
Page 20 of 122
There are two types of PARITY: ODD PARITY and EVEN PARITY. If data is stored
using Odd parity, then the number of ones in each frame should always be odd. So
when each byte is being recorded, the computer checks the number of ones. If it was
Even, the corresponding bit in the parity track is set to one, therefore making the
number of ones odd. If it was odd, the parity track is set to zero. Therefore when the
computer is reading the tape and it comes across a group of bits with an even number of
ones, it will know that something is wrong. Even parity works in a similar manner.
Magnetic Tape is high-density, high-speed and has a large capacity. It is read using a
magnetic tape drive. Data is accessed sequentially, which means that the data is
Archiving data.
Page 21 of 122
FLOPPY DISK
A floppy disk (diskette) is a removable disk that everyone is familiar with. Since it has a
small storage capacity, it is typically used to store documents so that they can be used on
more than one computer. The data is stored on a flat, round, plastic disk coated with
magnetic material. Like magnetic tape, this is divided into tracks. However these tracks
A floppy disk must be formatted before it can be used for storing data. This is the process
of preparing the disk for use in the computer. N.B. when you format a disk you lose all
the information on the disk. Data can be accessed sequentially or directly. With direct
access (random access) you can jump straight to data at a particular location instead of
1. Don’t place the disk on a device that has or generates a magnetic field (e.g.
speaker).
Page 22 of 122
HARD DISK (FIXED)
A hard disk is a large capacity, rigid magnetic disk that is used for storing data. Data is
read from or written to a hard disk using an arm-like device known as a read/write head.
This is a device that is used to write data to the disk (store it on the disk) and to read data
from the disk. Data can be read from/written to a hard disk using either a moving
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
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
OPTICAL DISK
Optical disks will eventually make the magnetic disk and magnetic tape technologies
obsolete. Instead of using a read/write head like those two storage devices, the optical
disk uses two laser beams. One beam writes to the recording surface by burning small
pits (holes) into the disk, while the other lower density beam is used to read the data from
the surface. Using this technology, which is a direct access method, data can be stored at
Page 23 of 122
very high densities, accounting for the huge storage capacities of these media. Optical
disks tend to be more reliable than the other secondary storage devices and they also cost
Read only
Erasable – CD-RW
Like with the CD-ROMs, DVD-ROMs are also available in recordable and
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.
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
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
Page 24 of 122
SECONDARY STORAGE TERMS
A SECTOR is a pie-shaped section of a disk that contains the amount of data that
A TRACK is:
One of the concentric rings on a magnetic disk 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
computer system operate at different speeds, e.g. the printer and the CPU.
ACCESS TIME is the amount of time it takes to complete a request for data to be
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
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
Page 25 of 122
devices. SCSI is most commonly used for hard disks and tape drives, but it can
computer bus primarily designed for transfer of data between a computer and
Page 26 of 122
STORAGE ADVANTAGES DISADVANTAGES
FLOPPY DISK Cheap Smallest storage
Used everywhere capacity (1.44Mb)
Light, fits in a pocket Reads/writes data
and portable slowly
HARD DRIVE Stores/retrieves data Not portable
quickly – much faster
than floppy disk
Stores much more data
than floppy disks
Cheap on a cost per
megabyte basis
TAPE Used on many networks Not generally used
to backup data on hard with desktop
disks computers
Low cost storage Slow – so only used
for network back-ups
REMOVABLE Store much more data Other computers must
DRIVES than floppy disk have a Zip drive fitted
Very good for backing to read these disks
up files Do not hold as much
Removable and portable data as hard drives
Relatively cheap Generally not as fast
as hard drives
ADVANTAGES AND DISADVANTAGES OF STORAGE DEVICES
MAGNETIC MEDIA
Page 27 of 122
OPTICAL STORAGE
STORAGE ADVANTAGES DISADVANTAGES
CD-ROM Stores large amounts As CD is read-only,
of data – up to 650 data cannot be changed
Mb per CR-ROM or deleted
Very cheap to Slower access times
produce, particularly than hard drives
on a large scale Cannot read DVD
Good way of
distributing software
CD-R As with CD-ROM, a Must have a CD-R
CD-R stores large recorder to write to a
amounts of data disk
Possible to add data CD-R software has
(write) to the CR-R in varying capabilities
more than one session
Good for backing up
file
CD-RW As with CD-ROM, Must have a CD-RW
CD-RW stores large recorder to write to a
amounts of data disk
CR-RW can be erased CD-RW does not work
and reused as many in all CD players
times as required
Good for backing up
files
DVD Stores massive New technology, so
amount of data – to 17 number of DVDs in
Gb use is smaller than
Excellent for showing number of CD-ROMs
video New technology, so
DVD players can read price of drives
CD-ROM relatively expensive
DVDs do not work in
CD-ROM drives
Page 28 of 122
HOW DATA IS STORED IN THE COMPUTER
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
The binary method of coding data and instructions on the computer is only used in digital
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
Page 29 of 122
BINARY NUMBER SYSTEM
As you go from the rightmost bit (called the least significant bit) to the leftmost bit
(called the most significant bit), the place value increases by a factor of 2.
Increase by factor of 2
Place Value 16 8 4 2 1
4
(in base 10) 2 23
22 1
2 20
Digit 1 0 1 1 1
(in base 2)
A table similar to the one shown above can be used to convert a binary number into a
decimal number. For example let us convert the number 10111 2 to base 10. To do this
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
Multiply each digit by its place value and add the results together.
24 23 22 21 20
16 8 4 2 1
1 0 1 1 1
= 16 + 0 +4 + 2 + 1
= 2310
Page 30 of 122
CONVERTING A NUMBER FROM BASE 10 TO BASE 2
The method for converting from base 10 to base 2 is not as simple as the method given
above.
Divide the decimal number by 2. Write down the quotient and the remainder.
On the next row, divide the quotient from the previous row by 2. Write down
Use the remainders (GOING FROM THE BOTTOM TO TOP) to write down
2 103
2 51 R1 Write down the
2 25 R1 remainders in this
2 12 R1 direction
2 6 R0
2 3 R0
2 1 R1
0 R1
BINARY ADDITION
Page 31 of 122
EXAMPLE: 111 + 10 + 111 + 110
111
10
111
110
101102
1+0+1+0 = 2
2/2 = 1 R 0
Write the remainder as the result for this column and carry over the whole
Page 32 of 122
Using a straight binary code to represent integers can sometimes be very tedious,
especially when representing large numbers. Using the BINARY CODED DECIMAL
(BCD) method, decimal numbers can be converted to a binary form in a less tedious way.
The decimal number is treated as a set of digits which are individually converted to a
binary representation.
Note that when using BCD; each digit is represented using a four bit code. This is
BCD negative and positive signs are represented using a 4-bit pattern which does
8 9 6 DECIMAL
896 = 1000100101102
+896 = 10101000100101102
-896 = 10111000100101102
Page 33 of 122
There are three main ways to represent negative numbers. They are:
1. ONES COMPLEMENT
2. TWOS COMPLEMENT
ONES COMPLEMENT
Going from left to right simply change all the 1s to 0s and 0s to 1s.
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:
Add 1
Add 1 = 011010112
Page 34 of 122
This is the simplest system of the lot. It is also the easiest to understand since it is very
similar to the way we represent decimal numbers. The leftmost bit is used as the sign bit.
All the other bits represent the magnitude of the number. So in the case of the example
(where we use 8 bits in total), 7 bits will be used to store the magnitude of the number
Steps:
45 = 00101101
-45 = 10101101
ASCII CODES
Page 35 of 122
The AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE is the
The ASCII code for D is 010001002. What is the binary for the ASCII code for W?
Steps:
D is the 4th letter of the alphabet and W is the 23rd. Therefore, in order to get the ASCII
code for W you have to add 19 (23-4) to the ASCII code for D. Obviously you cannot
just add a binary number to a base 10 number. Therefore you have to convert one of
them. It would be easier to convert 19 to binary and to add it to 01000100 2. The binary
for 19 is 000100112
01000100
00010011+
01010111
BINARY SUBTRACTION
Page 36 of 122
EXAMPLES:
1. 01 – 00
01
00
012
RULE: 1-0 = 1
2. 01 – 01
01
01
002
RULE: 1-1 = 0
3. 10001 -1011
01121
10001
1011
001102
1. 111 -101 = 10
2. 1111 – 1101= 10
3. 1110 – 1011 = 11
4. 1010 – 111 = 11
OCTAL NUMBERS
Page 37 of 122
OCTAL NUMBERS are numbers to base 8. We therefore use the digits 0 to 7. Since the
number base or scale is 8, each digit of a number has a place value in terms of powers of
8.
EXAMPLES:
8 98
8 12 R2 Write down the
8 1 R4 remainders in this
0 R1 direction
ANSEWER: 1428
8 985
8 123 R1 Write down the
8 15 R3 remainders in this
8 1 R7 direction
0 R1
ANSWER: 17318
Page 38 of 122
CONVERTING FROM OCTAL TO DECIMAL
In converting from octal numbers to denary numbers, we use the fact that each place
value is a power of 8.
EXAMPLES:
1. Convert 7438 to a decimal number
7*82 + 4*81 + 3*80
7*64 + 4*8 + 3*1
448+32+3
= 48310
111
4763
215+
52008
7632
475-
7135
Page 39 of 122
CONVERTING DECIMAL TO HEXADECIMAL
Steps:
1. Divide the decimal number by 16. Treat the division as an integer division.
2. Write down the remainder (in hexadecimal).
3. Divide the result again by 16. Treat the division as an integer division.
4. Repeat step 2 and 3 until result is 0.
5. The hex value is the digit sequence of the remainders from the last to first.
Note: a remainder in this topic refers to the left over value after performing an integer
division.
HEXADECIMAL 0 1 2 3 4 5 6 7 8 9 A B C D E F
DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Example 1
Convert the number 1128 DECIMAL to HEXADECIMAL
In this case,
70/16=4.375. So the
integer division result is
4 (throw out anything
Page 40 of 122
after the decimal point)
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
ANSWER 100
Page 41 of 122
Example 3
Convert the number 921 DECIMAL to HEXADECIMAL
ANSWER 399
Example 4
Convert the number 188 DECIMAL to HEXADECIMAL
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
ANSWER 24E
Page 42 of 122
CONVERTING HEXADECIMAL TO DECIMAL
Steps:
1. Get the last digit of the hex number, call this digit the currentDigit.
2. Make a variable, let's call it power. Set the value to 0.
3. Multiply the current digit with (16^power), store the result.
4. Increment power by 1.
5. Set the the currentDigit to the previous digit of the hex number.
6. Repeat from step 3 until all digits have been multiplied.
7. Sum the result of step 3 to get the answer number.
Example 1
Convert the number 1128 HEXADECIMAL to DECIMAL
Once discerned, notice that the above process is essentially performing this calculation:
Counting the number of digits takes extra time, and you might count wrongly.
If you don't remember what a particular value of a power-of-16 is, it's easier to
calculate it from the previous power value. For instance, if you don't remember
Page 43 of 122
what the value of 16^3 is, then just multiply the value of 16^2 (which you'll likely
already have if you started backward) with 16.
Example 2
Convert the number 589 HEXADECIMAL to DECIMAL
MULTIPLICATION RESULT
9 x (16^0) 9
8 x (16^1) 128
5 x (16^2) 1280
ANSWER 1417
If you want to be a speed counter, it's beneficial to memorize the values of the smaller
power of 16s, such as in this table
Example 3
Convert the number 1531 HEXADECIMAL to DECIMAL
(This time, let's use the table of the power-of-16s above.)
MULTIPLICATION RESULT
1x1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096
ANSWER 5425
Page 44 of 122
Example 4
Convert the number FA8 HEXADECIMAL to HEXADECIMAL
MULTIPLICATION RESULT
8x1 8
A x 16 (remember that hex A=decimal 10) 160
F x 256 (remember that hex F=decimal 15) 3840
ANSWER 4008
Example 5
Convert the number 8F HEXADECIMAL to DECIMAL
DIVISION RESULT
Fx1 15
8 x 16 128
ANSWER 143
Example 6
Convert the number A0 HEXADECIMAL to DECIMAL
DIVISION RESULT
0x1 0
A x 16 160
ANSWER 160
Example 7
Convert the number 12 HEXADECIMAL to DECIMAL
DIVISION RESULT
2x1 2
1 x 16 16
ANSWER 18
Example 8
Convert the number 35432 HEXADECIMAL to DECIMAL
Page 45 of 122
SOFTWARE
Software is a general term for the various kinds of programs, installation files and
documentation that together are used to operate computers and related devices.
A piece of software is commonly called a program, software program or software
package. Program is a sequence of instructions that a computer can interpret and execute.
Software can be classified into two main categories: system software and application
software.
System Software is the category of software used to operate and maintain a computer
system including the operating system, utility programs and program language
translators.
Application software is the category of software that performs specific end-user tasks to
solve every-day problems, inform and entertain.
OPERATING SYSTEM
An Operating System is a group of programs that work interactively to manage the
resources of a computer. Microsoft Windows, Linux and Mac OS are examples of
Operating System Software.
Functions of an Operating System
Communication
File transfer
Resource Management
File Management
Security
Page 46 of 122
USER INTERFACE
A user interface can be thought of as a link between user and computer. It allows the user
and the computer to communicate with each other. The goal of a user interface is to be
easy to use while allowing tasks to be performed efficiently. Two common software
interfaces are graphical user interfaces and command driven interfaces.
Page 47 of 122
this type of interface. DOS and UNIX are some operating systems that use a command
line interface.
PROCESSING MODES
Data can be processed in four ways, depending on the data and what is required at the end
of the process.
BATCH PROCESSING
These process data in batches at one time- not as single items. The entire process can
normally be broken down into three steps:
Gathering the data
Recording the data on a storage medium and
At a later time, processing the data in bulk.
The payroll system, for example normally requires the collection of data over a period of
time with the actual processing of the pay being done only at the end of the month.
ONLINE PROCESSING
These provide a direct link between the user and the computer processor via an input
device. In these systems the data is processed as soon as it is available. It requires the
computer to be online. An example of a system that uses online processing is the airline
reservation system.
REAL-TIME PROCESSING
Real-time processing is where jobs and transactions are processed immediately. It is used
when data is very time-sensitive or when users need immediate access to data. It is
commonly used for online reservation systems.
TIME SHARING
Time sharing is used when a system has more than one user at a time. It allocates CPU
processing time to each user, one at a time.
Page 48 of 122
MANAGING PROCESSES AND TASKS
The operating system manages many processes and tasks at the same time, to make the
computer faster, more efficient and multifunctional. It does this in several ways.
MULTITASKING - Multitasking is when one processor performs several tasks at the
same time in order to complete an operation. Most word processing programs can be set
up to save a document as you are writing; this is an example of multitasking.
MULTIPROCESSING - Multiprocessing is when two or more processors run one
program. Multiprocessing is often faster and more efficient than using one processor to
run a program.
MULTIPROGRAMMING - Multiprogramming is when one processor runs more
than one program at the same time. They could be programs you have launched or
programs that run in the background.
APPLICATION SOFTWARE
Application programs or application software, are programs that allow a computer to
carry out specific tasks, but they are not essential for the computer to work.
GENERAL-PURPOSE applications are flexible and can be used for a variety of
different tasks. For example, a word-processing package is general purpose software
because it can be used to write letters, reports, stories, etc. General-purpose software is
often fairly cheap and reliable.
SPECIALISED APPLICATION can only be used for one task. An application
program like Skype is intended solely for Internet-based telephony and as such is
considered special-purpose. Another example is a payroll package.
CUSTOM-WRITTEN or custom software is software that is created by programmers on
behalf of a company to meet its unique requirements.
Advantages:
Software is tailored to suit the needs of the user.
The user has close control over revisions and can modify the software as needed.
The program may run fast as the code is optimized for a specific purpose only.
Page 49 of 122
Disadvantages of developing custom software as compared with purchase packaged
software are:
It is more costly
It may have flaws during a period of initial use whereas package software would
have been tested extensively.
Data can be easily shared among applications using a range of built-in features.
Users get value for money as it costs less to purchase the integrated application
rather than multiple packages.
Disadvantages:
The integrated software does not have all the features of the individual single-
purpose applications.
Some integrated software packages do not include all the applications that may be
required.
Page 50 of 122
DATA COMMUNICATION
Data Communication is the transmission of data from one location to the other in order to
enable communication between the locations. Data communication is achieved through
the use of computers, transmission cables, satellite and wireless technology.
The data is transmitted via data communication channels. These channels are categorized
according to their BANDWIDTH (volume of data that can be transmitted through the
channel each second). There are three categories of channels. These are:
There are various types of communication systems that vary according to the direction in
which data can be transmitted. These are:
1. SIMPLEX - data can only be transmitted in one direction.
2. HALF-DUPLEX – data can be transmitted in both directions, but not at the same
time.
3. DUPLEX (FULL DUPLEX) – data can be transmitted in both directions at the
same time and independent of each other.
PROTOCOL
Protocols are a set of rules and procedures governing the transmission and receiving of
data. Some international protocols are HTTP, PPP, TCP/IP and FTP.
Protocols are used to ensure that transmissions are coordinated with minimal interference.
Page 51 of 122
NETWORKS
A network is a group of computers and peripheral devices that are connected to each
other by cables or wireless electronics. Networks reduce costs and increases efficiency
by allowing the sharing of programs, data and peripheral devices. In some cases there are
special computers called servers that are dedicated to the managing of particular
resources.
LAN TOPOLOGIES
How computers on a network are connected together determines its topology. The most
common topologies for a LAN are:
1. LINE OR BUS
2. STAR
3. RING
Page 52 of 122
ADVANTAGES
1. Extending the network is easy.
2. It requires less hardware to setup.
3. It is easy to configure.
4. New equipment can be added to it.
DISADVANTAGES
1. Any problems with the main cable may cause the whole network to
malfunction.
2. Packets of data may collide, resulting in loss of information.
Page 53 of 122
STAR TOPOLOGY
All the computers on the network are connected to one another through a central HUB. A
HUB is a hardware device to which a number of computers can be connected. Data is
transmitted from one computer to the other by packets. A packet containing the addresses
of the sender and the receiver is first sent to the central hub, which then sends the packet
to the designated computer.
ADVANTAGES
1. Adding new devices to the network is easy
2. If a computer stops working, the network is not affected.
3. If one piece of cable is damaged, only one computer is affected.
DISADVANTAGES
1. It requires more cabling
2. If the central computer or server malfunctions, the entire network
will fail.
3. Only one computer on the network can send data at any particular
time.
Page 54 of 122
RING TOPOLOGY
The cable is connected to all the computers on the network. The ends of the cable are
then connected together to form a loop or ring. Data is passed from one computer to the
next by means of a token (electronic signal), which is passed around the ring, giving each
computer an opportunity to send data. A computer can send data only when it is
possession of the token.
ADVANATAGES
1. If a computer stops working, the other computers can continue to
communicate.
2. Communication is usually faster than with a line network.
DISADVANTAGES
1. If the main cable is damaged, the entire network goes down.
2. The entire network has to be shut down for any maintenance to be
carried out.
3. The network becomes very difficult to maintain if it gets very
large.
Page 55 of 122
WIDE AREA NETWORK (WAN)
A Wide Area Network (WAN) is a network that covers a wide geographical area. WANs
use a combination of fibre-optic cables and telephone lines, as well as satellite and
microwave technology, to transmit data.
Fibre-optic cables are extremely thin cables that allow extremely fast and accurate
transmission of large volumes of data.
DISADVANTAGES OF NETWORKING
1. Networks are expensive to set up. In addition, configuring a network is a very
complex process that may require an additional employee.
2. Security problems. People may be able to access shared information that they are
not supposed to see by hacking into computers on the network.
Page 56 of 122
MODEM (MODULATOR/DEMODULATOR)
A modem is a device that can convert digital signals into analogue and vice versa. The
speed of a modem is measured in bits per second (bps).
1. UPLOAD – this is the process by which one computer, the host, sends a file to a
remote computer via communication channels.
2. DOWNLOAD – this is the process by which a computer obtains a file from a
host computer via communications channels.
3. POINT-TO-POINT TRANSMISSION – this is the process by which data is sent
from one location to another.
4. BROADCAST TRANSMISSION – this is the process by which data is
transmitted in such a way that any person with the correct equipment can receive
it. This means that it is difficult to control who receives the data.
5. BULLETIN BOARD – this is a centralized computerized location to which
remote computers can connect. Once connected, a user can upload messages and
files or download those posted by other users.
Page 57 of 122
PROTECTING AND SECURING INFORMATION
Since information is so valuable considerable effort is spent protecting it from theft, fire,
viruses, hackers, data loss and data corruption. Numerous methods are used to protect
and secure information. The most widely used of these methods are:
1. Using Passwords
2. File Encryption
3. Physical Access Restriction
4. Software Access Restriction
5. Using Firewalls
6. Back-up and recovery
7. Using fireproof cabinets
8. Archiving
9. Virus protection
PASSWORDS
A password is a combination of characters used to prevent unauthorized computer
access. A person wishing to secure a computer or individual files on the computer
can set a password. In order for access to be granted, the correct password must be
entered.
ENCRYPTION
Encryption is the process of encoding information so that it bears no similarity to the
original in order to secure it. Files are encrypted using a key provided by the person
who wants to encrypt the information. In order to read encrypted information, it must
first be decrypted. This is the process of decoding encrypted information in order to
obtain the original information.
Page 58 of 122
PHYSICAL ACCESS RESTRICTIONS
Physical access restrictions are used to prevent unauthorized persons from gaining
physical access to stored information. Examples of physical access restrictions are:
Housing the computer or removable storage in a room or building. This area
would be secured using locks and a combination or surveillance cameras,
alarms and security guards.
Locking manual files or removable storage in a cabinet or vault.
VIRUS PROTECTION
A virus is a malicious program that is designed to corrupt the files on a person’s computer
and or prevent the computer from working properly. Computers may be protected from
viruses by avoiding using computers or disks that are suspected of having a virus and by
using up-to-date anti-virus software.
ANTI-VIRUS SOFTWARE
An anti-virus program is a special type of software that tries to detect and remove viruses
that are on a computer or removable storage media.
FIREPROOF CABINETS
A fireproof cabinet is a cabinet that is designed to withstand the high temperatures of a
fire. It is used to protect manual files and removable storage media.
Page 59 of 122
FIREWALLS
A firewall is a program that identifies certain weaknesses in networked computers and
tries to prevent them from being exploited. This makes it much more difficult for hackers
to gain unauthorized access to the computer. Therefore firewalls help to keep the data on
these computers secure.
ARCHIVING
When data has remained unchanged for a long time and is not accessed on a regular
basis, it is said to be inactive. If this data is taking up valuable space, you might want to
store it in a separate location instead. This is what is known as archiving the data.
DATA CORRUPTION
When something causes data to become lost or damaged, this data is said to be corrupted.
Data may be corrupted by:
A computer virus
Wilful acts of employees
Computer malfunction.
Power surges or outages.
Poor methods for updating data.
Page 60 of 122
TROUBLESHOOTING AND COMPUTER MAINTENANCE
COMPUTER MAINTENANCE
When you use a computer over a period of time, problems may develop which, even
though they are usually not serious, may accumulate and cause a noticeable deterioration
in the performance of the computer. The operating systems come with tools to help you
get rid of these problems and keep your computer in good working order. Some of these
tools include:
SCANNING DISKS FOR ERRORS
When the computer is turned off without being shut down properly or when a program
crashes, chances are that there will be file errors on your disk. Disks do not last forever
so some part will go bad. Data saved on these locations may not be recoverable. To
prevent or at least reduce the chance of these things happening, your hard drives should
be scanned for file errors as well as physical defects. If file errors are detected, the
scanning program fixes them. If physical errors are discovered, the program does the
equivalent of putting up warning signs around the areas saying that no data should be
stored there. The tools in windows that would allow you to scan and fix errors on disk are
called SCANDISK.
DEFRAGMENTING OF THE FILE SYSTEM
After you have used your computer for a while, especially if you copy, move and delete
files a lot, the files on your computer become fragmented. When files are heavily
fragmented, it causes the computer to run slower since it has to be going all over the disk
to find the parts of a file.
Defragmentation is the process by which the computer takes the fragments of files and
reorganises them on a hard drive so that they are stored contiguously.
Page 61 of 122
BASIC TROUBLESHOOTING
THE COMPUTER (TOWER) IS NOT TURNING ON
Page 62 of 122
monitor)
The computer has turned off the monitor If you left the monitor on and come back to
to save power find that it isn’t showing anything (even
though the switch is to “ON”), move the
mouse and/or push a button on the
keyboard.
Page 63 of 122
make sure that the power supply is
connected to the printer and that it is
plugged on into a working socket. Push the
power button on the printer.
Printer cable is not connected Make sure that one end of the printer cable
is connected to the printer and that the
other is connected to the back of the tower.
If both ends were already connected, try
pushing them in more firmly.
Printer is out of ink Replace and try printing again.
Page 64 of 122
it doesn’t, the OS has crashed. If it does,
the mouse may need to be replaced or
reinstalled. Either way, you may have to
restart the computer.
The mouse pointer is moving erratically Move the switch on the mouse if there is
any, to another position.
Take out the ball from the mouse, if it has
one, and clean the inside of the mouse.
Page 65 of 122
APPLICATIONS AND IMPLICATIONS OF IT
COMPUTERS IN EDUCATION
Hardware and software used in education
HARDWARE REQUIREMENTS SOFTWARE REQUIREMENTS
Computers (stand alone and networked) Word processing for creating documents
Printers (laser, inkjet and sometimes Web and video conferencing software
character printers)
Devices for learning such as concept CAI/CAL software for a variety of subjects
keyboards, voice synthesisers and levels (simulations, tutorials)
Database software for managing student
records
Spreadsheets for grading students’ marks
CML (COMPUTER MANAGED
LEARNING) software which is used as an
administrative tool for creating timetables,
etc.
CML/CMI
Page 66 of 122
COMPUTER MANAGED LEARNING AND COMPUTER MANAGED
INSTRUCTION are other tools used in educations. However, unlike CAI and CAL,
CML and CMI is used as an administrated resource rather than an instructional one – to
organise students’ data and timetables, and in libraries to manage indexes.
Page 67 of 122
CURRENT TRENDS IN TECHNOLOGY
TELECOMMUTING
Telecommuting is a term used to refer to when an employee works off-site using a
computer and a communication channel to communicate with the office
network/computer.
Advantages associated with telecommuting
The reduced commuting means reduced cost, less stress (from not having to put up with
rush hour traffic) and is more convenient for the employee. All that is required is a
connection to the office network via a communication channel. The most common
method of doing this is via a modem, telephone line and remote networking software.
Disadvantage associated with telecommuting.
The employee may have to absorb resulting additional telephone and electricity costs.
There is also the initial cost of setting up the computer system, both at home and at the
office, to support telecommuting. The most serious disadvantage is lack of supervision.
Since the employee can work when he/she wishes, and may be distracted by things such
as telephone calls, television, there may be a loss of productivity. Also there may be the
problem of reduced social interaction between employees.
Page 68 of 122
ADVANTAGES
Videoconferencing offers people the advantage of convenience, productivity gains and
reduced travel time and cost.
DISADVANTAGES
An increase in telecommunication cost and loss of personal contact is experienced. Also
is the connections are slow, the video and audio may not be of very high quality.
TELECONFERENCING
Teleconferencing is similar to videoconferencing except there is no video.
Page 69 of 122
MEASURES TO REDUCE INFORMATION MISUSE
INFORMATION MISUSE
Since computers make it easy to collect, store and share information, they also make it
easy to misuse it. For example, is collected on people who use the internet, whether they
know it or not.
Information may be misused in the following ways:
By collecting information about people without their permission
When unauthorised persons are able to view and/or change information
By using information for purposes other than those for which it was intended.
Page 70 of 122
DATA PROTECTION LAWS
These laws are designed to protect individuals and organizations. Data protection laws
generally state that personal data must:
Be obtained and processed fairly and lawfully
Be held for specified purposes
Not be used for any reason incompatible with its original purpose
Be relevant and adequate
Be accurate and up to date
Not be kept longer than necessary
Be made available to the individual concerned and provision made for corrections
Be kept secure
PIRACY
Software piracy is the copying of programs without consent of the owner.
Page 71 of 122
INFORMATION TECHNOLOGY: JOB SKILLS AND CAREERS
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
MANAGERS
Make sure jobs in the department are done correctly, on time and within the
budget
Prepares budgets for the department
Manage the human resources within the department
DATABASE ADMINISTRATORS
Designs and develop database applications
Control access to the data
Keep the data up to date
NETWORK ADMINISTRATORS
Set up the network
Develop and/or install the software that is used on the network
Grant access privileges
Monitor the use of the network
DATA-ENTRY CLERKS
Transfer data from source documents onto machine-readable media or directly
into the computer
Verify previously entered data
COMPUTER OPERATORS
Start up and shut down the computer equipment
Page 72 of 122
Supervise data-entry operators
Back up data files on a regular basis
Mount tapes, load printer paper, change ribbons, etc.
LIBRARIANS
File, store and distribute data files, tapes, diskettes, compact disks, etc.
File archived material
File and distribute hard copies
File documentation for programs
TECHNICIANS
Assemble and service computer equipment
Find and fix computer problems
COMPUTER ENGINEERS
Design computer configurations
Determine the network cabling requirements and layout
Determine the power requirements for the computer department
Design computer chips
Design and develop processes for the manufacturing of computer parts
CONSULTANTS
Advise clients on solutions to their problems
Identify the best source for procurement of hardware and software
COMPUTER TRAINERS
Train people to use computer hardware and software
Develop training manuals
Examine and mark examination scripts
Page 73 of 122
Page 74 of 122
PROBLEM SOLVING AND PROGRAM DESIGN
INTRODUCTION TO PROGRAMMING
SOLVING THE PROBLEM
You should first think about a method and develop an algorithm to solve the problem. An
ALGORITHM is a sequence of precise steps, which results in a solution.
Problem solving is usually broken down into two phases:
ALGORITHM PHASE
In this phase, there are three steps:
1. Clearly define the problem that you want to solve.
2. Design an algorithm that is precise and well thought out to solve the problem.
3. Test your algorithm. You must make sure your algorithm works correctly before
you can write a program for it.
IMPLEMENTATION PHASE
In this phase, there are three steps:
1. Translate your algorithm into a programming language. Example Pascal. This
translation must be correct and free of:
SYNTAX ERRORS, which are the errors resulting from incorrect
use of the programming language syntax.
LOGIC ERRORS made by the programmer, such as those made
by using wrong signs or arithmetic operators.
2. Test the program to make sure it produces the correct results.
3. Document the program. Here you write comments on how to use the program, as
well as comments within the program on how it works.
Page 75 of 122
When a problem is first analysed, the objectives should be specified first, this is, what the
program is meant to do. The following four steps are used to organise and summarise a
programs objectives.
1. Specify the output – what kind of output are you expecting from this program? Is
it in readable form or is it for input to another program?
2. Specify the input – since you know what the output is you can specify what the
input should be.
3. Specify the processing – what processing should be done on the input to get the
necessary output?
EXAMPLE 1
Page 76 of 122
You are given a problem of finding the sum of three numbers.
DEFINING DIAGRAM
INPUT PROCESSING OUTPUT
num1 Read three numbers TOTAL
num2
Add the three numbers
num3
together
The first step is to identify the input (that is, the data that is given). The keyword, read,
identifies the input as three numbers, that is, any three numbers. A name must be given to
refer to each number. We can call them A, B, C or num1, num2 num3. Any name will do
once you are consistent when referring to the numbers by name.
The next step is to identify the output. The keyword, print, identifies the output as the
total (or sum) of the three numbers.
The final step in defining this problem is to list the processing steps. This is you would
list all the actions that must be performed in order to get the desired results. What do you
have to do to the numbers in order to print their total?
1. We must first get the numbers
NOTE THAT:
1. In the defining diagram, the actions must be listed in a logical sequential order.
2. All the necessary actions must be explicitly stated. For example, the read action
and the print action must not be assumed.
Page 77 of 122
The processing section is NOT the solution to the problem. It is simply a list of the
things that must be done in order to solve the problem.
EXAMPLE 2
You are given the problem of finding the average temperature on a particular day.
However, you are told to ask the user to input the maximum and minimum temperature
readings. You then calculate and output the average temperature. This is calculated by
(maximum temperature + minimum temperature) divided by 2
INPUT PROCESSING OUTPUT
Max_temp Prompt for max Average_temp
Min_temp temperature, min
temperature
Read max_temp,
min_temp
=(max_temp +
min_temp)/2
Page 78 of 122
ALGORITHM DESIGN
An Algorithm is the step-by-step instructions required to obtain the solution to a problem.
It must have a set of rules, must be explicit and have a clear stopping point. It is really
used to expand the processing part of the IPO chart in PSEUDOCODE or pseudo-
English. The algorithm should start with a title and end with the keyword END.
A good algorithm should be:
Correct – it should accept all inputs (even invalid inputs) and output a correct
answer or meaningful response or message.
Simple – each step of the algorithm should perform one logical step in solving the
problem.
Precise – the algorithm should present the solution steps precisely and concisely
without referring to low level details.
Efficient – the algorithm should enable the program code to produce results
quickly, depending on the problem size, and not waste any memory or time.
PSEUDOCODE
The statements, keywords, variables, loops and subroutines used to define the steps of an
algorithm.
Terms to be familiar with:
Statements and keywords - related lines of code form a statement. Each statement
has a beginning and an end. Instructions within the statement are called
keywords.
Variables – store data for the program to work with. A variable could contain text
or numerical values. Examples are Total, num1, score, etc
Page 79 of 122
Conditional statement – provide a choice such as ‘if … then ... else’. They make
decisions in the program.
VARIABLES
A Variable is the name that represents a piece of data that can take many possible values.
If the variable is used in the entire program it is called a GLOBAL VARIABLE. If it is
used in one part of the program, it is called a LOCAL VARIABLE. In the examples
above num1, num2, num3, total, min_temp, max_temp and average_temp are all
variables.
NOTE
When new values are placed into previously assigned memory locations, the old
values are replaced by the new ones. Therefore, if it is necessary to retain the
existing value in a memory location, a different variable must be declared to hold
the new data value.
Page 80 of 122
BASIC DATA TYPES FOR VARIABLES
DATA TYPE DESCRIPTION EXAMPLES
Integer Whole numbers, both 23, -50, 0
positive and negative
Real All numbers including 15.7, -19.4, 4.234
fractions
Character Keys on the keyboard A, d, $,? , 4
String Characters put together ‘Hello world’
Boolean True or false TRUE or FALSE
ALGORITHMIC STRUCTURE
Every algorithm should have the following sections, in the stated order;
HEADER: Algorithm’s name or title.
DECLARATION: a brief description of algorithm and variables used. That is,
a statement of the purpose, as well as initialization of
variables.
BODY: sequence of steps
TERMINATOR: an end statement
Page 81 of 122
READING AND WRITING IN ALGORITHMS
WRITING INSTRUCTIONS
Commands used to input data are READ and INPUT.
Syntax: READ <VARIABLE NAME>
Example: Read Name, Read Num1, Read Radius
PROMPTING INSTRUCTIONS
Prompting statements are used along with input statements to request or notify the user to
enter data into the computer. These statements are usually displayed on the screen.
Prompting instructions usually precede input instructions.
Commands used to prompt the user are PRINT or WRITE
Syntax: PRINT <string>
Example: PRINT ‘Enter student name’
OUTPUT INSTRUCTIONS
These instructions display/output data that is in the computer’s memory. Commands used
to output data are PRINT or WRITE. You can output string variables and numeric
variables as follows.
Syntax: PRINT <variable name>
Example: PRINT Name
The value of a variable is printed, for example, ‘Jane’
Page 82 of 122
OUTPUTTING A STING CONSTANT AND A VARIABLE
It may become necessary to output a label for a variable to identify what is being printed.
For example, if $5.00 is printed by itself, you may not know what it means unless a
description or label goes along with it, such as:
The total cost is: $5.00
Syntax: PRINT ‘string’, <variable>
Example: PRINT ‘The total cost is:’, Cost
Page 83 of 122
CONTROL STRUCTURES
A structure is a basic unit of programming logic. A structure can be a sequence, a
selection or a loop (that is, repetition).
SEQUENTIAL STATEMENTS
Sequential statements are statements which are executed one after the other, from the first
line to the last line.
EXAMPLE:
Write an algorithm to add two numbers
Print ‘Please enter two numbers’
Read Num1, Num2
Sum Num1 + Num 2
Print ‘Sum of the two numbers = ‘, Sum
Page 84 of 122
SELECTION STRUCTURES
IF… THEN or IF… THEN … ELSE statements. They allow decisions to be made, based
on some condition that evaluates to TRUE. In the case of IF… THEN … ELSE,
alternatives are executed if the condition is FALSE.
IF … THEN CONSTRUCT
The IF … THEN construct contains a condition which is tested before an action can be
undertaken. If the condition holds TRUE, then the action is taken. Otherwise, the
instruction statements between IF … THEN and ENDIF are not taken but are ignored.
SYNTAX:
IF <CONDITION> THEN
<Action to be taken if condition is TRUE>
ENDIF
EXAMPLE:
A company gives out bonuses based on the amount of income generated by their sales
representatives per month. Once the income is greater than $5000.00, a bonus of 10% of
the generated income is given to the employees. Read the income generated and print the
bonus.
PRINT ‘ENTER THE INCOME GENERATED’
READ INCOME_GENERATED
IF INCOME_GENERATED > 5000 THEN
BONUS INCOME_GENERATED * 10%
PRINT ‘BONUS’, BONUS
ENDIF
N.B – CASE 1
We must be aware of where the PRINT statement is placed. If it is placed within the
IF… THEN- ENDIF construct, only if the income generated is greater than $5000.00
is the bonus printed.
PRINT ‘ENTER THE INCOME GENERATED’
READ INCOME_GENERATED
IF INCOME_GENERATED > 5000 THEN
BONUS INCOME_GENERATED * 10%
ENDIF
PRINT ‘BONUS’, BONUS
Page 85 of 122
N.B – CASE 2
In this case, the PRINT statement is placed outside the IF-THEN-ENDIF construct.
So the word BONUS is printed regardless of whether the bonus is actually calculated
or not.
INITIALISING A VARIABLE
It may sometimes be necessary or wise to initialise a variable, that is, to give the variable
a starting or initial value.
BONUS = 0
PRINT ‘ENTER THE INCOME GENERATED’
READ INCOME_GENERATED
IF INCOME_GENERATED > 5000 THEN
BONUS INCOME_GENERATED * 10%
ENDIF
PRINT ‘BONUS’, BONUS
N.B – CASE 3
In case 3, if the income generated is less than or equal to $5000.00 and no bonus is
calculated then the bonus printed will be $0.00. This is because the figure has
previously been stored in memory
QUESTIONS:
A car rental firm leases its cars for $250.00 per day. The manager gives a discount based
on the number of days that the car is rented. If the rental period is greater than or equal to
7 days then a 25% discount is given. Read the rental period and print the discount given.
PRINT ‘ENTER RENTAL PERIOD’
READ RENTAL_PERIOD
IF RENTAL_PERIOD >=7 THEN
DISCOUNT (250 * RENTAL_PERIOD) * 25%
PRINT ‘DISCOUNT’, DISCOUNT
ENDIF
Page 86 of 122
Write an algorithm to read the score of a student in an exam and determine whether the
student has passed. If the score is greater than or equal to 50, the student has passed.
Print “PASS” if the student has passed.
PRINT ‘ENTER STUDENT MARK’
READ MARK
IF MARK >= 50 THEN
PRINT ‘PASS’
ENDIF
Page 87 of 122
A student is given a 5% discount off the fees for a course if the fees are paid before 30
days. Read a fee and the number of days. Output the fee, discount amount and fee less
the discount amount.
PRINT “ENTER THE FEE AND THE NUMBER OF DAYS”
READ FEE, DAYS
IF DAYS < 30 THEN
DISCOUNTAMT = FEE * 5/100
ELSE
DISCOUNTAMT = 0
ENDIF
AMTDUE = FEE – DISCOUNTAMT
PRINT “FEE”, FEE
PRINT “DISCOUNT AMT”, DISCOUNTAMT
PRINT “FEE LESS DISCOUNT AMT”, AMTDUE
Page 88 of 122
IF STAND = “D” THEN
REVENUE = SPECTATORS * 5.00
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
PRINT “STAND”, STAND
PRINT “REVENUE”, REVENUE
LOOPS
Loops are useful for repeating parts of a program. That is, they will repeatedly execute a
section of a program until the end condition is satisfied. In order to exit from a loop, you
must have a method for checking to see if you have completed the task. Once a loop
terminates, control is returned to the first sentence after the block of sentences in the
loop.
The basis structure of a loop is:
Initialise the variable to some start value – this variable usually determines
whether or not the loop executes or not.
Test the variable against a condition.
Execute the body of the loop.
Update the value of the variable.
WHILE LOOP
User input ----- (then) ---- check condition ---- (then) ---- performs statements
REPEAT LOOP
User input ---- (then) ---- performs statements ---- (then) ---- check condition
WHILE - DO LOOP
Page 89 of 122
The WHILE –DO loop repeatedly executes a statement or a block of statements as long
as the condition is TRUE.
The condition in a WHILE loop is tested at the beginning of the loop, so it is possible
for the statement not to be executed at all.
The initial value for the condition can be stored in a variable which is read or it can be a
value which is assigned to the variable. The initial value is necessary so that the
comparison for the condition can be made when the WHILE instruction is executed the
first time.
The termination constant is known as the DUMMY VALUE. A dummy value is not a
real value for the problem being solved. For example 999, could be the dummy value.
EXAMPLE:
AGE = 15
WHILE (AGE < 20) DO
PRINT “YOU ARE NOT 20 YEARS OLD”
AGE = AGE + 1
ENDWHILE
PRINT “YOU ARE OUT OF THE LOOP”
EXAMPLE:
WHILE NO = 0 DO
The loop is repeated once, NO = 0, otherwise it is terminated.
2. Use <> if only one value is to be used for terminating the loop.
EXAMPLE:
Page 90 of 122
WHILE SCORE <> 999 DO
3. Use <= or < if the value to terminate the loop are less than the dummy value or
less than or equal to the dummy value respectively.
4. Use >= or > if the values to terminate the loop are greater than the dummy value
or greater than or equal to the dummy value respectively.
FOR is the beginning and ENDFOR is the end of the loop. The loop variable is used to
count the number of times the loop is executed. The value of this variable starts at the
beginning value and is increased by one each time the loop is executed unless otherwise
directed by the step clause.
The step clause indicates how much the loop variable is to be increased or decreased by
each time the loop is executed. The step clause is not necessary if the increment is one.
When the end value is reached, the loop terminates and the instruction following
ENDFOR is then executed
EXAMPLE: Print a table to find the square and cube of all even numbers between 2
and 20 inclusive
PRINT “NUMBER”, “SQUARE”, “CUBE”
FOR NUMBER = 2 TO 20 STEP 2 DO
SQUARE = NUMBER * NUMBER
CUBE = NUMBER * NUMBER * NUMBER
PRINT NUMBER, SQUARE, CUBE
ENDFOR
EXAMPLE: Calculate the sum of all the odd numbers between 1 and 20. Print the
total
Page 91 of 122
SUM =0
FOR ODDNUMBER = 1 T0 20 STEP 2 DO
SUM = SUM +ODDNUMBER
ENDFOR
PRINT SUM
STATEMENTS
DECISIO
FALSE
N
TRUE
The general form of the REPEAT – UNTIL loop
REPEAT
Page 92 of 122
<Statements>
UNTIL <condition is TRUE>
EXAMPLE:
A number is given a value 1. Repeat the following calculation until the value reaches 10
or more, add 2 to the number and display the results.
A= 1
REPEAT
A=A+2
Print ‘The value of A is ‘, A
UNTIL A>= 10
Page 93 of 122
FLOWCHARTS
Flowcharts are diagrams that arrange the components of a problem in a logical sequence,
which helps to avoid logic errors. The shapes used are shown below. The shapes are
linked using arrowed lines that point to the next step in the sequence.
START / STOP
DECISION
INPUT / OUTPUT
PROCESS
Page 94 of 122
EXAMPLE:
Add the weights of two people to get a total weight.
Start
Enter
weight1,
weight2
Print ‘Total
weight’,
Totalweight
Stop
Page 95 of 122
ARITHMETIC OPERATORS
OPERATOR MEANING
+ ADDITION
- SUBTRACTION
* MULTIPLICATION
/ DIVISION
RELATIONAL OPERATORS
OPERATOR MEANING
< LESS THAN
> GREATER THAN
= EQUAL TO
<= LESS THAN OR EQUAL TO
>= GREATER THAN OR EQUAL TO
<> NOT EQUAL
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
Page 96 of 122
If any one of the values is NOT TRUE then the result is FALSE
A B A AND B
1 1 1
1 0 0
0 1 0
0 0 0
A B A OR B
1 1 1
1 0 1
0 1 1
0 0 0
Page 97 of 122
TESTING ALGORITHMS
Before you convert an algorithm to code, it is a good idea to check that it is complete and
logical. This can be done by using actual values on the algorithm. There are two ways to
do this: DRY –RUN TESTING and TRACE TABLES.
DRY –RUN TESTING
Dry-run testing is also known as desk checking. This is when you substitute values for
the variables and follow the instructions in the algorithm step by step to arrive at a
solution. A dry-run test will tell you if there are any logic errors in your algorithm.
EXAMPLE:
Read b, c
a=b+c
d=a*2+c
e=d–3
To conduct a dry run test, substitute actual values for the variables that are entered.
Assume b = 10 and c = 2
a = 10 + 2 = 12
d = 12 * 2 + 2 = 26
e = 26 – 3 = 23
If an algorithm contains logic errors, you will not be able to complete a dry run test.
EXAMPLE:
Read b, c
a=b+d
d=b*2+c
e=d–3
Using the same values for b and c, the dry run test would go as follows: a = 10 +?
No value has been calculated for d, and the computer cannot skip ahead to the next line to
figure out what d should be. This dry run test has revealed a logic error in the algorithm.
TRACE TABLES
Trace table is a very useful tool which allows you to see the state of your algorithm with
as much detail as you wish. They are tables that track each variable as it progresses
through the calculation. It will show you the output of each cycle of calculation within a
problem.
EXAMPLE:
Number = 0
Number2 = 1
While number <12 Do
Number = number + 3
Number2 = number2 + 2
Print number, number2
EndWhile
Page 98 of 122
The first step is to create a table with a column for each variable and one row per pass, so
the number of rows depends on how many times the calculations is carried out.
The first row contains the initialised values
The second row contains the values of number after 3 is added to it and the value
of number2 after 2 is added to it.
Number Number2
0 1
3 3
6 5
9 7
12 9
Page 99 of 122
ADD 400
STA 500
3. HIGH LEVEL LANGUAGE – these differ from low level languages in that they
require less coding detail and make programs easier to write. High level
languages are designed for the solution of problems in one or more areas of the
application and are commonly described as application-oriented or problem-
oriented languages. High level languages are not machine dependant. Programs
written in a high level language must be translated to a form which can be
accepted by that computer, i.e. they must be converted into machine code. This is
achieved by means of a special program – either a COMPILER or an
INTERPRETER.
COMPILER: compilers translate high-level programs into machine code. Each
high level instruction normally converts into many machine instructions. The
input (i.e. the high level code) into the compiler is called the source code and the
output (i.e. the machine level code) is called the object code. The process of
converting high level language to machine language in this way is called
COMPILING.
GENERATION OF LANGUAGES
GENERATION DESCRIPTION
IMPLEMENTING A PROGRAM
The five stages that ensure smooth progress in implementing a program is as follows:
Stage 1: Create the source code.
Stage 3: Link.
TYPES OF TESTING
Computer testing
Dry run tests and trace tables are methods of testing on paper. Dry run testing is a
method of checking that a program does not contain any logic errors. If the program uses
loops, you can use trace tables to trace the logic of a program through multiple values.
Computer testing is where you test a program on a computer by running it with as many
different types and combinations of data as possible.
Check that the correct format is used, such as a date or time format.
Check that the correct data type has been used, such as a numeric value and not
symbols.
Verification checks that the data entered is exactly correct. This is a time consuming
process and tends to be used only when data accuracy is crucial.
DOCUMENTING PROGRAMS
Documentation says what a program does and how it is used. A program is not much use
to a person if they do not know what it is or what it is used for.
INTERNAL DOCUMENTATION
Internal documentation is also called technical documentation. If you are looking at a
long and complex program that you did not write, internal documentation can help you
see how it works. There are several forms of internal documentation:
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.
The PROGRAM part is where you name the program. You can give the program any
name you want, but it should be as relevant as possible. For example if the program
calculates the average outdoor temperature, you may want to name is as follows:
PROGRAM Average_Temp (input, output);
In the CONST and VAR sections, you declare all the constants and variables that you
will be using in the program.
You write the input, output and processing instructions between BEGIN and END.
Every statement ends with a semi-colon (;)
There is a period (full stop) after END.
Example: Write a program to add two numbers and output the results.
PROGRAM addition (input, output);
VAR
Num1, Num2, Sum: REAL;
BEGIN
{User enters the two numbers}
WRITELN(‘Please enter a number’);
READLN(num1);
WRITELN(‘Please enter a number’);
READLN(num2);
Sum:= num1 + num2;
WRITELN(‘Sum of the two numbers = ‘ , Sum);
READLN;
END.
DECLARING DATA TYPES
DECLARING VARIABLES
To declare a variable in a program, state the identifier then the data type.
Variable_identifier: data type;
It can include upper and lower case letters, numbers and the underscore
symbol.
It must not be a word that is reserved for the programming language, such as
integer.
PUNCTUATION
Put a SEMICOLON at the end of any declaration or statement in Pascal.
INITIALISING A VARIABLE
Sometimes you may want a variable to hold a particular value at the start of a program,
such as zero. So you initialise that variable when you declare it. Variable are usually
initialised when using loops.
Pascal syntax to initialise a variable:
Identifier: = value;
Counter: =0;
This statement is called an assignment statement.
DECLARING CONSTANTS
You use the CONST section to declare a constant at the start of a Pascal program.
Pascal syntax to declare const:
Const_identifier:= value;
Year:=2010;
MANIPULATING DATA
In a programming language, an instruction that is a single word is called a command. A
set of instructions is called a construct. In a Pascal program, you put all the input,
processing and output instructions between BEGIN and END and after you have
declared the variables and constants. These instructions are called executable statement.
OUTPUT
Output instructions tell the computer to display information on the screen, usually the
results of a calculation. Your pseudocode may contain these words for output statements:
output, display, write or print. In Pascal you use WRITE or WRITELN. Similar to the
READLN, WRITELN will automatically move to the next line when the data had been
displayed in the current line.
Example:
WRITE (‘Total Price’);
WRITELN (‘Total Price’);
WRITELN (‘Total Price of item is’ , price);
CONTROL STRUCTURES
Control Structures deal with conditional statements and loops in Pascal. Here is a
reminder of how to use conditional statements when solving a problem.
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.
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;
OF DATA TYPE tells the computer what kind of data type you want stored in the
array, such as integers.
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.
Procedure Initialise;
Begin
Max :=0;
Min := 999’
End;
Procedure InputData;
Begin
Writeln(‘Please enter a mark’);
Readln(Marks[N]);
End;
Procedure Dertemine;
Begin
For N := 1 to 10 Do
Begin
InputData;
If (Marks[N] > Max) Then
Max := Marks[N];
If (Marks[N] < Min) Then
Min := Marks[N];
End;
End;
Procedure OutputData;
Begin
Writeln(‘ The Minimum mark ‘ , Min);
Writeln(‘ The Maximum Mark ‘ , Max);
End;
Begin
Initialise;
Determine;
OutputData
End.
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
Cost-effective: the value of information should be more than the cost involved in
its collection.
INFORMATION AS A COMMODITY
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.
Laboratories have machines that can read and process data from samples. For
example a machine can analyse a blood sample and find its blood type.
SOURCES OF DATA
To create information from data, you must get that data from a suitable source. Data can
be captured using MACHINE-READABLE or HUMAN READABLE documents.
Machine Readable documents are documents that a computer can read.
Human Readable documents are documents that a human can read.
SOURCE DOCUMENT
A SOURCE document is a document used to capture information by writing it down.
Source documents are human readable. The best example is a form, which may be a hard
copy or softcopy.
TURNAROUND DOCUMENT
A TURNAROUND document is human readable and machine readable. A machine
creates it and a human adds more data or uses it as input for something else. The
document is then read by a computer, which updates or processes records with the new
data. This means that a machine creates it as output, which you modify, and the machine
uses that modified document as input again. Examples are utility bills.
DATA LOGGING
Data logging is a method of automatic data capture where a reading from a sensor is input
at regular intervals. This data can then be processed to provide analysis of the
environment. A data logging system consists of sensors connected via an interface to a
computer and some data logging software. The sensors will take measurements and at
required intervals the software will record the data. The results can then be displayed as a
graph or a table.
Deliberate errors are errors made on purpose, usually for gain or to cause disorder.
There are two ways to prevent data errors caused by humans: data verification and data
validation.
DATA VERIFICATION
Data verification ensures that data entered into a computer contains no errors at all. It is a
very thorough way of making sure the data entered is correct. Two methods of data
verification are DOUBLE-ENTRY and PROOFREADING.
Double-Entry is where the same data is entered twice, sometimes by different people. If
the data is differs between the two entries, it does not get processed. It can be expensive
and time-consuming to use this method, but it does not ensure very accurate data capture.
Proofreading checks the data entered against the data on the original source document.
The person entering the data reads the source document and checks that it matches what
DATA VALIDATION
Data validation uses a variety of checks to make sure that data is as accurate and
complete as possible. It does not check the complete accuracy of data, but it does help
ensure that fewer mistakes are made. If the data does not pass the checks, the program
may return an error or the field will not be filled in. the checks depends on the type or
nature of data that is entered.
The most common methods are:
RANGE CHECKS
A range check ensures that numbers entered fall within a specific range. Example: if you
are entering times of the day, you may need to check that the values for hours cannot go
higher than 24. If someone enters 2500 by mistake, that values will not compute.
REASONABLENESS CHECKS
Reasonableness checks ensure that data is reasonable – not completely unrealistic. If you
are entering information into a payroll system, a reasonableness check will ensure that
you do not enter extra zeros by mistake.
DATA TYPE CHECKS
This ensures that the right type of data had been entered. They ensure that only numbers
have been entered or that only symbols and letters have been entered. A field that
captures the age of a person may have a character check that rejects the input of letters or
symbols.
CONSISTENCY CHECKS
This compares data you have entered against other data you have entered. If you enter a
person’s year of birth and their age in separate fields, a consistency check will ensure that
the two fields corresponds with each other. Consistency checks can be used to make sure
that false or dishonest data has not been entered.
PRESENCE CHECKS
A field contains a single data item, and many fields comprise a record. Each field
has a name and one is the key field used to identify the record.
A data file is a collection of records holding the same type of information but
about different objects or individuals.
The way in which the records of the file are organized on the secondary storage
device. This is called file organisation.
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
There is also another file, known as the change file or TRANSACTION LOG, which
keeps a record of changes to the transaction file.