Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
52 views

Computer Notes 2019

Uploaded by

anesumandaraza0
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Computer Notes 2019

Uploaded by

anesumandaraza0
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 139

Miss gwenzi form 1 notes

INTRODUCTION TO COMPUTERS

 A COMPUTER is an electronic machine that can accept data through input devices and can
process the given data through CPU and can display the result through one of the output
devices.
 Computer performs both simple and complex operations, with speed and accuracy. All
computers regardless of their size, capacity, speed and cost perform 4 basic functions which are
as follows:
 Acceptance of data
 Processing of data
 Giving out processed data
 Storing data

Characteristics of Computer
 Speed The computer can process data very fast, at the rate of millions of instructions per
second.
 Accuracy Computer provides a high degree of accuracy.
 Diligence when used for a longer period of time, the computer does not get tired or fatigued.
 Storage Capability Large volumes of data and information can be stored in the computer and
also retrieved whenever required.
 Versatility Computer is versatile / multipurpose in nature. It can perform different types of
tasks with the same ease.

Limitations of computers
 Computer can only perform tasks that it has been programmed to do.
 Computer cannot do any work without instructions from the user.
 It executes instructions as specified by the user and does not take its own decisions.

HARDWARE
 A computer system is made up of hardware and software.
o Hardware: Physical components of a computer (something you can touch)
o Software: Programs that run on the computer (you can't hold them in your hand)
o Systems software: Set of programs needed to control the hardware(Operating System)
o Applications software: Programs that allows the user to carry out a task or produce
something.

Peripheral devices consist of input and output devices.


 A peripheral is a device attached to a host computer (CPU) but not part of it, and is more or
less dependent on the host.
 It expands the host's capabilities, but does not form part of the core computer architecture.

COMPUTER - INPUT DEVICES


 Are devices that are used to introduce data into the computer system
 Input devices send data and instructions into the computer for processing.

Following are few of the important input devices, which are used in Computer Systems:

1
Miss gwenzi form 1 notes
 Keyboard
 Mouse
 Joystick
 Light pen
 Track Ball
 Scanner
 Graphic Tablet
 Microphone
 Magnetic Ink Card Reader (MICR)
 Optical Character Reader (OCR)
 Bar Code Reader
 Optical Mark Reader

Keyboard
 The keyboard helps in inputting the data to the computer. The layout of the keyboard is like
that of traditional typewriter.
 Keyboards are of two sizes 84 keys or 101/102 keys, but now 104 keys or 108 keys keyboard is
also available for Windows and Internet.
The keys are following
Keys Description
These keys include the letter keys (A-Z) and digits keys (0-9) which generally
Typing Keys
give same layout as that of typewriters.
It is used to enter numeric data or cursor movement. Generally, it consists of a
Numeric Keypad set of 17 keys that are laid out in the same configuration used by most adding
machine and calculators.
The twelve functions keys are present on the keyboard. These are arranged in
Function Keys a row along the top of the keyboard. Each function key has unique meaning
and is used for some specific purpose.
These keys provide cursor and screen control. It includes four directional
Control keys arrow key. Control keys also include Home, End, Insert, Delete, Page Up, Page
Down, Control(Ctrl), Alternate(Alt), Escape(Esc).
Special Purpose Keyboard also contains some special purpose keys such as Enter, Shift, Caps
Keys Lock, Num Lock, Space bar, Tab, and Print Screen.

Mouse
 Mouse is most popular Pointing device. It is a very famous cursor-control device. It is a small
palm size box with a round ball at its base which senses the movement of mouse and sends
corresponding signals to CPU on pressing the buttons.
 Generally, it has two buttons called left and right button and scroll bar is present at the mid.
Mouse can be used to control the position of cursor on screen, but it cannot be used to enter
text into the computer.

Advantages
 Easy to use
 Not very expensive
 Moves the cursor faster than the arrow keys of keyboard.

2
Miss gwenzi form 1 notes

Joystick
 Joystick is also a pointing device, which is used to move cursor position on a monitor screen. It
is a stick having a spherical ball at its both lower and upper ends. The lower spherical ball
moves in a socket. The joystick can be moved in all four directions.
 The function of joystick is similar to that of a mouse. It is mainly used in Computer Aided
Designing (CAD) and playing computer games.

Light Pen
 Light pen is a pointing device, which is similar to a pen. It is used to select a displayed menu
item or draw pictures on the monitor screen. It consists of a photocell and an optical system
placed in a small tube.
 When light pen's tip is moved over the monitor screen and pen button is pressed, its photocell
sensing element, detects the screen location and sends the corresponding signal to the CPU.

Track Ball
 Track ball is an input device that is mostly used in notebook or laptop computer, instead of a
mouse. This is a ball, which is half inserted and by moving fingers on ball, pointer can be moved.
 Since the whole device is not moved, a track ball requires less space than a mouse. A track ball
comes in various shapes like a ball, a button and a square.

Scanner
 Scanner is an input device, which works more like a photocopy machine. It is used when some
information is available on a paper and it is to be transferred to the hard disc of the computer
for further manipulation.
 Scanner captures images from the source which are then converted into the digital form that
can be stored on the disc. These images can be edited before they are printed.

Digitizer
 Digitizer is an input device, which converts analog information into a digital form. Digitizer can
convert a signal from the television camera into a series of numbers that could be stored in a

3
Miss gwenzi form 1 notes
computer. They can be used by the computer to create a picture of whatever the camera had
been pointed at.
 Digitizer is also known as Tablet or Graphics Tablet because it converts graphics and pictorial
data into binary inputs. A graphic tablet as digitizer is used for doing fine works of drawing and
images manipulation applications.

Microphone
 Microphone is an input device to input sound that is then stored in digital form. The
microphone is used for various applications like adding sound to a multimedia presentation or
for mixing music.

Magnetic Ink Card Reader (MICR)


 MICR input device is generally used in banks because of a large number of cheques to be
processed everyday. The bank's code number and cheque number are printed on the cheques
with a special type of ink that contains particles of magnetic material that are machine readable.
 This reading process is called Magnetic Ink Character Recognition (MICR). The main advantage
of MICR is that it is fast and less error prone.

Optical Character Reader (OCR)


 OCR is an input device used to read a printed text. OCR scans text optically character by
character, converts them into a machine readable code and stores the text on the system
memory.

Bar Code Readers


 Bar Code Reader is a device used for reading bar coded data (data in form of light and dark
lines). Bar coded data is generally used in labelling goods, numbering the books, etc. It may be a
hand-held scanner or may be embedded in a stationary scanner.
 Bar Code Reader scans a bar code image, converts it into an alphanumeric value, which is then
fed to the computer to which bar code reader is connected.

Optical Mark Reader (OMR)


 OMR is a special type of optical scanner used to recognize the type of mark made by pen or
pencil. It is used where one out of a few alternatives is to be selected and marked. It is specially
used for checking the answer sheets of examinations having multiple choice questions.

4
Miss gwenzi form 1 notes

OUTPUT DEVICES
 They output work, which has been done by the computer in a form readable to users.
 Output devices provide output to the user, which is generated after processing the input data.
 Following are few of the important output devices, which are used in Computer Systems:
 Monitors
 Graphic Plotter
 Printer
Monitors
 Monitor commonly called as Visual Display Unit (VDU) is the main output device of a computer.
It forms images from tiny dots, called pixels, that are arranged in a rectangular form. The
sharpness of the image depends upon the number of the pixels.
 There are two kinds of viewing screen used for monitors:
 Cathode-Ray Tube (CRT)
 Flat-Panel Display

Cathode-Ray Tube (CRT) Monitor


In the CRT, display is made up of small picture elements called pixels for short. The smaller the
pixels, the better the image clarity or resolution. It takes more than one illuminated pixel to form
whole character, such as the letter 'e' in the word help.
There are some disadvantages of CRT:
 Large in Size
 High power consumption

Flat-Panel Display Monitor


The flat-panel display refers to a class of video devices that have reduced volume, weight and
power requirement compared to the CRT. You can hang them on walls or wear them on your wrists.
Current uses for flat-panel displays include calculators, video games, monitors, laptop computer,
graphics display.
The flat-panel display is divided into two categories:
 Emissive Displays - The emissive displays are devices that convert electrical energy into
light. Examples are plasma panel and LED (Light-Emitting Diodes).
 Non-Emissive Displays - The Non-emissive displays use optical effects to convert sunlight
or light from some other source into graphics patterns. Example is LCD (Liquid-Crystal
Device)

Plotters
Plotters are used to produce high quality line drawings.Most plotters are vector plotters. They
move a pen using point to point data.
Color vector plotters have a rack with several pens.

Advantages:
 Can handle large paper sizes
08/0322 FORM 1RED LESSON NOTES PRINTERS

5
Miss gwenzi form 1 notes

Printers
 Printer is the most important output device, which is used to print information on paper.
 There are two types of printers:
 Impact Printers
 Non-Impact Printers

Impact Printers
The printers that print the characters by striking against the ribbon and onto the paper, are called
impact printers.
Characteristics of Impact Printers are the following:
 Very low consumable costs
 Impact printers are very noisy
 Useful for bulk printing due to low cost
 There is physical contact with the paper to produce an image
These printers are of two types:
 Character printers
 Line printers
Character Printers:
Character Printers are printers, which print one character at a time.
These are of further two types:
 Dot Matrix Printer (DMP)
 Daisy Wheel
Dot Matrix Printer
In the market, one of the most popular printer is Dot Matrix Printer because of their ease of printing
features and economical price. Each character printed is in form of pattern of Dot's and head
consists of a Matrix of Pins of size (5*7, 7*9, 9*7 or 9*9) which comes out to form a character that is
why it is called Dot Matrix Printer.
Advantages
 Inexpensive
 Widely Used
 Other language characters can be printed
Disadvantages
 Slow Speed
 Poor Quality

Daisy Wheel
Head is lying on a wheel and Pins corresponding to characters are like petals of Daisy (flower
name) that is why it is called Daisy Wheel Printer. These printers are generally used for word-
processing in offices which require a few letters to be send here and there with very nice quality
representation.
Advantages
 More reliable than DMP's
 Better quality
 The fonts of character can be easily changed.
Disadvantages

6
Miss gwenzi form 1 notes
 Slower than DMP's
 Noisy
 More expensive than DMP's

Line Printers
Line printers are printers, which print one line at a time.

These are of further two types:


 Drum Printer
 Chain Printer
Drum Printer
This printer is like a drum in shape so it called drum printer. The surface of drum is divided into
number of tracks. Total tracks are equal to size of paper, i.e., for a paper width of 132 characters,
Drum will have 132 tracks. A character set is embossed on track. The different character sets
available in market are 48 character set, 64 and 96 characters set. One rotation of drum prints one
line. Drum Printers are fast in speed and prints between 300 to 2000 lines per minute.
Advantages
 Very high speed
Disadvantages
 Very expensive
 Characters fonts cannot be changed
Chain Printer
In this printer, chain of character sets is used so it is called Chain Printers. A standard character set
may have 48, 64, 96 characters.
Advantages
 Character fonts can easily be changed.
 Different languages can be used with the same printer.
Disadvantages
 Noisy
 Do not have the ability to print any shape of characters.

Non-impact Printers
The printers that print the characters without striking against the ribbon and onto the paper are
called Non-impact Printers. These printers print a complete page at a time, also called as Page
Printers.
These printers are of two types:
 Laser Printers
 Inkjet Printers
Characteristics of Non-impact Printers:

7
Miss gwenzi form 1 notes
 Faster than impact printers.
 They are not noisy.
 High quality.
 Support many fonts and different character size.

Laser Printers
 These are non-impact page printers.
 Laser printers fuse powdered ink/toner onto the paper by heat and pressure.

Advantages
 Very high speed.
 Very high quality output.
 Gives good graphics quality.
 Supports many fonts and different character sizes.
Disadvantages
 Running costs are higher than those of impacts printers
 Cannot be used to produce multiple copies of a document in a single printing.

Inkjet Printers
 Inkjet printers are non-impact character printers based on a relatively new technology.
 Ink jet printers work bydirecting a fine jet of ink at the paper.

Advantages:
 Low set up cost
 Quiet
 High quality printing
 More reliable
 Full colour capacity

Disadvantages:
 Slow print speed
 Printing consumables can be expensive
 Large areas of colour can warp the paper

Storage Devices
CD-ROM
Advantages:
 Good storage capacity

8
Miss gwenzi form 1 notes
 Modest transfer rate
 Fairly robust

Disadvantages:
 Only the manufacturer can store data
 Relatively large for the portable market

CD-R (WORM)
Allows data to be written once to the CD.

Advantages:
 Inexpensive method for data storage
 Can be read by CD-ROM drives
 Excellent for archiving

Disadvantages:
 Cannot be reused (although in some cases this may be an advantage)
 Capacity too small for entire HD backup

CD-RW
Can write data out several thousand times.

Advantages:
 Could be a replacement for a floppy disk

Disadvantages:
 Cannot be read by some older CD-ROM drives

DVD-ROM
Stores more using two layers on each side.

Advantages:
 Increased storage capacity
 Marginally faster data transfer than CD-ROM drives

Disadvantages:
 Cost of manufacture is higher (currently)

COMPUTER MEMORY
 A memory is just like a human brain. It is used to store data and instructions. Computer
memory is the storage space in computer where data is to be processed and instructions
required for processing are stored.
 The memory is divided into large number of small parts. Each part is called cell. Each location or
cell has a unique address, which varies from zero to memory size minus one.
 For example, if computer has 64k words, then this memory unit has 64 * 1024=65536 memory
location. The address of these locations varies from 0 to 65535.
Memory is primarily of three types:
 Cache Memory
 Primary Memory/Main Memory
 Secondary Memory

9
Miss gwenzi form 1 notes

Cache Memory
 Cache memory is a very high speed semiconductor memory, which can speed up CPU. It acts as
a buffer between the CPU and main memory.
 It is used to hold those parts of data and program which are most frequently used by CPU. The
parts of data and programs are transferred from disk to cache memory by operating system,
from where CPU can access them.
Advantage
 Cache memory is faster than main memory.
 It consumes less access time as compared to main memory.
 It stores the program that can be executed within a short period of time.
 It stores data for temporary use.
Disadvantage:
 Cache memory has limited capacity.
 It is very expensive.

Primary Memory (Main Memory)


 Primary memory holds only those data and instructions on which computer is currently
working. It has limited capacity and data gets lost when power is switched off.
 It is generally made up of semiconductor device. These memories are not as fast as registers.
The data and instructions required to be processed earlier reside in main memory. It is divided
into two subcategories RAM and ROM.
Characteristic of Main Memory
 These are semiconductor memories.
 It is known as main memory.
 Usually volatile memory.
 Data is lost in case power is switched off.
 It is working memory of the computer.
 Faster than secondary memories.
 A computer cannot run without primary memory.

Secondary Memory
 This type of memory is also known as external memory or non-volatile. It is slower than main
memory. These are used for storing Data/Information permanently.
 CPU does not directly access these memories; instead they are accessed via input-output
routines. Contents of secondary memories are first transferred to main memory and then CPU
can access it. For example, disk, CD-ROM, DVD, etc.
Characteristics of Secondary Memory
 These are magnetic and optical memories.
 It is known as backup memory.
 It is non-volatile memory.
 Data is permanently stored even if power is switched off.
 It is used for storage of the data in the computer.

10
Miss gwenzi form 1 notes
 Computer may run without secondary memory.
 Slower than primary memories.

RAM
A RAM constitutes the internal memory of the CPU for storing data, program and program result. It
is read/write memory. It is called random access memory (RAM).
Since access time in RAM is independent of the address to the word that is, each storage location
inside the memory is as easy to reach as other location & takes the same amount of time. We can
reach into the memory at random & extremely fast but can also be quite expensive.
RAM is volatile, i.e., data stored in it is lost when we switch off the computer or if there is a power
failure. Hence, a backup uninterruptible power system (UPS) is often used with computers. RAM is
small, both in terms of its physical size and in the amount of data it can hold.
RAM is of two types:
 Static RAM (SRAM)
 Dynamic RAM (DRAM)

Static RAM (SRAM)


The word static indicates that the memory retains its contents as long as power remains applied.
However, data is lost when the power gets down due to volatile nature. SRAM chips use a matrix of
6-transistors and no capacitors. Transistors do not require power to prevent leakage, so SRAM
need not have to be refreshed on a regular basis.
Because of the extra space in the matrix, SRAM uses more chips than DRAM for the same amount of
storage space, thus making the manufacturing costs higher.
Static RAM is used as cache memory needs to be very fast and small.
Characteristics of the Static RAM:
 It has long data lifetime
 There is no need to refresh
 Faster
 Used as cache memory
 Large size
 Expensive
 High power consumption
Dynamic RAM (DRAM)
DRAM, unlike SRAM, must be continually refreshed in order for it to maintain the data. This is done
by placing the memory on a refresh circuit that rewrites the data several hundred times per second.
DRAM is used for most system memory because it is cheap and small. All DRAMs are made up of
memory cells. These cells are composed of one capacitor and one transistor.
Characteristics of the Dynamic RAM:
 It has short data lifetime
 Need to refresh continuously
 Slower as compared to SRAM
 Used as RAM

11
Miss gwenzi form 1 notes
 Lesser in size
 Less expensive
 Less power consumption

ROM stands for Read Only Memory. The memory from which we can only read but cannot write on
it. This type of memory is non-volatile. The information is stored permanently in such memories
during manufacture.
A ROM stores such instructions as are required to start computer when electricity is first turned on,
this operation is referred to as bootstrap. ROM chip are not only used in the computer but also in
other electronic items like washing machine and microwave oven.

Following are the various types of ROM:


MROM (Masked ROM)
The very first ROMs were hard-wired devices that contained a pre-programmed set of data or
instructions. These kinds of ROMs are known as masked ROMs. It is inexpensive ROM.
PROM (Programmable Read only Memory)
PROM is read-only memory that can be modified only once by a user. The user buys a blank PROM
and enters the desired contents using a PROM programmer. Inside the PROM chip, there are small
fuses, which are burnt open during programming. It can be programmed only once and is not
erasable.
EPROM (Erasable and Programmable Read Only Memory)
The EPROM can be erased by exposing it to ultra-violet light for a duration of up to 40 minutes.
Usually, an EPROM eraser achieves this function. During programming, an electrical charge is
trapped in an insulated gate region. The charge is retained for more than ten years because the
charge has no leakage path. For erasing this charge, ultra-violet light is passed through a quartz
crystal window (lid). This exposure to ultra-violet light dissipates the charge. During normal use
the quartz lid is sealed with a sticker.
EEPROM (Electrically Erasable and Programmable Read Only Memory)
The EEPROM is programmed and erased electrically. It can be erased and reprogrammed about ten
thousand times. Both erasing and programming take about 4 to 10 ms (milli second). In EEPROM,
any location can be selectively erased and programmed. EEPROMs can be erased one byte at a time,
rather than erasing the entire chip. Hence, the process of re-programming is flexible but slow.
Advantages of ROM
 Non-volatile in nature
 These cannot be accidentally changed
 Cheaper than RAMs
 Easy to test
 More Reliable than RAMs
 These are static and do not require refreshing
 Its contents are always known and can be verified

Comparison of RAM and ROM


ROM RAM
Has permanent storage Has temporary storage
Occupies less capacity Occupies the largest capacity

12
Miss gwenzi form 1 notes
Not volatile Volatile (lose its content when there is a power
cut)
Cannot be altered Allows changes to be made

Cache memory
 Is a high speed memory mainly used to complement the RAM.
 Cache memory is faster than RAM and it stores frequently used pages.
 The cache memory is between the RAM and the CPU and the CPU searches for data or programs
in the cache first, if it’s not found, the CPU then searches in the RAM.
 The CPU uses certain algorithms to determine which data should be stored in the cache, which
will help the CPU to predict the next instruction to be executed and hence making processing
faster.

Virtual Memory
 It helps the computers RAM to be freed up with inactive applications to make way for loading
current applications being used.
 It works merely by checking for data stored in RAM not being used recently and have it stored
in the computer’s hard disk, thereby freeing useful space in RAM for loading other applications.

Secondary Storage
 Due to the fact that the primary storage is limited, in order to store massive programs and data,
the secondary storage is needed to supplement it
 Used when there is insufficient primary memory. Examples of secondary storage are CDs, DVDs,
memory sticks, memory cards etc

PRIMARY SECONDARY
Less storage capacity Extensive storage capacity
Volatile in nature Not volatile
Access speed is fast Access speed is slow
Expensive to purchase Cheaper to purchase
Usually not portable Portable (that is it can be carried from one
place to another)

PROCESSOR COMPONENTS
Central Processing Unit (CPU) or the processor is also often called the brain of computer. CPU
consists of Arithmetic Logic Unit (ALU) and Control Unit (CU) and registers.

ALU
 It performs the arithmetic and logic operations on the data that is made available to it.

13
Miss gwenzi form 1 notes
 It’s responsible for all mathematical operations.
 The arithmetic part is responsible for addition, subtraction, division and subtraction while the
logic part is responsible for comparison.

CU
 Is responsible for supervising the operations of the processor.
 CU controls and coordinates the activity of the other units of computer.
 Fetch, decode and execute jobs, thus retrieving instructions from memory and executing them
accordingly.

Registers
 Are temporary storage areas for holding data, and instructions?
 This is a storage location inside the processor.
 Registers in CU keep current instructions and the operands of instruction.
 There are also ALU registers that store data items that are to be added, subtracted, multiplied,
divided or compared.
 CPU uses the registers to store the data, or instructions during processing.
 Registers are very high-speed storage areas located inside the CPU.
 After CPU gets the data and instructions from the cache or RAM, the data and instructions are
moved to the registers for processing. Registers are manipulated directly by the control unit of
CPU during instruction execution. That is why registers are often referred to as the CPU’s
working memory.
 Since CPU uses registers for the processing of data, the number of registers in a CPU and the
size of each register affect the power and speed of a CPU.
 The more the number of registers (ten to hundreds) and bigger the size of each register (8 bits
to 64 bits), the better it is.

Structure of Processor

SOFTWARE

SOFTWARE
 This is a general term used to describe all the programs that run on a computer. A computer
system consists of hardware and software. The computer hardware cannot perform any task on
its own. It needs to be instructed about the tasks to be performed.
 Software is a set of programs that instructs the computer how tasks are to be performed.
 Software tells the computer how the tasks are to be performed and hardware carries out these
tasks.

14
Miss gwenzi form 1 notes

The hierarchy of software


An instruction is a step or statement to do a single task. Then program is a set of instructions to do a
given task. Finally software is a series of programs that run on a computer.
Instructio
ns

Programs

Software

Types of Software
Software can be broadly classified in two categories:
 System Software, and
 Application Software.

APPLICATION SOFTWARE
 Is the software that a user uses for completing a specific task i.e. it is user oriented
 Designed to carry out some tasks for the user that is primarily independent of computers such
as writing a letter
 A set of programs that are written for a specific purpose and provide the required functionality
is called software package.
 Application software is written for different kinds of applications—graphics, word processors,
media players, database applications, telecommunication, accounting purposes etc.
 Application software run under System Software, and are made to do a specific task i.e.
(WordProcessingetc), which have indirect access to the hardware (i.e. Behind System
Software).
 Examples are Web browsers, word processing software, spreadsheet software, database
software, presentation graphics software. Opera (Web Browser), Microsoft Word (Word
Processing), Microsoft Excel (Spreadsheet software), MySQL (Database Software), Microsoft
PowerPoint (Presentation Software), iTunes (Music / Sound Software), VLC Media Player
(Audio / Video Software ), World of Warcraft (Game Software), Adobe Photoshop (Graphics
Software).

General purpose or off-the-shelf package


 Pre-written software that provides approximate solutions to a range of different problems.

15
Miss gwenzi form 1 notes
 Many such packages can be tailored so that they can be adopted to fit a specific solution. For
example, word processors, spread sheets, database management systems, presentation
designers, etc.
 Also known as the generic software (or off the shelf)

Advantages
 They are generally cheaper to buy than bespoke packages which are to develop.
 They are available almost immediately.
 Any system bugs should have been discovered by other users and eliminated.
 These are written by software specialists and of a high quality.
 Good packages are likely to come with good training programs and well documentation.
 New updated versions of the software are likely to be available on a regular basis.
 The package can be used by large number of organizations.
 There are likely to be a number of people with expertise in the relevant package that are
already employed by the organization or who can be recruited, training is likely to be readily
available.
 The computer user doesn't need to employ his own specialist staff to develop, write, and test
the programs. It will save time and money.
 In-house tailored made development is only feasible for large organizations with their MIS
department.

Disadvantages
 The computer user gets a standardized solution to a data processing task.
 The standard solution may not fit precisely the needs of the organization.
 The users may need to compromise what they want with what is available.
 The organization is dependent upon an outside supplier for the maintenance, updating
updating and providing assistance in the event of problems of the software.
 Changing are not possible.

Types of Application Software:

WORD PROCESSING PACKAGE


Is used to create, view, edit, store and print text material.

Advantages
 Error detection and correction before producing a hardcopy.
 Automatic word wrap - any word that extends beyond the right margin is automatically moved
to the next line.
 Formatting and enhancing document presentation.
 Flexibility
 Inclusion of graphs within a document.
 Production of multiple copies.
 Mail Merging
 Electronic Filing.
 Electronic Transmission – emailing.

SPREADSHEETS
This is an electronic computer application which is used for budgeting, summaries of accounts,
stock level analysis and forecast planning.

16
Miss gwenzi form 1 notes

Advantages of using Electronic Spreadsheets


 Automatic Updating of Formula
It is easy to replicate formulas based on cell reference.
Changing any of the values will automatically update all the other hundreds of numbers that
depend on it.
 Editing Function
Blocks of text can be selected, moved, copied and deleted.
 Comprehensive Range of Functions
Most spreadsheets come with in-built functions for almost every mathematical, statistical
and logical computation.
 Viewing of figures in charts and graphs
Allows you to select data and then create graph based on that data.

Difference between a Workbook and a Worksheet


o A spreadsheet is made up of numbered rows and lettered columns.
o Each grid position is called a cell and can contain text, numbers or formula.
o Files created in Microsoft Excel are called Workbooks
o Inside workbooks are worksheets also known as spreadsheets?
o A worksheet is the primary document used to store and work with data .
o It consists of cells organized into rows and columns.

 Database Software: Allows users to store and retrieve vast amount of data. Example: MS
Access, MySQL, Oracle etc.
 Presentation Graphic Software: Allows users to create visual presentation. Example: MS
Power Point
 Multimedia Software: Allows users to create image, audio, video etc. Example: Real Player,
Media Player etc.

Applications are programs that you as the user use to perform specific tasks.
Word Processing. Enables users to create, edit, Microsoft Word 2010, Corel Word Perfect,
format and edit textual documents such as letters Lotus
Spreadsheet. Enables users to manipulate a table
Microsoft Excel 2010, Lotus 1-2-3, Corel
of data usually making numerical and business
Quattro Pro
calculations and projections
Database. Enables the user to create and maintain
Microsoft Access 2010, Microsoft Visual
a database in which data is organized for ease of
FoxPro, Lotus Approach
use and manipulation
Presentation Graphics. Enables users to create
images for group presentations, self-running slide Microsoft PowerPoint 2010, Lotus
shows and for other situations that require the Freelance Graphics, Corel Presentations
presentation of organized, visual information
Web Browsers. Enables users to view web pages
Microsoft Internet Explorer, FireFox
and allows for communication on the Internet
Photo-Editing. Enables users to edit, crop,
Adobe Photoshop, PhotoImpact, Microsoft
manipulate photos that were scanned in or
PictureIt
imported from a digital camera

Custom Made/Special Purpose Software:


 Custom made software is also called special purpose/ tailor made / bespoke software,

17
Miss gwenzi form 1 notes
 Is computer programs written to meet the processing needs of an individual or an organization.
 They are produced in-house or commissioned from an outside software company. Examples are
payroll, inventory, accounts, sales, production, marketing, etc.

Advantages
 The software is designed to meet what the user wants
 The software can be designed to run on specific hardware
 The system can be integrated with other applications within the organization.
 The system can be modified to fit changing needs.
 You will receive much better support and can in many cases talk directly to the developers
concerned
 The use of professionally developed bespoke software applications can give you a significant
business advantage over your competition

Disadvantages
 Development takes a long time.
 Delays the implementation of the system.
 Costly to develop and test.
 Greater probability of bugs.
 May be poorly documented..
 It can be difficult to get support for bespoke software, unless the developers themselves offer
support services.

NB System software: controls the operations of the computer (computer oriented) and application
software perform user required functions (user oriented)

SYSTEM SOFTWARE
 The set of programs needed to control and monitor the operation of the hardware (and
applications software) of a computer.
 System software is a collection of programs which control the overall function of the computer.
 Software is program that acts as an interface between the user and the computer
 Is a set of computer programs that manage the hardware and software resources of a computer
so that they can work together harmoniously?
 System software is required for the working of computer itself.
 The user of computer does not need to be aware about the functioning of system software,
while using the computer
 System Software has direct control and access to computer hardware, and memory locations i.e.
it is computer oriented
 Examples Unix, Linux, Windows, DOS and Windows NT

Utility software
Is system software designed to help analyze, configure, optimize or maintain a computer?
Performance monitoring programs can also be classified as utility software – this is software that is
used to monitor disk, memory and processor use. Utility programs are generally fairly small. Each
type has a specific job to do. Below are some descriptions of utilities:

Anti-virus applications
 Protect your computer from the damage that can be caused by viruses and similar programs.

18
Miss gwenzi form 1 notes
 Virus scanning software iscriticalto use, due to the number of computer viruses (small
computer programs created to disrupt and destroy computer files and/or operating system
software).
 Virus scanning software needs to be updated on a regular basis (usually monthly). Updates
insure that your virus scanning software will protect you from the most recent viruses.

File Compression utilities


 Make files smaller for storage (or sending over the Internet) and then return them to normal
size.

Disk cleaners
 Can find files that are unnecessary to computer operation, or take up considerable amounts of
space.
 Disk cleaner helps the user to decide what to delete when their hard disk is full.

Disk compression utilities


 Can transparently compress/uncompress the contents of a disk, increasing the capacity of the
disk.
Disk defragmenters
 Reorganize the data stored on disks so that it is more efficiently arranged. Can detect computer
files whose contents are broken across several locations on the hard disk, and move the
fragments to one location to increase efficiency.
 Disk Defragmenter software assists you to keep reorganizing your disk drives. After files are
saved, deleted and resaved again, the disk can become fragmented --- available space is in small
blocks located throughout the disk.
 Disk defragmenters gather those free spots and put them together to enable you to continue to
save your data in the most efficient manner.

Disk partitions
 Can divide an individual drive into multiple logical drives, each with its own file system which
can be mounted by the operating system and treated as an individual drive.

Registry cleaners
 Clean and optimize the Windows registry by removing old registry keys that are no longer in
use.

Hardware represents the physical and tangible components of the computer, i.e., the components
that can be seen and touched.
Examples of Hardware are following:
 Input devices -- keyboard, mouse, etc.
 Output devices -- printer, monitor, etc.
 Secondary storage devices -- Hard disk, CD, DVD, etc.
 Internal components -- CPU, motherboard, RAM, etc.

19
Miss gwenzi form 1 notes

Relationship between Hardware and Software


 Mutually dependent. Both of them must work together to make computer produce a useful
output.
 Software cannot be utilized without supporting hardware.
 Hardware without set of programs to operate upon cannot be utilized and is useless.
 To get a particular job done on the computer, relevant software should be loaded into the
hardware.
 Hardware is a onetime expense.
 Software development is very expensive and is a continuing expense.
 Different softwares can be loaded on hardware to run different jobs.
 Software acts as an interface between the user and the hardware.
 If hardware is the 'heart' of a computer system, then software is its 'soul'. Both are
complimentary to each other.

Software is a set of programs, which are designed to perform a well-defined function. A program is
a sequence of instructions written to solve a particular problem.
There are two types of softwares:
 System Software
 Application Software

System Software
The system software is a collection of programs designed to operate, control and extend the
processing capabilities of the computer itself. System software are generally prepared by computer
manufacturers.
These softwares comprise of programs written in low level languages which interact with the
hardware at a very basic level. System software serves as the interface between hardware and the
end users.
Some examples of system software are Operating System, Compilers, Interpreter, Assemblers, etc.

Features of System Software are the following:


 Close to system (computer oriented).
 Fast in speed.
 Difficult to design.
 Difficult to understand.
 Less interactive.
 Smaller in size.

20
Miss gwenzi form 1 notes
 Difficult to manipulate.
 Generally written in low-level language.

Application Software
Application softwares are the softwares that are designed to satisfy a particular need of a particular
environment. All softwares prepared by us in the computer lab can come under the category of
Application Software.
Application software may consist of a single program, such as a Microsoft's notepad for writing and
editing simple text. It may also consist of a collection of programs, often called a software package,
which work together to accomplish a task, such as a spreadsheet package.
Examples of Application softwares are the following:
 Payroll Software
 Student Record Software
 Inventory Management Software
 Income Tax Software
 Railways Reservation Software
 Microsoft Office Suite Software
 Microsoft Word
 Microsoft Excel
 Microsoft Powerpoint

Features of Application Software are the following:


 It is close to user (user oriented).
 It is easy to design.
 More interactive.
 Slow in speed.
 Generally written in high-level language.
 Easy to understand.
 Easy to manipulate and use.
 Bigger in size and requires large storage space.

OPERATING SYSTEM
 Is a part of system software
 The operating system is an integrated set of programs that is used to control and manage the
resources and overall operations of a computer.
 The Operating System is the software that controls the operation of the hardware and hides its
complexities from the user.
 Is a program which monitors, controls and maintains the computer.
 Intermediates between the user of computer and the computer hardware. For example, the user
gives a command and the OS translates the command into a form that the machine can
understand and execute.
 It hosts the several applications that run on a computer and handles the operations of computer
hardware.

21
Miss gwenzi form 1 notes
 OS acts as an interface between the application programs and the machine hardware.
 Examples Windows, Linux, UNIX and Mac OS

Objectives of Operating System


 To make the computer system convenient and easy to use, OS hides the working of the
hardware from the user and makes it convenient for the user to use the machine.
 To use the computer hardware in an efficient way, by handling the details of the operations of
the hardware.

Functions of OS
Operating system is large and complex software consisting of several components. Each component
of the operating system has its own set of defined inputs and outputs. Different components of OS
perform specific tasks to provide the overall functionality of the operating system . Main functions
of the operating system are as follows:

 Memory Management
 It keeps track of primary memory, i.e., what parts of it are in use by whom, what parts are
not in use, etc.
 Allocates the memory when the process or program requests it.
 Processor Management
 Allocates the processor (CPU) to a process.
 De-allocate processor when processor is no longer required.
 Device Management
 Keeps tracks of all devices. This is also called I/O controller.
 Decides which process gets the device when and for how much time.
 File Management
 Allocates the resources.
 Deallocates the resource.
 Decides who gets the resources.
 Security
 By means of passwords & similar other techniques, preventing unauthorized access to
programs & data.
 Job accounting
 Keeping track of time & resources used by various jobs and/or users.
 Control over system performance
 Recording delays between requests for a service & from the system.
 Error handling
 An operating system responds to errors. When an error occurs, operating system must take
appropriate actions.
 The operating system should be able to ‘freeze’ the program that causes an error and
display a message to the end user.
 User InterfaceorCommand Interpreter— Operating system provides:
 The user interface via which the user interacts with the applications and the hardware.
 Communication management:
 The OS ensure communication between computers linked together in a LAN or WAN
 Interprets commands for downloading and uploading

Types of OS
OS are classified into different types depending on their capability of processing:
1. Single UserOS

22
Miss gwenzi form 1 notes
 Provides a platform for only one user at a time.
 No user accounts are required since it support one user.
 Single operating system designed to manage one task at a time, for example, if the user is
editing a document, then a document cannot be printed on the printer simultaneously.
 MS-DOS is an example of single user OS.
2. Multitasking OS
 Allows execution of more than one task or process concurrently. Thus they can perform
multiple tasks simultaneously
 The processor time is divided amongst different tasks. This division of time is also called
time sharing.
 The processor switches rapidly between processes. For example, the user can listen to
music on the computer while writing an article using word processor software.
 The user can switch between the applications and also transfer data between them
 Windows 95 and all later versions of Windows are examples of multitasking OS.
3. MultiuserOS
 Support two or more users simultaneously.
 Is used in computer networks that allow same data and applications to be accessed by
multiple users at the same time.
 Provides regulated access for a number of users by maintaining a database of known users.
The users can also communicate with each other.
 Linux, UNIX, and Windows 7 are examples of multiuser OS.
4. Batch OS
 In a batch OS a job runs from beginning to end without intervention from the user
 The running of batch jobs is normally controlled by a program written in Job Control
Language (JCL)
 Is software which replicates identical jobs over and over again?
 A batch operating system keeps itself eventful; it does this by taking jobs from a batch
queue, instead of waiting for people to submit jobs.
 Batch processing is typically used for: • processing OMR forms such as those that contain
answers to a multiple-choice exam; • payroll; • utility billing.
5. Networking OS
 Also referred to as the Dialoguer,
 A network operating system (NOS) is one that is able to share its resources (such as hard
disk or printer) and use the resources of others.
 Is the software that runs on a server and enables the server to manage data, users, groups,
security, applications, and other networking functions?
 The network operating system is designed to allow access to shared files and printers
among multiple computers in a network, typically a local area network (LAN), a private
network or to other networks.
 The most popular network operating systems are MicrosoftWindows Server 2003,
MicrosoftWindows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.

6. Real Time OS
 Are designed to respond to an event within a predetermined time.
 Data input to the computer is processed immediately
 Processing is done within a time constraint.
 Deal with events which happen at unpredictable moments in time;
 Deal with multiple events that occur simultaneously;
 Support application programs which are non-sequential in nature
 Examples of real-time operating systems: • Airline flight reservation; • Missile guidance; •
Temperature/pressure control; • Process control.

23
Miss gwenzi form 1 notes
Operating System Comparison
 An OS is a fundamental component of a computer system that manages activities and resources
on the machine.
 There are essentially four operating systems commonly used today: DOS, Linux, Windows and
Mac OS X.

LINUX

 Majority of Linux variants are available for free


 Linux variants and versions are extremely reliable and can often run for months and years
without needing to be rebooted.
 Linux is a cross-platform operating system. It runs on many computer models.
 Linux is a very secure operating system.
 Linux is a complete operating system that is stable
 Difficult to use than windows
 Linux is one of the best operating systems in terms of networking.
 Many of the Linux variants are open source and enable users to customize or modify the code.
 Linux is a multi-tasking system. It means that a single user can run multiple concurrently.
 Multi-User: can support 2 or more users at the same time

WINDOWS

 Windows is more expensive than Linux


 Windows is easier to use than Linux.
 Less reliable than Linux
 Windows has a much larger support for hardware devices
 Windows is insecure since it is vulnerable to viruses and other attacks.
 Majority of Windows programs are not open source.
 Microsoft Windows includes its own help section, has vast amount of available online
documentation and help
 Windows is a multitasking operating system. A user can execute multiple tasks at the same
time.
 Multiprocessing: multiple programs are executed on different processors at the same time.
 Windows is a multi-user operating system as it allows multiple users to use the same computer
at the same time.
 Plug and Play: windows automatically detect and configure new devices when they are
connected to the computer.

Mobile Operating System


Symbian
 Is a mobile operating system designed for smart phones and currently maintained by
Accenture.
 Runs exclusively on ARMprocessors.
 It was the most popular Smartphone OS on a worldwide until the end of 2010, when it was
overtaken by Android, although in some developing nations, Symbian is still the biggest.
 Symbian source code is not an open source and its licensed

24
Miss gwenzi form 1 notes
 Multitasking since it allows use of more than one application at a time
 It has a high Java support, thus, giving an ultimate/crucial gaming experience to users. Symbian
smoothly displays games without any buffering like in most online games.
 In contrast, this OS does not work well when it comes to downloading games, although it is
more preferred for online gaming.
 The Symbian OS, on the other hand, does not have an integrated network accelerator for clearer
video calling.
 Symbian-powered smart phones, such as the Nokia N8, have been reported to attain certain
glitches when opening large web files.
 The Symbian browser, on the other hand, could only download one file at a time
 Symbian based handsets offers good multimedia features.

Android
 Android is the version of Google's mobile operating system
 Android software runs on tablet computers and smart phones
 It can support multiple users without the need for logging out.
 It has smart keyboard with gesture typing.
 Its multitasking
 Wireless display of images and videos on big-screen HDTVsets.(High Definition Television Sets)
 Instant processor acceleration when users touch the screen.
 Wireless image and video sharing among multiple units in close proximity.
 Automatic resizing and relocation of screen widgets for optimum display readability.
 Enhanced screen magnification functions.
 Support continuous information updates (news, weather, travel data, etc.) through Google.
 Voice-activated Web search with support for more than 30 languages.
 Photo sphere camera for creating navigable panoramic images encompassing all directions in
3D space.
 Android has a wide array of features, Optimized graphic, Accelerometer, Compass, GPS, and
several applications like maps, calendar, email client, contacts, and Java programming. It also
supports videos, still images, common audio files, and other complicated formats.
 Android have a very poor support for Web games, making it quite unusable for online playing
 Android is easy to use and has a non-complex interface.
 Android-powered handsets have support for wireless Internet

User Interfaces
 Is a way in which human and computer communicate
 The type of user interface that is used on a computer system is determined by the operating
system. For example most programs that run on computers using a Microsoft Windows
operating system have a graphical user interface.

The users can interact with the computer using the following interfaces:
 Command Line Interface (CLI)
 Graphical User Interface (GUI)
 Job Control Language

Command line interface


 Allow the user to interact directly with the computer system by typing in commands
(instructions) using a keyboard.
 MS-DOS and Linux shell are examples of command line mode of interfaces

Advantages

25
Miss gwenzi form 1 notes
 Quicker since it does not use as much CPU processing time as others
 Greater variety of commands
 Use less memory
 A low resolution, cheaper monitor can be used with this type of interface
 Very flexible with the use of “switches” (options)
 More useful error messages

Disadvantages
 Not user friendly
 Difficult for beginner
 Requires the user to learn “complex” commands or language
 Commands have to be typed precisely. If there is a spelling error the command will fail

Command Line Interface Applications


*Ideal for visually impaired users!!!

WIMP /Graphical user interface


 User interacts with system using windows, icons, menus and a pointer to control the operating
system.
 Selection is achieved by moving a pointer with a mouse and clicking a mouse button
 “Windows 7” and “Mac OS 10” are examples of graphical mode of interface

Advantages
 easier for novices to use since its more intuitive
 only valid options are available
 consistency of layout and command representation in applications
 comprehensive on-line help available
 You get the benefits of WYSIWYG.This stands for What You See Is What You Get.
 This interface can also open multiple sessions in multiple windows and put them next to each
other on the computer screen

Disadvantages
 They need significantly more memory (RAM) to run than other interface types
 requires more powerful processor and better graphics display
 slower when executing a command because much more interpretation takes place
 can be irritating for simple tasks because greater number of operations are required

Job control language


 User has no direct interaction with the computer system.
 User prepares a series of instructions off-line using JCL to describe to the system the
requirements of the task.
 After execution, results are made available via an off-line medium e.g. line printer paper
 JCL specifies:
o who owns the job
o job priority
o maximum processor time to allow job
o maximum lines to be printed
o names of files to be used
o resources to be used e.g. magnetic tape, compiler/interpreter

26
Miss gwenzi form 1 notes
what to do if program fails

APPLICATION OF COMPUTERS AND THEIR SOCIAL AND ECONOMIC IMPLICATIONS

APPLICATION OF COMPUTERS
Business
Computer is used in business organisation for:
 Payroll Calculations
 Budgeting
 Sales Analysis
 Financial forecasting
 Managing employees database
 Maintenance of stocks, etc.

Banking
Banks provide following facilities:
 Bank on-line accounting facility, which includes current balances, deposits, overdrafts,
interest charges, shares and trustee records.
 ATM machines are making it even easier for customers to deal with banks.

27
Miss gwenzi form 1 notes
 Electronic funds transfer (EFT)the process by which money is transferred from one bank
account to another, by computer
 Electronic funds transfer at the point of sale (EFTPOS)The process by which money is
transferred at the checkout from a customer’s bank account to the shop’s bank account, by
computer

Insurance
Insurance companies are keeping all records up-to-date with the help of computers. The Insurance
Companies, Finance houses and Stock broking firms are widely using computers for their concerns.
Insurance Companies are maintaining a database of all clients with information showing:
 how to continue with policies
 starting date of the policies
 next due installment of a policy
 maturity date
 interests due
 survival benefits
 bonus

Education
The computer has provided a lot of facilities in the Education System.
 The uses of computer provide a tool in the Education system known as CBE (Computer
Based Education).
 CBE involves Control, Delivery and Evaluation of learning.
 The computer education is very familiar and rapidly increasing the graph of computer
students.
 There are number of methods in which educational institutions can use computer to
educate the students.
 It is used to prepare a database about student performance and analyses are carried out.
 Computer-assisted learning (CAL) The process of using computers to learn at a self-paced
rate from presentations, oft en with computer-based assessment questions and feedback of
results.
 Computer-based learning The use of computers for interactive learning activities, including
computer assisted learning and computer-based training.
 Computer-based training (CBT) Similar to computer assisted learning, but usually for
training in work skills rather than academic learning.

Marketing
In Marketing uses of computer are following:
 Advertising: With computers, advertising professionals create art and graphics, write and
revise copy, and print and disseminate adverts with the goal of selling more products.
 At Home Shopping: Home shopping has been made possible through use of computerized
catalogues that provide access to product information and permit direct entry of orders to
be filled by the customers.
 E-commerceThe use of the Internet for commercial activities such as Internet banking and
shopping.

E-commerce can be divided into:


o E-tailing or "virtual storefronts" on Web sites with online catalogues, sometimes gathered
into a "virtual mall"
o The gathering and use of demographic data through Web contacts

28
Miss gwenzi form 1 notes
o Electronic Data Interchange (EDI), the business-to-business exchange of data
o E-mail and fax and their use as media for reaching prospects and established customers (for
example, with newsletters)
o Business-to-business buying and selling
o The security of business transactions

Health Care
The computers are being used in hospitals to keep the record of patients and medicines. It is also
used in scanning and diagnosing different diseases. ECG, EEG, Ultrasounds and CT Scans, etc., are
also done by computerized machines.
Some of major fields of health care in which computers are used:
 Diagnostic System: Computers are used to collect data and identify cause of illness.
 Lab-diagnostic System: All tests can be done and reports are prepared by computer.
 Patient Monitoring System: These are used to check patient's signs for abnormality such
as in Cardiac Arrest, ECG, etc.
 Pharmacy Information System: Computer checks Drug-Labels, Expiry dates, harmful drug
side effects, etc.
 Nowadays, computers are also used in performing surgery.

Engineering Design
Computers are widely used in engineering purposes. One of major areas is CAD (Computer aided
design). CAD provides creation, edition, and modification of image. Some fields are:
 Structural Engineering: computers are used for stress and strain analysis required for
design of Ships, Buildings, Budgets, Airplanes, etc.
 Industrial Engineering: Computers deal with design, implementation and improvement of
Integrated systems of people, materials and equipment’s.
 Architectural Engineering: Computers help in planning towns, designing buildings,
determining a range of buildings on a site using both 2D and 3D drawings.
 Computer-aided design (CAD) The process of using a computer to design an item.
 Computer-aided engineering (CAE) The process of using computer simulation to check
the design of a structure before construction or manufacture.
 Computer-aided manufacture (CAM) The process of using a computer to control the
automatic manufacture of an item.

Military
Computers are largely used in defense. Modern tanks, missiles, weapons, etc., employ computerized
control systems. Some military areas where a computer has been used are:
 Missile Control
 Military Communication
 Military operation and planning

Communication
Communication means to convey a message, an idea, a picture or speech that is received and
understood clearly and correctly by the person for whom it is meant. Some main areas in this
category are:
 E-mail
 Chatting
 Usenet
 FTP

29
Miss gwenzi form 1 notes
 Telnet
 Video-conferencing

Government Applications
Computers play an important role in government applications. Some major fields in this category
are:
 Budgets
 Sales tax department
 Income tax department
 Male/Female ratio
 Computerization of voters lists
 Computerization of Driving Licensing system
 Computerization of PAN card
 Weather Forecasting.

SOCIAL AND ECONOMIC CHANGES OR EFFECTS ON PEOPLE AND ORGANISATIONS BROUGHT


BY COMPUTERS.

Some social effects on people are:


 People work in good working environments.
 People are productive, able to do more work in less time.
 People lose their jobs because of robots and computers.
 Cashless society - people can buy goods and services through credit cards and mobile phones.
 Children are addicted to playing computer games.
 Loss of privacy - governments and businesses can track people's activities on the internet.
 Technology gap - the poor, illiterate and old people have little opportunity to use technology.
 People are too dependent on technology for almost all things.
 People live a fast-pace or hectic life; they have to learn and process more information; some
work at odd hours.
 People work from home.

Some economic effects on organisations are:

 High productivity - factories are able to produce more goods in less time.
 De-skilling - organizations use computers and software to do skilled work, no longer
 Relying on experts.
 Companies save money by out-sourcing jobs or re-siting operations to other countries.

Some negative effects of computers are:

 People lose their jobs because of robots and computers.


 People live a fast-pace and stressful life; they have to retrain regularly; they work odd hours.
 People lose their privacy; governments can track people's activities on the internet.
 Children are addicted to computer games.
 Poor and illiterate people are unable to benefit from technology.

Advantages of using Computers


 Computers reduce or eliminate jobs that are repetitive e.g. retyping a document to correct
spelling mistakes.
 With the use of a computer work can be completed faster, more easily and more accurately.
 They also produce more professional output by use of word processing and graphics.

30
Miss gwenzi form 1 notes
 Allow faster retrieval of information that would take a long time, or be impossible with manual
searching.

Disadvantages of using computers


 Unemployment – jobs eliminated due to changes in technology.
 No guarantee of security as more and more people are learning skills required to program,
penetrate and manipulate computer systems.

DATA STRUCTURES, TYPES AND REPRESENTATIONS

DATA STRUCTURE
 Data Structure is a way of storing and organizing data, effectively.
 There are two major categories of Data Structures called ˜’Static Structures’ and ‘˜Dynamic
Structures’. Each has its own set of advantages and disadvantages.

Static Data Structures


 As the word static suggests, static data structures are designed to store static “set of data”.
 However, static “set of data”, doesn’t mean that we cannot change the assigned values of
elements. It is the memory size allocated to “data”, which is static.
 Static data structure is given a fixed area of memory which it can operate within.
 Memory is allocated at compile time and it’s of fixed.
 Since the memory is fixed, there will be the will be no problem with adding and removing data
types
 Can be very inefficient as the memory for the data structure has been set aside regardless of
whether it is needed or not whilst the program is executing.
 Easier to program as there is no need to need to check on data structure size at any pointer.
 It is not possible to expand this fixed size in the run time, so that, locations of each element is
fixed and known by the program.

Dynamic Data Structures


 Dynamic data structures are designed to facilitate chajnge of data structures in the runtime.
 It is possible to change the assigned values of elements, as it was with static structures.
 Memory is allocated to the data structure dynamically i.e. as the program executes
 Because the memory allocation is dynamic, it is possible for the structure to “overflow’ or
‘underflow’.
 Makes the most efficient use of memory as the data structure only uses as much memory as it
needs.
 Harder to program as the software needs to keep track of its size and data item locations at all
times.
 Also, in dynamic structures the initially allocated memory size is not a problem. It is possible to
add new elements, remove existing elements or do any kind of operation on data set without
considering about the memory space allocated initially.

31
Miss gwenzi form 1 notes
Data types
A data type is a method of interpreting a pattern of bits.

Intrinsic/Built in data types


 Intrinsic data types are the data types that are defined within a particular programming
language.
 There are many different data types and are used to make the storage and processing of data
easier and more efficient.
 Different databases and programming systems have their own set of intrinsic data types, but
the main ones are:
o Integer;
o Real;
o Boolean;
o String;
o Character;

Integer
 An integer is a positive or negative number that does not contain a fractional part.
 Integers are held in pure binary for processing and storage. Note that some programming
languages differentiate between short and long integers (more bytes being used to store long
integers).
 In REALbasic an integer uses 4 bytes of memory – this allows it to take a whole number value
between ± 2, 147, 483, 648.

Real
 A real is a number that contains a decimal point.
 In many systems, real numbers are referred to as singles and doubles, depending upon the
number of bytes in which they are stored.
 In REAL basic, a single uses 4 bytes of memory and can have a value between –1.175494 e-38
and 3.402823 e+38; a double uses 8 bytes of memory and can have a value between
2.2250738585072013 e-308 and 1.7976931348623157 e+308.

Boolean
 A boolean is a data-type that can store one of only two values – usually these values are True or
False.
 Booleans are stored in one byte – True being stored as 11111111 and False as 00000000.
 Many of the properties of objects (windows, text-boxes, buttons etc.) in REAL basic have
Boolean values – e.g. the visibility of an object will be set to either True (visible) or false
(Hidden). These values are often set using check-boxes.

String
 A string is a series of alphanumeric characters enclosed in quotation marks.
 A string is sometimes just referred to as ‘text’. Any type of alphabetic or numeric data can be
stored as a string: “Harare City”, “3/10/03” and “36.85” are all examples of strings.
 Each character within a string will be stored in one byte using its ASCII code; modern systems
might store each character in two bytes using its Unicode.
 The maximum length of a string is limited only by the available memory.

Notes:
• If dates or numbers are stored as strings then they will not be sorted correctly; they will be sorted
according to the ASCII codes of the characters – “23” will be placed before “9”;

32
Miss gwenzi form 1 notes
• Telephone numbers must be stored as strings or the leading zero will be lost.

Character
 A character is any letter, number, punctuation mark or space, which takes up a single unit of
storage (usually a byte).

Benefits of defined data-types


Whether intrinsic or user-defined, the use of data-types within a programming language:
o enable the compiler to reserve the correct amount of memory for the data – e.g. 4 bytes for an
integer;
o trap errors that a programmer has made and errors that a user of a program can make – a
variable defined as an integer cannot be given a fractional value;
o restrict the values that can be given to the data – a Boolean cannot be given the value “maybe”;
o restrict the operations that can be performed on the data – a string cannot be divided by 10.

MEMORY UNITS
 It is the amount of data that can be stored in the storage unit.
 The storage capacities are expressed in terms of Bytes.
Following are the main memory storage units:

Unit Description
Bit (Binary A binary digit is logical 0 & 1 representing a passive or an active state of a
Digit) component in an electric circuit.
Nibble A group of 4 bits is called nibble.
A group of 8 bits is called byte. A byte is the smallest unit, which can represent
Byte
a data item or a character.
A computer word like a byte, is a group of fixed number of bits processed as a
unit which varies from computer to computer but is fixed for each computer.
Word The length of a computer word is called word-size or word length and it may be
as small as 8 bits or may be as long as 96 bits.
A computer stores the information in the form of the computer words.

Higher storage units


Unit Description
1 KB = 1024
Kilobyte (KB)
Bytes
Megabyte (MB) 1 MB = 1024 KB
GigaByte (GB) 1 GB = 1024 MB
TeraByte (TB) 1 TB = 1024 GB
PetaByte (PB) 1 PB = 1024 TB

FUNDAMENTALS OF DATA REPRESENTATION: BINARY NUMBER SYSTEM


As a computer programmer or an IT professional, you should understand the following number
systems, which are frequently used in computers.

Number System & Description


1 Binary Number SystemBase 2. Digits used: 0, 1
2 Octal Number SystemBase 8. Digits used: 0 to 7

33
Miss gwenzi form 1 notes
3 Decimal Number SystemBase 10. Digits used: 0 to 9
Hexa Decimal Number SystemBase 16. Digits used: 0 to 9, Letters
4
used: A- F

Binary Number System


Characteristics
 Uses two digits, 0 and 1.
 Also called base 2 number system.
 Each position in a binary number represents a 0 power of the base (2). Example, 2 0.
 Last position in a binary number represents a x power of the base (2). Example, 2 x where x
represents the last position - 1.

Example
Binary Number: 101012
Calculating Decimal Equivalent:
Step Binary Number Decimal Number
1 101012 ((1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10
2 101012 (16 + 0 + 4 + 0 + 1)10
3 101012 2110
Note: 101012is normally written as 10101.

Octal Number System


Characteristics
 Uses eight digits: 0, 1, 2, 3, 4, 5, 6, 7.
 Also called base 8 number system.
 Each position in a octal number represents a 0 power of the base (8). Example, 8 0.
 Last position in a octal number represents a x power of the base (8). Example, 8 x where x
represents the last position - 1.

Example
Octal Number: 125708
Calculating Decimal Equivalent:
Step Octal Number Decimal Number
((1 x 84) + (2 x 83) + (5 x 82) + (7 x 81) + (0 x
1 125708
80))10
2 125708 (4096 + 1024 + 320 + 56 + 0)10
3 125708 549610
Note: 125708is normally written as 12570.

Hexadecimal Number System


Characteristics
 Uses 10 digits and 6 letters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
 Letters represent numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E = 14, F = 15.
 Also called base 16 number system.
 Each position in a hexadecimal number represents a 0 power of the base (16). Example, 16 0.
 Last position in a hexadecimal number represents a x power of the base (16). Example, 16 x
where x represents the last position - 1.
Example
Hexadecimal Number: 19FDE16

34
Miss gwenzi form 1 notes
Calculating Decimal Equivalent:
Ste Hexadecimal
Decimal Number
p Number
((1 x 164) + (9 x 163) + (F x 162) + (D x 161) +
1 19FDE16
(E x 160))10
((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161)
2 19FDE16
+ (14 x 160))10
3 19FDE16 (65536+ 36864 + 3840 + 208 + 14)10
4 19FDE16 10646210
Note: 19FDE16 is normally written as 19FDE.

Hexadecima Octal
Binary Denary
l
0 0000 000 0
1 0001 001 1
2 0010 010 2
3 0011 011 3
4 0100 100 4
5 0101 101 5
6 0110 110 6
7 0111 111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15

Conversion of binary to decimal (base 2 to base 10)


Example: convert (1000100)2 to decimal
= 64 + 0 + 0+ 0 + 4 + 0 + 0
= (68)10

Conversion of decimal to binary (base 10 to base 2)


Example: convert (68)10 to binary
68/¸2 = 34 remainder is 0
34/ 2 = 17 remainder is 0
17 / 2 = 8 remainder is 1
8 / 2 = 4 remainder is 0
4 / 2 = 2 remainder is 0
2 / 2 = 1 remainder is 0
1 / 2 = 0 remainder is 1
Answer = 1 0 0 0 1 0 0
Note: the answer is read from bottom (MSB) to top (LSB) as 10001002

Converting from Binary to Hexadecimal


Step 1 0111 0101

35
Miss gwenzi form 1 notes
Divide the binary number into groups of four digits
starting at the LSB.
Step 2
Write down the hexadecimal equivalent for each group of 7 5
digits.
011101012 = 7516
Conversion of binary to octal and hex
Conversion of binary numbers to octal and hex simply requires grouping bits in the binary numbers
into groups of three bits for conversion to octal and into groups of four bits for conversion to hex.
Groups are formed beginning with the LSB and progressing to the MSB.
Thus, 11 100 1112 = 3478
11 100 010 101 010 010 0012 = 30252218
1110 01112 = E716

1 1000 1010 1000 01112 = 18A8716

Conversion of decimal to hex (base 10 to base 16)


Example: convert (4768)10 to hex.
= 4768 / 16 = 298 remainder 0
= 298 / 16 = 18 remainder 10 (A)
= 18 / 16 = 1 remainder 2
= 1 / 16 = 0 remainder 1
Answer: 1 2 A 0
Note: the answer is read from bottom to top, same as with the binary case.

Octal Numbers (Base 8)


In the octal number system there are only eight different symbols.

Converting Binary to Octal


Step 1
Divide the binary number into groups of three digits 111 101
starting at the LSB.
Step 2
Write down the hexadecimal equivalent for each group of 7 5
digits.
111 1012 = 758
Converting Octal To Denary
To perform this operation we use the same method as for converting a binary number to decimal.
However the column headings are in powers of eight, not two.

Binary Coded Decimal


This variation of binary allows denary digits to be encoded separately.
E.g. 271910is represented by:
2 7 1 9
0010 0111 0001 1001
271910 = 0010 0111 0001 1001BCD
Advantages

36
Miss gwenzi form 1 notes
 Easy to convert binary to BCD.
 No error due to round off.

Disadvantages
 Occupies more memory.
 Can be harder to perform arithmetic operations.

Conversion of octal to decimal (base 8 to base 10)


Example: convert (632)8 to decimal
= (6 x 82) + (3 x 81) + (2 x 80)
= (6 x 64) + (3 x 8) + (2 x 1)
= 384 + 24 + 2
= (410)10

Conversion of decimal to octal (base 10 to base 8)


Example: convert (177)10 to octal
177 / 8 = 22 remainder is 1
22 / 8 = 2 remainder is 6
2 / 8 = 0 remainder is 2
Answer = 2 6 18

Note: the answer is read from bottom to top as (261) 8, the same as with the binary case. Conversion
of decimal fraction to octal fraction is carried out in the same manner as decimal to binary except
that now the multiplication is carried out by 8.

Representing Fractions or Real Numbers in Binary


 The decimal number 1.625 can be represented in binary as 1.101. The principal is similar to
that of whole decimal numbers being represented in binary. The binary number that is stored
consists of a decimal point which remains fixed.
 The bits to the right of it represent fractions halving in magnitude from left to right (1/2, 1/4,
1/8 etc...). The bits to the left of the decimal point represent whole numbers as normal.
 To convert a decimal fraction to binary, the following steps can be carried out:
 The decimal number is multiplied by 2 to give the result X.
 If X is larger or equal to 1, a 1 will be written down.
 If X is smaller than 1, a 0 will be written down.
 If X is larger than 1, the value of 1 is subtracted from X then this is used in the next step of
the process.
 Repeat until X is exactly 1.

For example:
Convert 0.6875 to binary
0.6875 x 2 = 1.375 1
0.3750 x 2 = 0.750 0
0.7500 x 2 = 1.500 1
0.5000 x 2 = 1.000 1
This process gives the binary number 0.1011. The zero before the decimal point is assumed
because the number is obviously less than 1.

37
Miss gwenzi form 1 notes

Adding Binary Numbers


 The digits of the two numbers being added are added together in pairs starting from the right
hand side with the least significant bit. The following rules apply when adding two binary digits
together:
 0+0=0
 0+1=1
 1+0=1
 1 + 1 = 0 (and carry over 1 to the next column to the left)

For example:
Add the binary numbers 1010 (ten) and 0110 (six) together
1010
0110 +
-----
10000 (sixteen)

An overflow may occur if the sum of the two original numbers exceeds the size available to store
the number. The above 4-bit numbers produce a sum which has 5 bits. If the numbers were being
stored in 4-bit bytes, an overflow error would occur.

Subtracting Binary Numbers


To subtract two binary numbers, the following method can be used. Note that the complement of a
binary number is the value gained after changing all the 1s to 0s and vice versa.

In the case of A-B:


 Check that A is larger than B
 Take the complement of B
 Add A and the complement of B
 Remove the leading digit of the result
 Add 1 to the result

For example:
Take away the binary number 0110 (six) from 1100 (twelve)

1100 larger then 0110? YES


Complement of 0110: 1001
1100 + 1001 = 10101
Remove leading digit: 0101
Add 1 to the result: 0110 (six)

 Overflow - when a number is too large for the exponent to be expressed (positive exponent)
 Underflow - when a number is too near zero for the exponent to be expressed (negative
exponent)

38
Miss gwenzi form 1 notes

BCD Addition
Whenever the sum of any two BCD digits is greater than 1001 2 then 01102 has to be added to the
result to skip over the unused codes.

Floating Point Binary Numbers


With floating point numbers we store a mantissa and an exponent.
Example
7,800,000becomes 0.78 × 107.
The mantissa holds the digits and the exponent determines the point where the fractional point
goes.

How do we tell if a binary number is odd?


Answer :
It's right most digit is a one

39
Miss gwenzi form 1 notes
NOTE: Hexadecimal is used as it is shorthand for binary and easier for people to remember. It DOES
NOT take up less space in computer memory, only on paper or in your head! Computers still have to
store everything as binary whatever it appears as on the screen.

Exercise: Hexadecimal
Convert the following Hex numbers into decimal/denary:
A1

Answer :
16 1
A 1
16 * 10 + 1 * 1 = 16110

FF
Answer :
16 1
F F
16 * 15 + 1 * 15 = 25510

0D
Answer :
16 1
0 D
16 * 0 + 1 * 13 = 1310

37
Answer :
16 1
3 7
16 * 3 + 1 * 7 = 5510

Why would we use the Hexadecimal system?


Answer:
Hexadecimal is used for humans, it is easier to understand and write

Name a use of the hexadecimal system


Answer:
Hexadecimal is used for error message codes and memory addresses

Convert the following Hexadecimal values into Denary:


1216
Answer :
1 2 (Hex)
0001 0010(Binary)

128 64 32 16 8 4 2 1
0 0 0 1 0 0 1 0 = 16+2 = 18 (decimal)

A516
Answer :
A 5 (Hex)

40
Miss gwenzi form 1 notes
1010 0101 (Binary)

128 64 32 16 8 4 2 1
1 0 1 0 0 1 0 1 = 128+32+4+1 = 165 (decimal)

7F16
Answer :
7 F (Hex)
0111 1111 (Binary)

128 64 32 16 8 4 2 1
0 1 1 1 1 1 1 1 = 64+32+8+4+2+1 = 127 (decimal)

1016
Answer :
1 0 (Hex)
0001 0000 (Binary)

128 64 32 16 8 4 2 1
0 0 0 1 0 0 0 0 = 16(decimal)

Convert the following Binary numbers into hex:


101011012
Answer :
1010 1101 (Binary)
A D (Hex)

1101112
Answer :
0011 0111 (Binary)
3 7 (Hex)

101011112
Answer :
1010 1111 (Binary)
A F (Hex)

1110101000012
Answer :
1110 1010 0001 (Binary)
E A 1 (Hex)

NB:To convert from denary to hexadecimal, it is recommended to just convert the number to binary
first. In summary, we can use the following rule: Hexadecimal <-> Binary <-> Denary

Convert the following decimal numbers into hex:


8710
Answer:
87(decimal)
0101 0111 (Binary)

41
Miss gwenzi form 1 notes
5 7 (Hex)

1210
Answer:
12(decimal)
0000 1100 (Binary)
0 C (Hex)

11710
Answer:
117(decimal)
0111 0101 (Binary)
7 5 (Hex)

Why might you use Hexadecimal?


Answer:
So that it makes things such as error messages and memory address easier for humans understand
and remember

Give two uses of hexadecimal?


Answer:
 Error message codes
 Memory address locations

NETWORKING
 A computer network is an interconnection of two or more computers that are able to exchange
information.
 The computers may be connected via any data communication link, like copper wires, optical
fibers, communication satellites, or radio links.
 The computers in a network may be located in a room, building, city, country, or anywhere in
the world.

TYPES OF NETWORKS
Computer network is broadly classified into three types:
o Local Area Network (LAN),
o Metropolitan Area Network (MAN),
o Wide Area Network (WAN).
A network consists of two or more computers that are linked in order to share resources (such as
printers and CDs), exchange files, or allow electronic communications.

PERSONAL AREA NETWORK


 A Personal Area Network or simply PAN, is smallest network which is very personal to a user.
 This may include Bluetooth enabled devices or infra-red enabled devices. PAN has connectivity
range up to 10 meters.
 PAN may include wireless computer keyboard and mouse, Bluetooth enabled headphones,
wireless printers and TV remotes for example.

42
Miss gwenzi form 1 notes

Piconet is an example Bluetooth enabled Personal Area Network which may contain up to 8 devices
connected together in a master-slave fashion.

LOCAL AREA NETWORK (LAN)


 It is privately owned communication systems that cover a small area, say a building or a
complex of buildings.
 Length is about 10 meters to few kilometers and operates at a high speed like 10 MBPS to 1000
MBPS.
 It has very low error rate.

Types of Local Area Networks:


o Client-Server Networks
o Peer-to-peer Networks

Client-Server Networks
 A client-server arrangement involves a server, which is a computer that controls the network.
 The clients are all the other computers, which are connected to the server in the network.
 It allow central computer to be used for administrative tasks such as network management.

Peer-to-Peer networks
 The word peer denotes one who is equal in standing with another.
 A peer-to-peer LAN is one in which all microcomputers on the network communicate directly
with one another without relying on a server.
 Peer-2-peer networks are less expensive than client/server computing but slow under heavy
use.
 They are appropriate for networking in small group.

Advantages of LANs:
 Hardware such as printers can be shared so individual workstations do not need their own
printer.
 All the users’ work can be stored in a central place (the dedicated file server) so a user can
access their work through any computer on the network.
 Software can be shared; software packages are stored on the server and downloaded to
workstations as requested.
 Data can be shared because database files stored in the server are available to users around the
network; data from CD-ROMs can also be shared across the network.
 Central back-up can take place automatically at regular intervals.
 Messages can be sent to people working at other computers on the network which can save
time and paper.
 There is control over users’ access rights to programs and data.

43
Miss gwenzi form 1 notes

Disadvantages of LANs:
 Printing can be slow. Where a lot of workstations are served by only one or two printers, long
print queues may develop.
 A virus can spread more easily. If a virus gets into one computer, it is likely to spread quickly
across the network because it will get into the central backing store.
 As data is shared there is a greater need for security. Users of the network have to have
authentication techniques such as user ids and passwords.
 If the server fails, all the workstations are affected.
 The cost of installing the equipment is greater. Cabling can be expensive to buy and to install.
 Damage to cables can isolate computers. Some sections of the network can become isolated
and will not be able to communicate with the rest of the network.

METROPOLITAN AREA NETWORK (MAN)


 It is public or privately owned communication system that typically covers a complete city.
 Speed is about 10 MBPS and follows DQDB (Distributed Queue Double Bus) standard.
 Its reliability is moderate.
 Cable television connection in a city is a good example for MAN

Advantages
 The data transfer is high at 1000 mbps.
 The expense is relatively economical in metropolitan network.
 Rapid transfer and sharing of files
 Easy upgrade of programs at a relatively lower cost
 Security of programs and other important information
 Centralized software management,
 Easy share of resources,
 email,
 Flexible access and workgroup computing

Disadvantages
 complex technology and installation
 Fiber optical cable, adaptors and concentrators are costly

WIDE AREA NETWORK (WAN)


 It covers a large geographical area and usually owned by a state.
 Data transfer rate is low (few KBPS to 10 MBPS)
 Error rate is much higher.

Types of Wide Area Networks:


o Value Added Networks (VAN)
o Internet

Value Added Network (VAN)


 A Value Added Network (VAN) is a semipublic network that provides additional services
beyond the simple communication of information from one place to another.
 A VAN operates at a greater speed than public network, and offer high security.

44
Miss gwenzi form 1 notes

Internet
 Is a network of networks
 There is no single authority that controls the net overally.

Disadvantages of WANs:
 Again these are similar to those of LAN's except that issues such as security become even more
important as potential hackers could break into a computer system from anywhere in the
world.
 Encryption to secure data such as financial transactions is necessary because it is even easier to
intercept data.

Difference between LAN and WAN:


o A LAN is restricted to a limited geographical coverage of a few kilometers, but WAN spans
greater distance and may operate nationwide or even worldwide.
o Data communication speed is much higher in LAN than in WAN.
o Fewer data transmission error occurs in case of a LAN as compared to WAN. This mainly
because in case of a LAN, the distance covered by the data is small compared to WAN.

Advantages of Installing a Network


 Speed. Networks provide a very rapid method for sharing and transferring files.
 Security. Also, passwords can be established for specific directories to restrict access to
authorized users.
 Centralized Software Management. One of the greatest benefits of installing a network is the
fact that all of the software can be loaded on one computer (the file server).
 Resource Sharing. Sharing resources is another advantage of networks.
 Electronic Mail. E-mail aids in personal and professional communication for all personnel
 Flexible Access. College networks allow students to access their files from computers
throughout the school.
 Workgroup Computing. Collaborative software allows many users to work on a document or
project concurrently.

Disadvantages of Installing a School Network


 Expensive to Install. Although a network will generally save money over time, the initial costs
of installation can be too expensive.
 Requires Administrative Time. Proper maintenance of a network requires considerable time
and expertise.
 File Server May Fail. When the files server "goes down," the entire network may come to a
halt. When this happens, the entire organisation may lose access to necessary programs and
files.
 Cables May Break. Some of the configurations are designed to minimize the inconvenience of a
broken cable; with other configurations, one broken cable can stop the entire network.
 Must Monitor Security Issues.

45
Miss gwenzi form 1 notes

NETWORK TOPOLOGIES
 Refers to the way in which computers and other networked devices are interconnected
 The following are types of network topologies:
o Bus
o Star
o Ring
o Mesh
o Hybrid

Bus Topology
 It is also known as a linear bus because computers are attached or connected to a single linear
cable called a trunk or backbone.
 Computers on the bus network communicate by sending packets of data to each other.
 A computer will send a packet of data to all computers on the network (broadcast). Each
computer listens and examines every packet on the wire to determine if the packet is intended
for it, and accepts only packets addressed to it.
 The bus topology is a passive topology because computers on the network are not actively
involved in the movement of data. The number of computers on the network affects network
performance. Performance degrades as more computers are added to the bus network.
 An Ethernet bus (the most common type of local area network) can have a maximum length of
185 metres and a maximum of 30 nodes. Note that there must be ‘terminators’ at either end of
the cable – preventing the signals being reflected back down the cable.

Backbone/trunk

Terminator Terminator

Advantages
 It uses the least amount of cable and is easy to expand without disrupting the network.
 It is relatively simple, inexpensive and reliable.
 Failure of one node does not bring the whole network down.

Disadvantages
 The whole network goes down if the main cable fails at any point.
 Network performance degrades under a heavy load (maximum computers on an Ethernet bus is
30)
 It is difficult to troubleshoot and isolate problems.
 Vulnerable to collisione.g Ethernet

46
Miss gwenzi form 1 notes
Star Topology
 A star topology is one in which each node is connected directly to a central hub using its own,
dedicated cable.
 All communications between workstations go through a central device, which can be a hub,
switch or repeater.
 It is now the most common topology used within LANs and many WANs
 Cabling faults are easy to locate because the hubs usually use Light Emitting Diodes (LED) to
indicate working connections;
 There is greater security of transmissions if a ‘switch’ is used as the hub
 The network requires more cables because each computer requires a cable segment to connect
to the central device.
 If a computer fails or the cable segment that connects the computer to the hub is broken, only
that link is affected the rest of the network continues to function normally.

Advantages
 If one cable fails, the other stations are not affected
 Simple to isolate faults
 Consistence performance even when the network is being heavily used
 Reliable, market proven system
 No problems with ‘collisions’ of data since each station has its own cable to the server
 Easy to add new stations without disrupting the network

Disadvantages
 May be costly to install because of the length of cables required.
 When the hub or central terminal fails the whole system will be disrupted

Ring Topology
 A ring network is one in which the nodes are linked in a closed loop and the data is transmitted
in a single direction around the loop.
 There are Repeaters at each node to ‘boost’ the data signals as they pass around the ring.
 The use of repeaters allows a ring network to cover larger distances than other types of local
area network, and if using optical fibre cable, ring networks can span a distance of up to 100
kilometres
 Computers on the ring network use a signal called a token to carry the data from one computer
to the other.
 The access method used by the computers to put data on the communication medium is called
token passing.

47
Miss gwenzi form 1 notes
 Unlike the bus topology, the ring is an active topology. Each computer on the ring acts as a
repeater to regenerate/boost the signal and pass it to the next computer until it reaches the
destination computer.
 The receiving computer strips the data from the token and returns the token to the sending
computer with an acknowledgement.
 After verification, the token is released for use by any other computer requiring data transfer.
 While the token is in use by one computer, other computers on the ring cannot transmit,
because only the computer with the token can transmit data.
 This ensures that there are no collisions and hence no times spend waiting for computers to
resend data after a collision.

Advantages
 There is no dependence on the central computer or file server
 Each node controls transmission to and from itself
 Transmission of messages around the ring is relatively simple and avoids ‘collisions’ because
the transmission is in only one direction
 Very high data transmissions are possible

Disadvantages
 Extending an existing ring can be difficult because of the rewiring required.
 Not very secure because data travels all the way around the ring and so there are plenty of
opportunities for messages to be intercepted.
 If one computer fails, the whole network goes down.
Example of ring topology is token ring

Mesh Topology
 Apart from the three primary topologies, we also have the mesh topology.
 Each computer has a point-to-point connection to every other computer on the network.
 Use a significantly larger amount of network cabling than the other network topologies, which
makes it more expensive.
 Every computer has multiple possible connection paths/routes to the other computers on the
network as a result; a single cable break will not stop network communications between any
two computers.

48
Miss gwenzi form 1 notes

The total number of connections required can be calculated using the following formula:
Number of connections = n*(n-1)/2
Where n is the number of stations.

Hybrid Topology
 A hybrid topology is a combination of any two or more network topologies in such a way that
the resulting network does not have one of the standard forms.
 A hybrid topology is always produced when two different basic network topologies are
connected.
 Hybrid networks use a combination of any two or more topologies in such a way that the
resulting network does not exhibit/show one of the standard topologies (e.g., bus, star, ring,
etc.).
 Two common examples for Hybrid network are: star ring network and star bus network
 A Star ring network consists of two or more star topologies connected using a multi-station
access unit (MAU) as a centralized hub.
 A Star Bus network consists of two or more star topologies connected using a bus trunk (the
bus trunk serves as the network's backbone).

Network device types and characteristics


Switches
 Intelligent device which sends data to particular port
 A switch receives a frame and regenerates each bit of the frame onto the appropriate
destination port
 Used to segment a network into multiple collision domains
 Provides dedicated bandwidth on each port
 Reduces collision on a LAN, each port on the switch creates a separate collision domain
 Can also be used to interconnect segments of different speeds
 Often used in a star or tree topology
 Usually configured with 8, 12, or 24 RJ-45 ports
 Sold with specialized software for port management
 Most common switching methods are:
o Cut-through: Directly forward what the switch gets.
o Store and forward: receive the full frame before retransmitting
it.
 OSI: Switches are on the data link layer that’s why they deal with frames instead of bits and
filter them based on MAC addresses.
 Able to filter data on a network

Bridge
 A bridge is a device that allows you to segment a large network into two smaller, more efficient
networks.
 A bridge monitors the information traffic on both sides of the network so that it can pass
packets of information to the correct location.
 A bridge monitors the information traffic on both sides of the network so that it can pass
packets of information to the correct location.
 Most bridges can "listen" to the network and automatically figure out the address of each
computer on both sides of the bridge.

49
Miss gwenzi form 1 notes
 The bridge can inspect each message and, if necessary, broadcast it on the other side of the
network.
 The bridge manages the traffic to maintain optimum performance on both sides of the network.
 It keeps information flowing on both sides of the network, but it does not allow unnecessary
traffic through.
 used to extend networks by maintaining signals and traffic
 In a comparison with switches, they are slower because they use software to perform switching.
They do not control broadcast domains and usually come with less number of ports.
 Bridges can be used to connect different types of cabling, or physical topologies but must be
used between networks with the same protocol.
 OSI: Bridges are on the data link layer so in principle they are capable to do what switches do
like data filtering and separating the collision domain, but they are less advanced.

Routers
 Are used to interconnect networks that use different technologies
 Have the ability to break broadcast domains and collision domains
 A router translates information from one network to another; it is similar to a super intelligent
bridge.
 They can have both LAN and WAN interfaces.Routers are used to connect different LANs or a
LAN with a WAN (e.g. the internet).
 Routers can direct signal traffic efficiently
 Can route messages between any two protocols

 Routers control both collision domains and broadcast domains. . If the packet’s destination is on
a different network, a router is used to pass it the right way, so without routers the internet
could not functions.
 Connects all computers from a LAN to internet using same IP.

 OSI: Routers work on the network layer so they can filter data based on IP addresses.
 They have routing tables to store network addresses and forward packets to the right port.

Hubs
 Receives a signal, regenerates it, and sends the signal over all ports
 The ports use a shared bandwidth approach and often have reduced performance in the LAN
due to collisions and recovery
 A hub is a very simple (or dumb) device, once it gets bits of data sent from computer A to B, it
does not check the destination, instead, it forwards that signal to all other computers (B, C, D…)
within the network. B will then pick it up while other nodes discard it. This amplifies that the
traffic is shared.
 There are mainly two types of hubs:
o Passive: The signal is forwarded as it is (so it doesn’t need power supply).
o Active: The signal is amplified, so they work as repeaters. In fact they have been called
multiport repeaters. (use power supply)
 Hubs can be connected to other hubs using an uplink port to extend the network.
 OSI Model: Hubs work on the physical layer (lowest layer). That’s the reason they can’t deal
with addressing or data filtering.

Gateways
 Gateway is a generic term used to represent devices that connect two dissimilar networks. Acts
as translator.

50
Miss gwenzi form 1 notes
 Are very intelligent devices which connect and translate data between networks with different
protocols or architecture, so their work is much more complex than a normal router? For
instance, allowing communication between TCP/IP clients and AppleTalk.
 OSI: Gateways operate at the network layer and above, but most of them at the application
layer.

Media access methods


Carrier Sense Multiple Access/Collision Detect (CSMA/CD)
 In the CSMA/CD access method, all network devices that have messages to send must listen
before transmitting
 If a device detects a signal from another device, it will wait for a specified amount of time before
attempting to transmit its message
 When there is no traffic detected, device will transmit its message
 While this transmission is occurring, the device continues to listen for traffic or collisions on the
LAN
 But, if two systems place data on the medium at the same instance, they will collide with each
other, destroying the data. If the data is destroyed during transmission, the data will need to be
retransmitted. After collision, each host will wait for a small interval of time and again the data
will be retransmitted, to avoid collision again.
 Every host has equal access to the wire and can place data on the wire when the wire is free
from traffic.
 After the message is sent, the device returns to its default listening mode
 Once a collision is detected by the transmitting devices, they send out a jamming signal
 This jamming signal is used to notify other devices of a collision, so they will invoke a back off
algorithm
 This back off algorithm causes all devices to stop transmitting for a random amount of time,
which allow the collision signal to subside/settle.

CSMA/CA (Carrier Sense Multiple Access/Collision Avoidance)


 Unlike CSMA/CD (Carrier Sense Multiple Access/Collision Detect) which deals with
transmissions after a collision has occurred, CSMA/CA acts to prevent collisions before they
happen.
 In CSMA/CA, as soon as a node receives a packet that is to be sent, it checks to be sure the
channel is clear (no other node is transmitting at the time). If the channel is clear, then the
packet is sent.
 If the channel is not clear, the node waits for a randomly chosen period of time, and then checks
again to see if the channel is clear. This period of time is called the back-off factor, and is
counted down by a back-off counter.
 If the channel is clear when the back-off counter reaches zero, the node transmits the packet. If
the channel is not clear when the back off counter reaches zero, the back off factor is set again,
and the process is repeated.
 In CSMA/CA, before a host sends real data on the wire it will “sense” the wire to check if the
wire is free. If the wire is free, it will send a piece of “dummy” data on the wire to see whether it
collides with any other data. If it does not collide, the host will assume that the real data also
will not collide.

Token Passing
 In CSMA/CD and CSMA/CA the chances of collisions are there. As the number of hosts in the
network increases, the chances of collisions also will become more.
 In token passing, when a host wants to transmit data, it should hold the token, which is an
empty packet. The token is circling the network in a very high speed.

51
Miss gwenzi form 1 notes
 If any workstation wants to send data, it should wait for the token. When the token has reached
the workstation, the workstation can take the token from the network, fill it with data, mark the
token as being used and place the token back to the network.

Contention
 Contention is concerned with the competition of resources in a given network.
 The term is used especially in networks to describe the situation where two or more nodes
attempt to transmit a message across the same wire at the same time.
 This is a type of network protocol that allows nodes to contend/compete for network access.
That is, two or more nodes may try to send messages across the network simultaneously. The
contention protocol defines what happens when this occurs.
 The most widely used contention protocol is CSMA/CD, used by Ethernet. Also see polling and
token passing. This is a condition that occurs when two or more stations on a network try to
access the network media simultaneously. In other words, the stations are contending for
control of the media.
 There are different ways of resolving contention issues on a network. One way is to use a single
station as the master or primary station that controls all communication on the network. Other
devices on the network function as slave, or secondary, stations. The entire system is known as
a master-slave system. The master station normally functions in transmit mode, while the slave
stations operate in receive mode. The master station tells individual slave stations when they
should switch to transmit mode in order to transmit information over the network.
 In Ethernet networks, the Carrier Sense Multiple Access with Collision Detection (CSMA/CD)
method is used to resolve contention on the network by allowing collisions to occur, and then
resolving them successfully.

DATA TRANSMISSION
Transmission Medias
 The data is sent from one computer to another over a transmission medium.
 The transmission media can be grouped into guided media, and unguided media.

Guided media,
 The data signals are sent along a specific path, through a wire or a cable.
 Copper wire and optical fibers are the most commonly used guided media.
 Copper wire transmits data as electric signals.
 Copper wires offer low resistance to current signal, facilitating signals to travel longer
distances.
 The guided types of transmission media are mostly cables. It's called "guided" because the
signal passing through it can only go in one direction: from the source to the receiver.
 There are several subtypes, such as coaxial, which is most commonly associated with cable
products. Twisted-pair cables, such as those in phone lines and Ethernet cables are a second
subtype.
 Fiber optics is another example of guided transmission media, but these use light pulses instead
of electrical signals, which make them faster.
 The most common type of cable used in data communications is copper.
 There are different types of copper cable but they all share the feature of transmitting data as
an electrical signal. This gives rise to one of the weaknesses of this type of media, which is that
sending an electronic signal causes heat that is absorbed by the media as the signal travels thus
causing signal loss, i.e. attenuation.
 The faster the data transfer rate over copper cable the greater the possibility of signal loss and
interference.

52
Miss gwenzi form 1 notes
 There are two main categories of copper cable:
o Coaxial
o Twisted pair

Coaxial Cable
In early networks coaxial cable was the cable of choice because it was relatively inexpensive,
reliable and robust. It consists of:
o A central conductor
o An insulator
o A braided metallic shielding
o An outer jacket

 The core of a coaxial cable carries the electronic signals


 The braided metallic shielding is used to protect the signal from external noise and crosstalk
that could cause interference and possibly corrupt the data.
 Due to this protection, coaxial cable is more resistant to interference and attenuation than
twisted pair cabling.

There are two types of coaxial cable:


o Thinnet cable (10Base2)
o Thicknet cable (10Base5)

Advantages
 It provides better immunity than twisted pair.
 This cable is able to transmit data at higher rates.
 Sufficient frequency range to support multiple channels, which allows for much greater
throughput.

Disadvantages
 High installation cost
 High maintenance cost.
 The thicker the cable, the more difficult to work with.

Fiber Optic Cable

 Consists of glass or plastic fibres that carry data in the form of light signals. Unlike copper cable
there is no electricity, but it uses pulses of light.
 The cable cannot be tapped to detect signals.
 Fibre-optic cable is perfect for high speed, high quality data transmission, although it suffers
from a form of attenuation
 The reliability, security and distances covered by fibre optic cable make it the natural choice as
backbone cabling within buildings and between buildings.

53
Miss gwenzi form 1 notes

 The glass or plastic used in fibre-optic cable is manufactured to be pure and without any
imperfections/faults/defects so that the light signal can travel without hindrance/impediments
over long distances, e.g km.
How it works?
 The fibres or threads are extremely thin strands; about as thick as human hair, coated with two
layers of highly reflective plastic that creates an internal mirror around the strand.
 The outer sheath works as mirror causing an internal reflection that light cannot escape from
and is thus guided along bouncing off at shallow angles. This principle is known as total internal
reflection.
 At both ends of the fibre link there are photodiodes which must be in exact alignment in order
to prevent signal reflection. The means of placing the signal on the fibre can be carried out by
Light Emitting Diode (LED) or an Injection Laser Diode (ILD).

Advantages
 Immune to noise, electromagnetic interference and radio frequency interference. Thus optical
fiber systems are not affected by external noise.
 It can cover greater distances more reliably than wire (high bandwidth and capacity)
 It can handle greater speeds, e.g. 1000Mbps and upwards
 It cannot be compromised by signal tapping
 Lower signal attenuation (loss)
 Less restrictive in harsh environments
 The error rate for the data transmitted across fiber optic cable is very low.

Disadvantages
 It is not as robust/strong as wire
 It is more expensive to buy
 Fibers fragility/delicateness makes it more difficult to handle.
 It is more expensive to install
 It has to be installed by specialists
 The lack of standardization/consistency in the industry has also limited the acceptance of fiber
optics.

Twisted Pair Cable


 Twisted pair cable is the most common type of cable used in computer networks.
 It is reliable, flexible and cost effective.
 The twisting of the pairs of copper cable is one method used to protect the cable's signals from
interference and crosstalk. This type of protection is known as cancellation.

There are two main categories of twisted pair cable:


 Unshielded Twisted Pair (UTP) Cable
 Shielded Twisted Pair (STP) Cable

54
Miss gwenzi form 1 notes
Unshielded Twisted Pair (UTP) Cable

 A common implementation of UTP is 100BaseT, which allows for a maximum cable length
segment of 100 metres.
 There are different categories of UTP cable and one differentiation factor is the number of
twists per metre of cable.
 The more twists the higher quality the cable, i.e. there are less twists per foot in Cat3 compared
to Cat5 UTP cable.
 Cat5 UTP cable is a popular choice for network cable because it meets the European standard
for allowing data transfer speeds of 100Mbps.

100BaseT stands for:


o Data Transmission Rate of 100Mbps, i.e. 100
o Uses baseband transmission, i.e. Base
o The media is twisted pair, i.e. the T.

 In unshielded twisted pair cabling, the twisted pair cable is not shielded.
 This telephone wiring is usually unshielded twisted pair cable. The main disadvantage
associated with this is low noise immunity. During a telephone conversation, noise and
interference from other electronic equipment takes the form of static and is rarely loud enough
to disrupt the call. But that same line can scramble a data transmission and require the sending
device to retransmit. An excessive number of such retransmissions will reduce network
efficiency.

Advantages
 Inexpensive
 Easy to install
 Can accommodate up to 1000 devices.
 Handled a data flow of up to approximately one megabit per second (Mbps) over several
hundred feet

Disadvantages
 Easy to tap
 Susceptibility/vulnerability to signal distortion errors
 Provide relatively low transmission rates over long distances.

Unguided Media
 They are called unguided because it's possible to interrupt, or even walk through the signal, in
most cases without disrupting it.
 A wireless router broadcasts a constant radio signal over the air to your receiver. A satellite
does the same thing using microwaves. There are also laser-based transmitters, which work
like fiber optics, but without any physical cabling.

Unguided media relates to data transmission through the air and is commonly referred to as
wireless. The transmission and reception of data is carried out using antenna. There are two main
ways that antenna work:

55
Miss gwenzi form 1 notes
 Directional (in a beam)
 Omni directional (all around)

WirelessWireless media do not use an electrical or optical conductor. In most cases the earth’s
atmosphere is the physical path for the data. The common types of wireless media that transmit
data use electro-magnetic waves and are:

• Radio waves – the distances that can be covered by radio waves are dependent upon the
frequency, but can be hundreds of miles.

• Microwaves – these are transmitted at much higher frequencies than radio waves and will provide
better performance. Satellite dishes are often used with microwave transmission where
communication can be directly between two systems within the same geographical area or it can
make use of a satellite in geosynchronous orbit 50 000 km above the earth.

• Infrared – this uses ‘invisible’ infrared light to transmit the data. Most household remote controls
(used with televisions and videos, etc.) use infrared transmissions. Infrared transmissions are
either ‘point-to-point’ or they can be reflected off walls and ceilings; they cannot travel more than a
few metres and they cannot pass through walls.

Bluetooth is one of the latest radio technologies that enables devices such as computers,
mobilephones, hands-free kits and other peripherals to be connected without cables up to 30 feet
away.Like many modern wireless devices (including portable phones and wireless computers) it
useswaves with a frequency of 2.4 GHz.

Radio Transmission
 Radio transmission works with or without line of sight.
 If line of sight is possible then transmission can take place between sending antenna and
receiving antenna.
 The placement of antenna has to take into account the curvature of the Earth with antenna
being built taller accordingly. This will also allow for greater transmission distances.
 If line of sight cannot be implemented then signals can be broadcast to the upper layers or the
atmosphere or space and then transmitted back to Earth.

Bluetooth
 Bluetooth is a wireless protocol for exchanging data over short distances from fixed and mobile
devices, creating personal area networks.
 There are two important parameters of Bluetooth devices - class and supported profiles.
 "Class" signifies the distance at which a Bluetooth connection is possible. Most mobile devices
are Class 2, which means they have a range of up to 10 m. Class 1 devices are rare and have a
range of up to 100 feet.
 A "profile" is a type of Bluetooth connection. The most common are the Headset (HSP) and
Handsfree (HFP) profiles that enable the device to connect to a wireless headset or handsfree.
 Created by telecom vendor Ericsson in 1994, it was originally conceived as a wireless
alternative to RS-232 data cables.
 It can connect several devices, overcoming problems of synchronization.
 Used for connecting mobile phones to other devices without cables.
 Bluetooth specification is for a complete system from physical layer to application layer.

56
Miss gwenzi form 1 notes
 The basic unit of a Bluetooth system is a piconet, which consists of a master Node and up to
seven active slave nodes within a distance of 10 meters.

Wireless Fidelity (Wi-Fi)


 Short for "Wireless Fidelity." Wi-Fi refers to wirelessnetworking technology that allows
computers and other devices to communicate over a wireless signal.
 It describes all network components that are based on one of the 802.11 standards
 Wi-Fi is the standard way computers connect to wireless networks. Nearly all computers now
have built-in Wi-Fi cards that allow users to search for and connect to wireless routers.

Worldwide Interoperability for Microwave Access (WIMAX)


 Is an IP based, wireless broadband access technology that provides performance similar to Wi-
Fi networks with large coverage and QOS (quality of service) of cellular networks.
 WiMAX is a wireless digital communications system, also known as IEEE 802.16, which is
intended for wireless "metropolitan area networks".
 WiMAX can provide broadband wireless access (BWA) up to 30 miles (50 km) for fixed stations,
and 3 - 10 miles (5 - 15 km) for mobile stations.
 In contrast, the WiFi/802.11 wireless local area network standard is limited in most cases to
only 100 - 300 feet (30 - 100m).
 With WiMAX, WiFi-like data rates are easily supported, but the issue of interference is lessened.
 WiMAX operates on both licensed and non-licensed frequencies, providing a regulated
environment and viable economic model for wireless carriers.
 The primary advantages of the WiMAX standard are to enable the adoption of advanced radio
features in a uniform fashion and reduce costs for all of the radios made by companies, who are
part of the WiMAX Forum™ - a standards body formed to ensure interoperability via testing.
What is the difference between Wifi and WiMax ?
 WiMAX is a long range system, covering many kilometers, that uses licensed or unlicensed
spectrum to deliver a point-to-point connection to the Internet from an ISP to an end user.
 Wi-Fi is a shorter range system, typically hundreds of meters, that uses unlicensed
spectrum to provide access to a network, typically covering only the network operator’s own
property.
 Typically Wi-Fi is used by an end user to access their own network, which may or may not be
connected to the Internet.

Considerations for Transmission Media:


To determine the most appropriate communications media, you must consider the capacity,
reliability, cost, and distance of your network as well as the mobility of your network users.

57
Miss gwenzi form 1 notes
 Capacity: determining how much amount of information you need to communicate and the
speed with which you need to communicate that information will determine which
communications media you require.
 Reliability: addresses the guarantee of perfect service of your network.
 Cost: Communication media with greater capacity and reliability are more expensive.
 Distance: Knowing the extent of geographic distance that your network must cover will also
help you determine the most appropriate communication media. Some communications media
such as wire pair and microwave systems, only work well over small distances, where as optical
fiber, microwave, and satellite communications media work well over great distances.
 Mobility: Finally, you need to consider the mobility of network users. Many organizations today
are equipping telecommuters with cellular phones so that they can work anywhere without
contact to an actual phone line.

Data Communication
Data communication is the transmission of electronic data over some media. The media may be
cables, microwaves.

Elements of Data Communication


Four basic elements are needed for any communication system.
 Sender. The computer or device that is used for sending data is called sender, source or
transmitter. In modern digital communication system, the source is usually a computer.
 Medium. The means through which data is sent from one location to another is called
transmission medium. If the receiver and transmitter are within a building, a wire connects
them. If they are located at different locations, they may be connected by telephone lines, fiber
optics or microwaves.
 Receiver. The device or computer that receives the data is called receiver. The receiver can be
a computer, printer or a fax machine.
 Protocols. These are rules under which data transmission takes place between sender and
receiver. The data communication s/w are used to transfer data from one computer to another.
The s/w follows same communication protocols to communicate and exchange data.

Data Transmission
Data may be transfered from one device to another by means of some communication media. The
electromagnetic or light waves that transfer data from one device to another device in encoded
form are called signals. Data transmissions across the network can occur in two forms i.e.:
 Analog signal.
 Digital signal.

Analog Signal: The transfer of data in the form of electrical signals or continuous waves is called
analog signal or analog data transmission. An analog signal is measured in volts and its frequency is
in hertz (Hz).

Advantages of AnalogSignaling
 Allows multiple transmissions across the cable.
 Suffers less from attenuation.

Disadvantages of AnalogSignaling
 Suffers from EMI.
 Can only be transmitted in one direction without sophisticated equipment.

58
Miss gwenzi form 1 notes
Digital Signal: The transfer of data in the form of digits is called digital signal or digital data
transmission. Digital signals consist of binary digits 0 & 1. Electrical pulses are used to represent
binary digits. Data transmission between computers is in the form of digital signals.

Advantages of Digital Signaling


 Equipment is cheaper and simpler than analog equipment.
 Signals can be transmitted on a cable bidirectional.
 Digital signals suffer less from EMI.

Disadvantages Digital Signaling


 Only one signal can be sent at a time.
 Digital signals suffer from attenuation.

Techniques of Data Communication


There are two possible techniques of sending data from the sender to receiver, i.e.:-
Parallel transmission.
Serial transmission.

Parallel Transmission. In parallel transmission each bit of character / data has a separate channel
and all bits of a character are transmitted simultaneously. Here the transmission is parallel
character by character.

Serial Transmission. In serial transmission, the data is sent as one bit at a time having a signal
channel for all the bits, i.e.:

Types of Serial Transmission


On serial transmission it is very essential to know exactly where one character ends and the next
begins. The necessary synchronization that helps determine which bit is the first bit of the incoming
character may be synchronous or asynchronous.

Asynchronous Serial Transmission


Computer communication that occurs one bit at a time with start and stop bits at the beginning and
the end of each character is called Asynchronous Serial Transmission. In this type of transmission,
there is no fixed time relationship with one character.

Advantages of Asynchronous Serial Transmission


 This type of transmission is very simple.
 This type of transmission is cheaper.
Disadvantages of Asynchronous Serial Transmission
 This type of transmission is slow.

Synchronous Transmission
In this method a clock signal is used and the sending as well as the receiving devices are
synchronized with this clock signals. It doesn’t use start and stop bits but the character are sent in
character groups called block

Advantages of Synchronous Transmission


 It is very fast as compared to Asynchronous Series Transmission.

Disadvantage of Synchronous Transmission


 It uses more expensive and complex equipment.

59
Miss gwenzi form 1 notes

Modes of Data Communication.


 The manner in which data is transmitted from one location to another location is called data
transmission mode.
 There are three ways or modes for transmitting data from one location to another. These are:
(1) Simplex.
(2) Half duplex.
(3) Full duplex.

Simplex Mode
 In simplex mode, data is transmitted in only one direction.
 A terminal can only send data and cannot receive it or it can only receive data but cannot send
it. Simplex mode is usually used for a remote device that is meant only to receive data.
 It is not possible to confirm successful transmission of data in simplex mode.
 This mode is not widely used. Speaker, radio and television broadcasting are examples of
simplex transmission, on which the signal is send from the transmission to your TV antenna.
There is no return signal.

Advantages of Simplex
 Cheapest communication method.

Disadvantage of Simplex
 Only allows for communication in one direction.

Half Duplex.
 In half duplex mode, data can be transmitted in both directions but only in one direction at a
time.
 During any transmission, one is the transmitter and the other is receiver. So each time for
sending or receiving data, direction of data communication is reversed, this slow down data
transmission rate.
 In half duplex modes, transmission of data can be confirmed.
 Wireless communication and Internet browsing are examples of half duplex.

Advantages of Half Duplex


 Costs less than full duplex.
 Enables for two way communications.

Disadvantages of Half Duplex


 Costs more than simplex.

60
Miss gwenzi form 1 notes
 Only one device can transmit at a time.

Full Duplex.
 In full duplex mode, data can be transmitted in both directions simultaneously. It is a faster
mode for transmitting data because no time is wasted in switching directions.
 Example of full duplex is telephone set in which both the users can talk and listen at the same
time.

Advantage of Full Duplex.


 Enables two-way communication simultaneously.

Disadvantage of Full Duplex.


 The most expensive method in terms of equipment because of two bandwidth channels is
required.

The OSI, or Open System Interconnection.


What do you mean by OSI?

The Open System Interconnection (OSI) reference model describes how information from a
software application in one computer moves through a network medium to a software application
in another computer. The OSI reference model is a conceptual model composed of seven layers,
each specifying particular network functions. The model was developed by the International
Standardization Organization (ISO) in 1984, and it is now considered the primary architectural
model for inter-computer communications.

Why it is necessary to have layering in a network?

A computer network is a very complex system. It becomes very difficult to implement as a single
entity. The layered approach divides a very complex task into small pieces each of which is
independent of others and it allow a structured approach in implementing a network. The basic
idea of a layered architecture is to divide the design into small pieces. Each layer adds to the
services provided by the lower layers in such a manner that the highest layer is provided a full set
of services to manage communications and run the applications.

What are the key benefits of layered network?

 Main benefits of layered network are given below:


 Complex systems can be broken down into understandable subsystems.
 Any facility implemented in one layer can be made visible to all other layers.
 Services offered at a particular level may share the services of lower level.
 Each layer may be analyzed and tested independently.
 Layers can be simplified, extended or deleted at any time.

61
Miss gwenzi form 1 notes
 Increase the interoperability and compatibility of various components build by different
vendors.

Group # Layer Name Key Responsibilities Data Type Common


Handled Protocols and
Technologies
Lower 1 Physical Encoding and Signaling; Physical Bits (Physical layers of
Layers Data Transmission; Hardware most of the
Specifications; Topology and technologies
Design listed for the data
link layer)
2 Data Link Logical Link Control; Media Access Frames IEEE 802.2 LLC,
Control; Data Framing; Addressing; Ethernet Family;
Error Detection and Handling; Token Ring; FDDI
Defining Requirements of Physical and CDDI; IEEE
Layer 802.11 (WLAN,
Wi-Fi); HomePNA;
HomeRF; ATM;
SLIP and PPP
3 Network Logical Addressing; Routing; Datagrams IP; IPv6; IP NAT;
Datagram Encapsulation; / Packets IPsec; Mobile IP;
Fragmentation and Reassembly; ICMP; IPX; DLC;
Error Handling and Diagnostics PLP; Routing
protocols such as
RIP and BGP
4 Transport Process-Level Addressing; Datagrams TCP and UDP;
Multiplexing/Demultiplexing; / SPX;
Connections; Segmentation and Segments NetBEUI/NBF
Reassembly;Acknowledgments and
Retransmissions;Flow Control
Upper 5 Session Session Establishment, Sessions NetBIOS, Sockets,
Layers Management and Termination Named Pipes, RPC
6 Presentation Data Translation; Compression and Encoded SSL; Shells and
Encryption User Data Redirectors;
MIME
7 Application User Application Services User Data DNS; NFS; BOOTP;
DHCP; SNMP;
RMON; FTP;
TFTP; SMTP;
POP3; IMAP;
NNTP; HTTP;
Telnet

Protocols
 The Transmission Control Protocol/Internet Protocol (TCP/IP) suite was created by the U.S.
Department of Defense (DoD) to ensure that communications could survive any conditions and
that data integrity wouldn’t be compromised under malicious attacks.
 The Open Systems Interconnection Basic Reference Model (OSI Model) is an abstract
description for network protocol design, developed as an effort to standardize networking.

62
Miss gwenzi form 1 notes
 The acronyms TCP and IP stand for Transmission Control Protocol and Internet Protocol,
respectively.
 TCP/IP is a four-layer reference model.
 All protocols that belong to the TCP/IP protocol suite are located in the top three layers of this
model.
 The best way to begin understanding TCP/IP is to draw parallels with the OSI model, as shown
in the diagram below:

It should be noted that the names of the four layers in the TCP/IP stack vary in documentation. It is
the principle, rather than the rather semantic view of naming, that is important.

The TCP/IP Protocol Suite


 TCP/IP comprises a suite of protocols. The diagram below illustrates how these protocols are
implemented.

Application layer
 Deals with representation, encoding and dialog control issues.
 Telnet is an application that allows remote login to another computer. Typically, such a remote
logon will provide command-line access. Of course, using Telnet requires both client and server
components.
 FTP stands for File Transfer Protocol. An FTP session allows a user to upload files to, or
download files from a remote computer. As with Telnet, both client and server components are
necessary.
 SMTP stands for Simple Mail Transfer Protocol and is used for transferring email. For example,
a typical mail account in MS Outlook may use SMTP for handling mail.
 DNS - Domain Name System - allows IP addresses to be mapped to domain names, such as
http://www.just2good.co.uk.

Transport layer
 Its responsibilities include application data segmentation, transmission reliability, flow and error
control.
 Within the TCP/IP stack, transport control is either handled by TCP - Transmission Control
Protocol, or by UDP - User Datagram Protocol.
 The important difference is that TCP uses virtual circuits. I.e. connections between end-points
are established, allowing data to flow reliably between them.
 UDP, on the other hand, does not use pre-established circuits, and is thus termed a
connectionless transport protocol. Since circuits do not need to be established in advance, UDP
transport requires fewer networks overhead and is therefore faster. For example, TFTP - Trivial

63
Miss gwenzi form 1 notes
File Transfer Protocol - uses UDP. However, connectionless protocols are inherently unreliable.
However, if the application itself implements some form of reliability checking, then UDP will
clearly be preferable to TCP.

Internetwork layer
 Their purpose is to route packets to their destination independent of the path taken.
 IP is responsible for transporting UDP or TCP segments (packets) from end-point to end-point,
based on their IP addresses.
 ICMP (Internet Control Message Protocol) is used to request the status of network hardware, or
to respond to such a request. For example, the Ping command uses an ICMP packet.

Network Access:
 The network access layer deals with all the physical issues concerning data termination on
network media.
 It includes all the concepts of the data link and physical layers of the OSI model for both LAN
and WAN media.

Packet-switched and circuit-switched networks


Packet-switching
 In Packet Switching, the message is broken into small packets and sent over the network
independently.
 At destination, the received packets are reassembled and the complete message is constructed.
 Network links are shared by packets from multiple competing communication sessions,
resulting in the loss of the quality of service guarantees that are provided by circuit switching.
 Virtual circuit switching is a packet switching technology that emulates circuit switching, in the
sense that the connection is established before any packets are transferred, and packets are
delivered in order.

Circuit switching
 is a methodology of implementing a telecommunications network in which two network nodes
establish a dedicated communications channel (circuit) through the network before the nodes
may communicate.
 The circuit guarantees the full bandwidth of the channel and remains connected for the
duration of the communication session.
 The defining example of a circuit-switched network is the early analog telephone network.
 In circuit switching, the bit delay is constant during a connection, as opposed to packet
switching, where packet queues may cause varying and potentially indefinitely long packet
transfer delays.
 No circuit can be degraded by competing users because it is protected from use by other callers
until the circuit is released and a new connection is set up.

Difference between circuit switching and packet switching:


Packet Switching

 Message is broken up into segments (packets).


 Each packet carries the identification of the intended recipient, data used to assist in data
correction and the position of the packet in the sequence.
 Each packet is treated individually by the switching centre and may be sent to the destination
by a totally different route to all the others.

64
Miss gwenzi form 1 notes
 It is easier to double the capacity of a packet switched network than a circuit network – a circuit
network is heavily dependent on the number of channel available.
 It is cheaper to expand a packet switching system.

Advantages:

 Secure
 Bandwidth used to full potential
 Devices of different speeds can communicate
 Not affected by line failure (re-diverts signal)
 Availability – do not have to wait for a direct connection to become available
 During a crisis or disaster, when the public telephone network might stop working, e-mails and
texts can still be sent via packet switching

Disadvantages

 Under heavy use there can be a delay


 Data packets can get lost or become corrupted while in transit
 Protocols are needed for a reliable transfer
 Not so good for some types of data streams e.g. real-time video streams can lose frames due to
the way packets arrive out of sequence.

Circuit-switching
 Take four times as long to double their performance
 Cost, force ISPs to buy many boxes to keep up. This is why everyone is looking for ways to get
Internet traffic off the telephone network.

Advantages:

 Circuit is dedicated to the call – no interference, no sharing


 Guaranteed the full bandwidth for the duration of the call
 Guaranteed Quality of Service

Disadvantages:

 Inefficient – the equipment may be unused for a lot of the call, if no data is being sent, the
dedicated line still remains open
 Takes a relatively long time to set up the circuit
 During a crisis or disaster, the network may become unstable or unavailable.
 It was primarily developed for voice traffic rather than data traffic.

SYSTEMS ANALYSIS AND DESIGN

WHAT IS SYSTEM?

65
Miss gwenzi form 1 notes
 A combination of resources working together to transform inputs into usable outputs.
 Basically there are three major components in every system, namely input, processing and
output.

 In a system the different components are connected with each other and they are
interdependent. For example, human body represents a complete natural system.
 The objective of the system demands that some output is produced as a result of processing the
suitable inputs.
 A well-designed system also includes an additional element referred to as ‘control’ that
provides a feedback to achieve desired objectives of the system.

Developing a business information system involves much more than just programming .Systems
developers must:
o Conduct a feasibility study
o Analyse current system (if any)
o Establish requirements for new system
o Design an overall solution (the structure of the system) based on user requirements
o Design the data storage structure
o Plan the Human-computer Interface (HCI)

During and after the implementation of a system, the systems developer must:
o Integrate the system into the business / current system
o Test the system
o Provide training
o Provide user support (documentation)
o Use and evaluate the system
o Maintain system

THE SYSTEMS DEVELOPMENT LIFE CYCLE


Candidates should be able to:
4. Describe the stages of the systems life cycle.

Most IT projects use the System’s Life-cycle approach to develop a new system. This approach
consists of several distinct stages, which follow one after the other. During the development life-
cycle, a team is not permitted to go back to a previous stage – this could cause the project to over-
run in terms of both cost and time.

The stages in the System’s Life-Cycle are as follows:


 Problem identification
 Feasibility Study (Initial investigation)
 Analysis (detailed investigation)
 Design
 Coding (software development)
 Testing
 Conversion
 Review (Evaluation)
 Maintenance

66
Miss gwenzi form 1 notes
Note that each stage of the System’s Life-cycle has a distinct end-point, which can be shown to the
customer and ‘signed off’. This helps to ensure that the final product is what the customer actually
wanted!

DEFINING THE PROBLEM


The problem identification is a statement of the existing problems and description of user
requirements as outlined by the customer.

An accurate problem definition is needed so that the developers know exactly what is expected
from the system. This means that the system that is delivered is going to be what the customer
expected. Without an accurately defined problem, it is likely that the software that is developed will
not fully satisfy the needs of the end users.
Note that there has to be a two-way dialogue between the analyst and the users because:
 The users do not know a lot about computers and their capabilities;
 Programmers will not know very much about the way the business works, for which they are
developing the software.

FEASIBILITY STUDY
A feasibility study is an initial investigation of a problem in order to ascertain whether the
proposed system is viable/feasible/practicable, before spending too much time or money on its
development.

After the problem/task has been defined and before a complete detailed study of exactly what is
needed within a new system, a feasibility study is undertaken to verify that the system that is
required is, in fact, viable/possible and that it is worth proceeding.
There are five factors that are considered in a feasibility study:
 Technical feasibility – this investigates whether the hardware and software exists to create
the system that is wanted.
 Economic feasibility – this investigates the cost of developing a new system (including the
purchase of new hardware) and then determines whether the benefits of a new system would
outweigh the costs.
 Legal feasibility – investigates if there is a conflict between what is wanted and the law. For
example, would the new system satisfy the requirements of the Data Protection Act?
 Operational feasibility – investigates whether the current working practices within the
organization are adequate to support the new computer system. It is possible that the new
system would require employees to perform duties in a different way –this may not be
acceptable!
 Schedule feasibility – this investigates the amount of time that the new system is likely to take
to develop and determines whether it can be developed within the timescale that is available.

Estimating cost effectiveness


Costs Benefits
New Hardware Reduced Staffing
The New software Better service to customers
Training (time and money) Improved management information
Faster processing that speeds up payments from
Conversion (Time) customers
Maintenance (Money)

FACT FINDING DURING ANALYSIS

67
Miss gwenzi form 1 notes
The analysis is a detailed, fact-finding, investigation of the existing system in order to
ascertain/determine its strengths and weaknesses and to produce the list of requirements for the
new system.

When attempting to create a new IT system, it is very important that sufficient information is
gained about the way the present system operates. The usual methods of obtaining this information
include:
• Interviewing staff
• Observation of current procedures
• Examination of paperwork
• Surveying (with questionnaires)

Interviewing
It involves a one to one question and answer session between the analyst and the
employee/customer. Interviews are time-consuming, but very effective.

Advantages
 It gives the opportunity to motivate the interviewee into giving open and honest answers to the
analyst’s questions
 It allows the analyst to probe for more feedback from the interviewee, as it is easier to extent a
question
 It is possible to modify questions as the interview proceeds and ask questions specific to the
interviewee
 It is a good method if the analyst wants to probe deeply into one specific aspect of the existing
system

Disadvantages
 It can be rather time consuming
 It is relatively expensive, due to the use of the analyst’s time
 Users may feel intimidated/demoralized and not tell the truth of the user’s answers to the
original questions about what they feel is lacking in the existing system

Observation
 Involves watching personnel using the existing system to find out exactly how it work.
 Time and motion studies could be undertaken to see how data and documents move around the
existing system and to detect where bottlenecks occur and determine where measures could be
made more efficient.

Advantages
 The analyst obtains reliable data
 It is possible to see exactly what is being done
 It is relatively inexpensive method
 Allows the analyst to see the current system at site
 More advantageous than just interviewing them, because it may uncover/expose processes that
they do sub-consciously and do not remember to tell the analyst about during interview.

Disadvantages
 Users may work differently if they know that they are being watched.

Examination of paperwork:

68
Miss gwenzi form 1 notes
 The paperwork will include documents that are received from an organization’s customers –
such as membership application forms or orders.
 They will also include documents that are produced by the current system – such as the
invoices sent to customers and the current reports that are produced for the management team.
 This will help to show the inputs and outputs of the current system and so help determine the
inputs and outputs required by the new one.

Advantages
 Analyst can get an idea of the volume of data
 Analyst can determine the inputs and outputs required by the new system.
 Analyst can see how data is currently validated

Disadvantages
 Can be time consuming if there is a large volume of files to go through

Questionnaires
 If there are many users of the system then surveying staff by asking them to complete a
questionnaire would be a more efficient method of gathering information than conducting
personal interviews.

Advantages
 Efficient in terms of time
 Answers can be anonymous

Disadvantages
 Responses to questions are less flexible than in an interview
 There is often a low return rate of answered questions
 It can be difficult to design a good questionnaire.

Requirements analysis
Candidates should be able to:
8. Describe what is involved when analysing the requirements of a system, explaining the nature of
the requirements specification and its content, including current data structures, inputs, outputs
and processing represented in diagrammatic form (data flow diagrams, system flowcharts), identify
inefficiencies / problems in the current system.

The deliverable at the end of analysis is documentation that shows an investigation into the current
system and a list of system requirements for the new one. These requirements need stated in a
clear, specific and measurable way. In order to ascertain these requirements, the systems’ analyst
needs to examine the current data structures and relationships between them. They must also trace
the flow of data through the existing system – this will begin by determining the source of the
various data, identifying the ways in which the data is processed; and finish by identifying the
destinations of the final outputs. The analysis documentation will contain the following:
o Identification of existing and prospective/potential users;
o Identification of current data and its structure;
o Identification of inputs, outputs and processes within the current system;
o Identification of data flows including the sources and destinations of the data;
o Identification of the strengths and the weakness of the current system;
o Listing of objectives.

69
Miss gwenzi form 1 notes
Current data and its structures
 This is the description of the current data within the system – its data type, validation
techniques used, relationships with other data within the system.
 The analysis data dictionary is usually presented in tabular form, with each different category of
data being described in its own table.

Data flow diagrams:


A data flow diagram is an analysis is tool that represents what a system does, not how it does it.
They are:
o graphical – eliminating thousands of words;
o logical representations – not physical models;
o hierarchical – showing systems at any level of detail; and
o Jargon less – allowing user understanding and reviewing.

 DFDs contain a system boundary which contains the whole "system". Data flows can cross that
boundary into the "environment". Objects outside the system are known as "terminators".
 There must be a limit regarding what data it processes otherwise it will continually expand,
never being a finished and complete system. This can lead to problems in the operation of the
system as it becomes more complex and the probability of large system errors being introduced
increases. Data stored about objects or people should only be relevant data.
 When developing a system a statement of purpose must exist. This is simply a short concise
statement about the purpose of system. For clarity, this may also include what is NOT to be
included in the system.
 The Context Diagram which is the Topmost DFD (level 0) has one process only and shows the
inputs and outputs of the system.
 Within stores, the structure of the data has to be described. This can be done using UML and
Class Diagrams. These involve the representation of simple classes (by a rectangle) and
Associations (lines) drawn between them that show what type of relationship is involved.
 Cardinality describes the number of classes associated with another class. The cardinality is
shown by numbers written above the association lines near the class.

DFD Elements
Processes transform data.

Stores retain data until needed. They are usually named after the data entity.

Terminators (or entities) can represent customers or people etc... within a system.

Data Flows are instantaneous and the names of the flows are typically listed in the data dictionary
along with information about each one.

System flowcharts:
A system flowchart shows an outline of how a system operates.

70
Miss gwenzi form 1 notes

DESIGN
Design is the production of diagrams, tables and algorithms, which show how the new system is to
look and work. The design will show: • how the interfaces and reports should look;
• the structure of and relationships between the data;
• the processing to be used to manipulate/transform the data;
• the methods to be used for ensuring the security and validity of the data.

 The deliverable at the end of the design stage is documentation that could be used,
independently, by a third-party programmer to create the system as the designer intends/aims.
This means that each section of the design must be detailed and clear.
 Explanations of what must be done and why this method is chosen need to be included. The
design documentation will contain the following:
o user interface designs (input forms and menus);
o specification of data structures (including the relationships between different types of
data);
o validation procedures;
o output/report designs;
o algorithms;
o security methods.

User interfaces:
Humans will need an interface that allows them to:
o Give instructions – Print, Save, Open, Delete, Copy, Paste etc.
o enter data – file names, number of pages to print;
o Make choices – Yes, No, Cancel etc. Computers need ways to:
o notify errors – illegal operation, invalid data input, printer out of paper, wrong password:
o tell on progress – copying, deleting, installing, and downloading:
o display the results of processing
o ask for options – e.g. number of pages to be printed, which file to open.
o provide help with performing tasks – this help could be in the form of Status bar text, yellow Tip
boxes, an Office Assistant or even a full-blown help file accessed via the Help menu.

Data structures and validation:


Data can be of many types and can have many properties. Typically, a table is constructed for each
category of data. The properties of the data and the necessary validation techniques are stated as
shown:
Field Name Data Type Validation Comments
Member ID AutoNumber Uniqueness Automatically generated (Integer) check Primary Key
First Name Text (size 25) Presence check Enter members first name – maximum 25
characters)
Last Name Text (size 25) Presence check … DateOfBirth Date (Short) Data-type +
… Presence check
Gender Text (size 1) Existence checks Default – M; choice of M/F (on ‘M’ or
‘F’) select from radio-button. ---

CODING
Coding is the creation and editing of the interfaces, code and reports so that they look and work as
indicated in the design stage. Note that user and technical documentation will also be produced
during the coding stage.

71
Miss gwenzi form 1 notes
TESTING
Testing is the process to ensure that the system meets the requirements that were stated in the
analysis and also to discover (and eliminate) any errors that might be present.

 Testing is undertaken to ensure that a system satisfies the user’s requirements and to discover
any errors that might be present.
 This phase is important for testing needs to be undertaken by both the programming team and
by the end-users.

Note that. Testing a program can never adequately prove or demonstrate the correctness of the
system – it can only reveal/disclose the existence of errors. The Testing by the programming team
is on-going as the system is developed, but it is still very important to undertake tests at the end,
after the programming team believes that the system is finished. This formal testing at the end of
development is known as alpha-testing.

Alpha-testing:
This is the formal testing at the end of development. It:
 is undertaken by the programming team;
 uses data that the programmers perceive/see to be realistic;
 Is designed to ensure that the requirements/objectives have been met.

Testing by the end-users:


Testing by the end-users is either beta-testing or acceptance testing.

Beta-testing:
 Beta testing is when the software is tested under real conditions, using real data, by a selection
of real end-users.
 This phase of testing is necessary because software developers will probably not anticipate all
the combinations of conditions that will occur when the software is in use in its ‘real’
environment.
 This is the stage of testing where problems with different hardware combinations are usually
discovered, as are problems with ‘clashing’ software.
 During beta testing, users generally agree to report problems and bugs to the developers. These
will then be corrected and the software may then undergo a second round of beta testing before
the package is eventually released. These end-users who test the system during beta-testing:
o use the system with realistic volumes of real data;
o use the system with a variety of different hardware and configurations;
o report faults/errors back to analyst;
o check that there is a reasonable response time;
o ensure that the user interface is clear;
o Ensure that the output is as expected.

Acceptance testing:
 Acceptance testing is where the customer specifies tests to check that the supplied system
meets his/her requirements as specified at the analysis stage and that the system works in their
own environment.
 Note that the tests and data are specified by the customer, but the testing itself may be carried
out by the customer or by the developer under the scrutiny of the customer.

CONVERSION:

72
Miss gwenzi form 1 notes
Conversion is the process of installing the new system into the customer’s organisation and training
the employees to use it.
 Conversion is the process of changing from an existing system to a new system.
 Note that conversion may take place within a day, or it might be that it is several months before
all parts of the new system have replaced the old. There are problems which may arise when
converting / changing over. Converting from an existing system to a new one is not always
smooth. The following problems could arise:
o Data may have to be converted because the format in the new system may be different to
the format of the old system.
o Users will have to be trained so that they will be able to use the new system – the
organization may even need to employ additional staff.
o Data may be lost during conversion – must make sure there is a full backup made before
changing to the new system;
o Hardware may need to be replaced/upgraded – if it does not satisfy the demands of the new
system;
o System software may need to be replaced/upgraded – i.e. new system may be created to
take advantage of the features within Windows XP and so will not run correctly on an
earlier operating system.
o Old data may need to be archived;

Methods of conversion/changeover:
The change from the use of an existing system to the use of a new system cannot always be
immediate / instantaneous. There are several different methods of converting to a new system, the
four most common are:
o Parallel;
o Direct;
o Pilot;
o Phased.

Parallel:
The old and the new systems are run side by side for a time before the new system takes over
altogether.

Advantages
 If the new system fails, the old system is still available as a backup.
 It is possible to train staff gradually
 Staff have time to get used to the new system

Disadvantages
 It is more expensive than direct changeover, since extra staff are needed to run both systems
together

Direct:
The old system is stopped overnight and the new system introduced immediately.

Advantages
 The benefits are immediate
 Costs are reduced – since only one system is used there is no need to pay for two sets of staff
 There is less likelihood of a malfunction since the new system will have been fully tested

Disadvantages

73
Miss gwenzi form 1 notes
 This method can be disastrous if the new system fails

Pilot:
The new system is introduced into one part of the company (e.g. into a warehouse of a
supermarket) and its performance assessed.

Advantages
 If the new system fails, only one part of the company is affected
 It is possible to train staff in one area only, which is much faster and less costly than parallel
running
 The costs are also less than parallel running, since only one part of the system is being used in
the pilot

Disadvantages
 It is more expensive than direct changeover, since each pilot scheme needs to be evaluated
before the next stage is introduced

Phased:
 Initially, only part of the new system is introduced. Only when it proves to work satisfactorily is
the next part introduced, and so on, until the old system is fully replaced

Advantages
 If the latest part fails, it is only necessary to go back into the system to the point of failure, hence
failure is not disastrous
 It is possible to ensure the system works properly before expanding

Disadvantages
 This more expensive than direct changeover, since it is necessary to evaluate each phase before
moving to the next stage.

EVALUATION (REVIEW)
Post-implementation review (also known as evaluation) is a critical examination of a system after it
has been in operation for a period of time.

Purpose:
 The purpose of an evaluation is to assess the success of a system.
 Specifically, it will assess the suitability, effectiveness, usability and maintainability of the
system. The evaluation will ask many questions including:
o Can it carry out the all the requirements that were set?
o Is it an improvement on the existing system?
o Is it cost effective?
o Is it easy to use?
o Is the new system compatible with the existing systems?
o Is the system easy to maintain?

The evaluation will also consider:


o What limitations there are in the system;
o What enhancements/improvements could be made to the system in the future.
Note that feedback from the end-users should also be included.

Timing:

74
Miss gwenzi form 1 notes
 The evaluation will occur after a new system has been in operation for some time – usually a
period of between three and six months.
 The waiting period allows users and technical staff to learn how to use the system, get used to
new ways of working and understand new procedures required.
 It allows management a chance to evaluate the usefulness of the reports and on-line queries
that they can make and go through several month-end periods when various routine reports
will have been produced. Shortcomings of the system, if they exist, will be becoming apparent at
all levels of the organization.

System documentation
There are two types of documentation that are necessary:
 Technical documentation – aimed at a future system developer
 User documentation/Manual – aimed at the end user.

Technical documentation:
 Note that technical/system documentation is very valuable for the maintenance process. This is
because it will show how each part of a system has been constructed and the reasons why
certain choices have been made.
 The technical documentation should include:
o Annotated program listing – if the system is coded.
o Data flow diagram
o System flow diagram
o Structure charts/pseudo code/algorithm designs
o Test plan
o Data dictionary – i.e. the field definitions (including data-type, field length, validation)
o Entity relationship diagrams

User Documentation:
As well as a contents page and index, the user documentation should include:
o Overview of the system
o Instructions on how to install
o Instructions on how to back up the data
o Instructions on how to operate the program
o Details on possible errors and how to deal with them
o Glossary of terms used within the documentation.

MAINTENANCE
Maintenance is the process of making improvements to a system that is in use. The reasons for
maintenance could be to fix bugs, to add new features or to make the system run quicker.

Maintenance is needed because:


o Bugs are discovered in the software code – these bugs will have been identified only after
the system is in full use. They will be fixed and a ‘patch’ will be issued that changes the
appropriate lines of code within the end-users’ programs.
o The user requirements may change – this often happens after a system has been in
operation for some time and the users see further uses of the data that the system produces.
In some cases, the additional requirements may have been identified during the original
development, but they were not implemented because the system’s life-cycle approach to
projects does not allow a change in requirements once they have been agreed (such a
change would extend development time and cause a project to miss its deadline).

75
Miss gwenzi form 1 notes
o Some in-built parameters change – e.g. VAT rate;
o Hardware is changed – the system will be updated to take advantage of new hardware
developments. This could be a new input device, output device or even communications
device.
o The performance needs tuning – often some of the original code, although working without
error, uses some quite cumbersome/bulky routines that are slow to execute. System
performance can often be improved by finding more efficient algorithms for such routines.
o Operating system is upgraded – the system will be modified to take advantage of the
additional capabilities of the operating system.

Types of maintenance:
There are three types of maintenance:
 corrective maintenance;
 adaptive maintenance;
 Perfective maintenance.

Corrective maintenance:
 Corrective maintenance is the removal of some of the known bugs in a program. Software that
has been released to the public will still contain bugs. Some of these bugs will be previously
unknown to the developers while others will be known to exist, but solutions will not yet have
been discovered. The software will be released with these ‘known bugs’ because of the
necessity to meet pre-set target dates and the need to gain some income from the software to
continue to pay the developers. Eventually some of the bugs will be fixed and the solutions will
need to be incorporated into the public’s version of the programs. This type of maintenance is
often done by releasing a ‘patch’ which is a very small program that actually changes lines of
code within the main program. These patches are available from Internet sites or from the CD-
ROMs that are provided with computer magazines.

Adaptive maintenance:
 Adaptive maintenance is the addition of new features to a program because of a change in
users’ requirements.
 The new version of the program may contain an added (or modified) feature or it may contain a
change in the interface. Adaptive maintenance could be needed because of:
o a change in the organizations/users requirements;
o a change in the law;
o a change in processes such as the method of tax calculation;
o to take account of new technologies.

Perfective maintenance:
 Perfective maintenance is when internal routines are changed to make them more efficient, so
that the application operates faster.
 In the initial release of the software some of the processes, although error-free, may have used
long and slow routines. Perfective maintenance will make improvements in the way that the
software performs by ‘tidying up’ some of the internal routines. Changes to the interface may
also be made.

Successful Systems Development


 A system needs to be "fit for purpose". There is no one correct design model for a system.
Different analysts may draw up different models for a specified system.
 To be "fit for purpose" the system needs to meet the requirements specified for an ideal system.

76
Miss gwenzi form 1 notes
 DFDs that are drawn up need to be correct. If they have errors in them or the wrong symbols
are used they are useless. Some further possible errors include:

o Data flows cannot exist between stores or terminators (processes are needed to retrieve
and move the data)
o Processes must be given a number and name in the appropriate places
o Data flows must be named
o All stores must be given numbers.
o Stores should typically have an input data flow so that it can be updated as well as an output
flow otherwise the data is not being used for anything
o Processes must have at least one input and one output

 Successful systems development will involve breaking the system down into components or
modules. If there is "low coupling" between sections or modules in a system, this means that
there is little data flow between them.
 These sections can therefore be developed independently quite easily without large problems
occurring when bringing them together to form the system as a whole.
 The system's outputs must also be relevant and necessary for the user. Irrelevant and useless
output creates complications.

Root Causes for Project Failure


 Ad hoc requirements management
 Ambiguous and imprecise communication
 Overwhelming complexity
 Insufficient testing
 Subjective assessment of project status
 Uncontrolled change propagation
 Insufficient automation

ALGORITHM DESIGN AND PROGRAMMING CONCEPTS

PROGRAM CONTROL STRUCTURES/ALGORITHM STRUCTURES


Program statements that affect the order in which statements are executed, or that affect whether
statements are executed, are called control structures. There are fourcontrol structures.
 Sequential
 Selection
 Recursion
 Repetition.

 Sequential or linear structure is the construct where one statement is executed after another.
In simple terms it is a linear progression where one task is performed sequentially after
another.
 Selection (Decision) structure allows the program to make a choice between two alternate
paths, whether it is true or false. Thus is the construct where statements can be executed or
skipped depending on whether a condition evaluates to TRUE or FALSE. There are three
selection structures in C:
1. IF
2. IF – ELSE
3. SWITCH

77
Miss gwenzi form 1 notes
 Repetition (Looping) structure is the construct where statements can be executed repeatedly
until a condition evaluates to TRUE or FALSE. Causes an interruption in the normal sequence of
processing and directs the system to loop back to a previous statement in the program,
repeating the same sequence again.There are three repetition structures in C:
1. WHILE
2. DO – WHILE
3. FOR
 Recursion A recursive method is a method that calls itself either directly or indirectly.There
are two key requirements to make sure that the recursion is successful:
o Every recursive call must simplify the computation in some way.
o There must be special cases to handle the simplest computations.

Iteration Vs. Recursion


 Both iteration and recursion are based on a control structure: Iteration uses a repetition
structure; recursion uses a selection structure.
 Both iteration and recursion involve repetition: Iteration explicitly uses a repetition
structure; recursion achieves repetition through repeated method calls.
 Iteration and recursion each involve a termination test: Iteration terminates when the
loop-continuation condition fails; recursion terminates when a base case is recognized.
 Iteration and recursion can occur infinitely: An infinite loop occurs with iteration if the loop-
continuation test never becomes false; infinite recursion occurs if the recursion step does not
reduce the problem in a manner that converges on the base case.
 Recursion repeatedly invokes the mechanism, and consequently the overhead, of method calls.
This can be expensive in both processor time and memory space.

ALGORITHM
 A sequence of steps to solve a problem.

Characteristics of an Algorithm
 Well-ordered: the steps are in a clear order
 Unambiguous: the operations described are understood by a computing agent without further
simplification
 Effectively computable: the computing agent can actually carry out the operation

Method for developing an Algorithm


1. Define the problem: State the problem you are trying to solve in clear and concise terms.
2. List the inputs (information needed to solve the problem) and the outputs (what the algorithm
will produce as a result)
3. Describe the steps needed to convert or manipulate the inputs to produce the outputs. Start at a
high level first, and keep refining the steps until they are effectively computable operations.
4. Test the algorithm: choose data sets and verify that your algorithm works!

Flowcharts
 A graphical tool that diagrammatically depicts the steps and structure of an algorithm or
program
 The steps are drawn in the form of different shapes of boxes and the logical flow is indicated by
interconnecting arrows.
 The boxes represent operations and the arrows represent the sequence in which the operations
are implemented.

78
Miss gwenzi form 1 notes
Symbols used
 Process – Any type of internal operation: data transformation, data movement, logic operation,
etc.
 Connector – connects sections of the flowchart, so that the diagram can maintain a smooth,
linear flow
 Input/Output – input or output of data
 Terminal – indicates start or end of the program or algorithm
 Decision – evaluates a condition or statement and branches depending on whether the
evaluation is true or false
 Flow lines – arrows that indicate the direction of the progression of the program

General rules for flowcharts


 All symbols of the flowchart are connected by flow lines (note arrows, not lines)
 Flowlines enter the top of the symbol and exit out the bottom, except for the Decision symbol,
which can have flow lines exiting from the bottom or the sides
 Flowcharts are drawn so flow generally goes from top to bottom
 The beginning and the end of the flowchart is indicated using the Terminal symbol

FLOWCHART
 A flowchart is a pictorial representation of an algorithm in which The boxes represent
operations and the arrows represent the sequence in which the operations are implemented.

Benefits of Flowcharts
o Makes Logic Clear
o Clear Communication
o Effective Analysis
o Useful in Coding
o Proper Testing and Debugging
o Appropriate Documentation

Limitations of Flowcharts
o Complex
o Costly
o Difficult to modify
o Difficult to update

Flowchart Symbols
• A flowchart uses special shapes to represent different types of actions or steps in a process.
• Some standard symbols, which are frequently required for flowcharts, are:

PSEUDOCODE (or Program Design Language)


 Consists of natural language-like statements that precisely describe the steps of an algorithm or
program
 Statements describe actions3

79
Miss gwenzi form 1 notes
 Focuses on the logic (sense) of the algorithm or program
 Avoids language-specific elements
 Written at a level so that the desired programming code can be generated almost automatically
from each statement
 Steps are numbered. Subordinate numbers and/or indentation are used for dependent
statements in selection and repetition structures4.
 It is an outline of a program, written in a form, which can easily be converted into real
programming statements.

Benefits of Pseudocode
o Pseudocode provides a simple method of developing the program logic as it uses everyday
language to prepare a brief set of instructions in the order in which they appear in the
completed program.
o Language independent
o Easier to develop a program from pseudocode than a flowchart
o Easy to translate pseudocode into a programming language
o Pseudocode is compact and does not tend to run over many pages
o Pseudocode allow programmers who work in different computer languages

LINEAR SEARCH
 used if items are not in any particular order
 items searched one by one until required item is found or end of list is reached
 inefficient for all but a few items
 maximum number of comparisons for a structure of size n is n

BINARY SEARCH
 used for searching an ordered array
 maximum number of comparisons for a structure of size n is log 2n

Binary search tree


 A binary search tree (BST), sometimes also called an ordered or sorted binary tree, is a
node-based binary tree data structure which has the following properties:
o The left subtree of a node contains only nodes with keys less than the node's key.
o The right subtree of a node contains only nodes with keys greater than the node's key.
o The left and right subtree must each also be a binary search tree.
o There must be no duplicate nodes.

 dynamic data structure


 leaf/terminal nodes - nodes with no children
 branches - lines connecting nodes

A binary search tree of size 9 and depth 3, with root 8 and leaves 1, 4, 7 and 13

80
Miss gwenzi form 1 notes
 Generally, the information represented by each node is a record rather than a single data
element. However, for sequencing purposes, nodes are compared according to their keys rather
than any part of their associated records.
 The major advantage of binary search trees over other data structures is that the related sorting
algorithms and search algorithms such as in-order traversal can be very efficient.
 Binary search trees are a fundamental data structure used to construct more abstract data
structures such as sets, multisets, and associative arrays.

SORTING
 Sorting is the process of placing elements from a collection in some kind of order.
 For example, a list of words could be sorted alphabetically or by length. A list of cities could be
sorted by population, by area, or by zip code.
 Like searching, the efficiency of a sorting algorithm is related to the number of items being
processed.

BUBBLE SORT
 used to sort a small no. of items (i.e. less than 50)
 to sort an array of n items, maximum no. of passes is (n - 1)
 Because of bubble sort's simplicity, it is one of the oldest sorts known to man. It’s based on the
property of a sorted list that any two adjacent elements are in sorted order.
 In a typical iteration of bubble sort each adjacent pair of elements is compared, starting with
the first two elements, then the second and the third elements, and all the way to the final two
elements.
 Each time two elements are compared, if they are already in sorted order, nothing is done to
them and the next pair of elements is compared. In the case where the two elements are not in
sorted order, the two elements are swapped, putting them in order.
 is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted,
comparing each pair and swapping them if they are in the wrong order.
 The pass through the list is repeated until no swaps are needed, which indicates that the list is
sorted.

Consider a set of data: 5 9 2 8 4 6 3. Bubble sort first compares the first two elements, the 5 and the
9. Because they are already in sorted order, nothing happens and the next pair of numbers, the 9
and the 2 are compared. Because they are not in sorted order, they are swapped and the data
becomes: 5 2 9 8 4 6 3. To better understand the "bubbling" nature of the sort, watch how the
largest number, 9, "bubbles" to the top in the first iteration of the sort.
(5 9) 2 8 4 6 3 --> compare 5 and 9, no swap
5 (9 2) 8 4 6 3 --> compare 9 and 2, swap
5 2 (9 8) 4 6 3 --> compare 9 and 8, swap
5 2 8 (9 4) 6 3 --> compare 9 and 4, swap
5 2 8 4 (9 6) 3 --> compare 9 and 6, swap
5 2 8 4 6 (9 3) --> compare 9 and 3, swap
5 2 8 4 6 3 9 --> first iteration complete

The bubble sort got its name because of the way the biggest elements "bubble" to the top. Notice
that in the example above, the largest element, the 9, got swapped all the way into its correct
position at the end of the list. As demonstrated, this happens because in each comparison, the larger
element is always pushed towards its place at the end of the list.

81
Miss gwenzi form 1 notes
In the second iteration, the second-largest element will be bubbled up to its correct place in the
same manner:
(5 2) 8 4 6 3 9 --> compare 5 and 2, swap
2 (5 8) 4 6 3 9 --> compare 2 and 8, no swap
25 (8 4) 6 3 9 --> compare 8 and 4, swap
25 4 (8 6) 3 9 --> compare 8 and 6, swap
25 4 6 (8 3) 9 --> compare 8 and 3, swap
25 4 6 3 8 9 --> no need to compare last two
In the next pass through the list, the 6 would bubble up to its position, then the 5, the 4, the 3, and
finally the 2. Here is a complete trace of the bubble sort algorithm on a ten element data set:

Step-by-step example
Let us take the array of numbers "5 1 4 2 8", and sort the array from lowest number to greatest
number using bubble sort algorithm. In each step, elements written in bold are being compared.

First Pass:
( 51 4 2 8 ) ( 15 4 2 8 ), Here, algorithm compares the first two elements, and swaps them since 5
>1
( 1 54 2 8 ) ( 1 45 2 8 ), It then compares the second and third items and swaps them since 5 > 4
( 1 4 52 8 ) ( 1 4 25 8 ), Swap since 5 > 2
( 1 4 2 58 ) ( 1 4 2 58 ), Now, since these elements are already in order (8 > 5), algorithm does
not swap them.

The algorithm has reached the end of the list of numbers and the largest number, 8, has bubbled to
the top. It now starts again.

Second Pass:
( 14 2 5 8 ) ( 14 2 5 8 ), no swap needed
( 1 42 5 8 ) ( 1 24 5 8 ), Swap since 4 > 2
( 1 2 45 8 ) ( 1 2 45 8 ), no swap needed
( 1 2 4 58 ) ( 1 2 4 58 ), no swap needed

Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm
needs one whole pass without any swap to know it is sorted.

Third Pass:
( 12 4 5 8 ) ( 12 4 5 8 )
( 1 24 5 8 ) ( 1 24 5 8 )
( 1 2 45 8 ) ( 1 2 45 8 )
( 1 2 4 58 ) ( 1 2 4 58 )

Finally, the array is sorted, and the algorithm can terminate.

QUICK SORT
 The Quick Sort is a recursive algorithm which is very similar to the Merge Sort.
 It takes an element in a list and uses that element as a pivot value to divide the whole list into
two parts. This division is done so that one of the parts contains elements less than the pivot.
The other part contains elements that are larger than the pivot.
 This process is then repeated recursively on these two resultant parts. When the algorithm
arrives at a single element to be sorted, nothing is done as this single element is "sorted".

82
Miss gwenzi form 1 notes
 The role of the pivot value is to assist with splitting the list. The actual position where the pivot
value belongs in the final sorted list, commonly called the split point, will be used to divide the
list for subsequent calls to the quick sort.

Figure 12 shows that 54 will serve as our first pivot value. Since we have looked at this example a
few times already, we know that 54 will eventually end up in the position currently holding 31. The
partition process will happen next. It will find the split point and at the same time move other
items to the appropriate side of the list, either less than or greater than the pivot value.

Figure 12: The First Pivot Value for a Quick Sort

Partitioning begins by locating two position markers—let’s call them leftmark and rightmark—at
the beginning and end of the remaining items in the list (positions 1 and 8 in Figure 13). The goal of
the partition process is to move items that are on the wrong side with respect to the pivot value
while also converging on the split point.

Figure 13 shows this process as we locate the position of 54.

Figure 13: Finding the Split Point for 54

We begin by incrementing leftmark until we locate a value that is greater than the pivot value. We
then decrement rightmark until we find a value that is less than the pivot value. At this point we

83
Miss gwenzi form 1 notes
have discovered two items that are out of place with respect to the eventual split point. For our
example, this occurs at 93 and 20. Now we can exchange these two items and then repeat the
process again.

At the point where rightmark becomes less than leftmark, we stop. The position of rightmark is
now the split point. The pivot value can be exchanged with the contents of the split point and the
pivot value is now in place (Figure 14). In addition, all the items to the left of the split point are less
than the pivot value, and all the items to the right of the split point are greater than the pivot value.
The list can now be divided at the split point and the quick sort can be invoked recursively on the
two halves.

Figure 14: Completing the Partition Process to Find the Split Point for 54

The quickSort function shown in CodeLens 7 invokes a recursive function, quickSortHelper.


quickSortHelper begins with the same base case as the merge sort. If the length of the list is less
than or equal to one, it is already sorted. If it is greater, then it can be partitioned and recursively
sorted. The partition function implements the process described earlier.

Quicksort
 quick for long lists of numbers

The Top-Down Approach


 With the top-down approach, we start with our top-level program, then divide and sub-divide
it into many different modules.
 The division process is known as stepwise refinement. As we design each module, we will
discover what kind of submodules we will need, then go on to program those.
 After programming our smaller submodules, we will group them together into the larger
module. In the diagram, each level of refinement is labelled as LN.
 One advantage of the top-down approach is that we see the full picture at first.

84
Miss gwenzi form 1 notes
 The principles of top-down design dictate that a program should be divided into a main module
and its related modules.
 Each module should also be divided into sub modules according to software engineering and
programming style.
 The division of modules processes until the module consists only of elementary processes that
are intrinsically (basically) understood and cannot be further subdivided.
 Top-down algorithm design is a technique for organizing and coding programs in which a
hierarchy of modules is used, and breaking the specification down into simpler and simpler
pieces, each having a single entry and a single exit point, and in which control is passed
downward through the structure without unconditional branches to higher levels of the
structure.
 top-down programming tends to generate modules that are based on functionality, usually in
the form of functions or procedures or methods.
 In C, the idea of top-down design is done using functions. A C program is made of one or more
functions, one and only one of which must be named main. The execution of the program always
starts and ends with main, but it can call other functions to do special tasks.

The Bottom-Up Approach


 The bottom-up approach, as the name suggests, starts from the bottom of our structure and
slowly gets to the top.
 To be more precise, we start by creating the smallest modules, put them together to form larger
modules, and continue the process until we have our whole thing built.
 This approach to programming is especially useful when we already have pre-made modules at
our disposal.

 Bottom-up algorithm design is the opposite of top-down design.


 It refers to a style of programming where an application is constructed starting with existing
primitives of the programming language, and constructing gradually more and more
complicated features, until the all of the application has been written.
 That is, starting the design with specific modules and builds them into more complex
structures, ending at the top.
 The bottom-up method is widely used for testing, because each of the lowest-level functions is
written and tested first.
 This testing is done by special test functions that call the low-level functions, providing them
with different parameters and examining the results for correctness. This process continues,
moving up the levels, until finally the main function is tested.

PROGRAMMING PARADIGMS
Programming paradigm refers to how a program is written in order to solve a problem.
Programming can be classified into three categories:
 Unstructured Programming
 Structural Programming

85
Miss gwenzi form 1 notes
 Object-Oriented Programming

Unstructured Programming
 Unstructured style of programming refers to writing small and simple programs consisting of
only one main program.
 All the actions such as inputs, outputs, and processing are done within one program only.

Structural Programming
 Using structural programming, a program is broken down into small independent tasks that are
small enough to be understood easily, without having to understand the whole program at once.
 Each task has its own functionality and performs a specific part of the actual processing.
 These tasks are developed independently, and each task can carry out the specified task on its
own, without the help of any other task.
 When these tasks are completed, they are combined together to solve the problem.

Object-Oriented Programming
 Object-oriented programming is a style of computer programming, which promotes building of
independent pieces of code that interact with each other.
 It allows pieces of programming code to be reused and interchanged between programs.

Low level languages - e.g. assembly language


 machine oriented
 each assembly code statement translates to one machine code instruction
 used when there is a requirement to manipulate individual bits and bytes, write code that
executes as fast as possible, or occupies as little memory as possible

High level languages


 human oriented
 statements resemble English sentences or mathematical expressions
 easier to learn and understand
 each statement in a high level language will translate into several machine code instructions
 built in functions, selection, iteration and data structures such as string, array, record

Procedural (imperative) languages - e.g. Pascal, C, COBOL, BASIC


 program consists of a sequence of instructions which the computer will execute in a specified
order

Object class - collection of characteristics and procedures that an object within the classification can
have or perform

Class - set of objects which share a common behaviour

Object - e.g. form, dialogue box, command button

Encapsulation - process of bundling together procedures and data

Inheritance - a relationship among classes wherein one class shares the structure and behaviour of
another class

Polymorphism - two or more classes derived from the same base class but with some unique
features of their own

86
Miss gwenzi form 1 notes

Inherited polymorphism - objects of different classes process same message because they inherit it
from common ancestor

Independent polymorphism - different classes use same field or method name for different values
or activities

Error Types (Visual Basic)


In Visual Basic, errors (also called exceptions) fall into one of three categories: syntax errors, run-
time errors, and logic errors.

Syntax Errors
 Syntax errors are those that appear while you write code. Visual
 Basic checks your code as you type it in the Code Editor window and alerts you if you make a
mistake, such as misspelling a word or using a language element improperly.
 Syntax errors are the most common type of errors. You can fix them easily in the coding
environment as soon as they occur.
Note
The Option Explicit statement is one means of avoiding syntax errors. It forces you to declare, in
advance, all the variables to be used in the application. Therefore, when those variables are used in
the code, any typographic errors are caught immediately and can be fixed.

Run-Time Errors
 Run-time errors are those that appear only after you compile and run your code.
 These involve code that may appear to be correct in that it has no syntax errors, but that will
not execute. For example, you might correctly write a line of code to open a file. But if the file is
corrupted, the application cannot carry out the Open function, and it stops running.
 You can fix most run-time errors by rewriting the faulty code, and then recompiling and
rerunning it.

Logic Errors
 Logic errors are those that appear once the application is in use.
 They are most often unwanted or unexpected results in response to user actions. For example, a
mistyped key or other outside influence might cause your application to stop working within
expected parameters, or altogether.
 Logic errors are generally the hardest type to fix, since it is not always clear where they
originate.
FILE ORGANISATION AND DATABASE CONCEPTS

FILE ORGANIZATION

TYPES OF FILE ORGANIZATION

o Serial
o Sequential
o Indexed Sequential
o Direct Access /Random Access

Serial File Organization

87
Miss gwenzi form 1 notes
 A collection of records with no particular sequence
 Cannot be used as master but as temporary transaction file
 Records are stored in the order they are received. This means that new records are stored at
the end of the file.
 The entries were received in the order: Kettlewood, Queens Park, St Mary’s, Wilton High, and
WestOrling.

Centre Number Centre Name No of Candidates


27102 Kettlewood 85
38240 Queens Park 103
64715 St Mary’s 121
30446 Wilton High 156
12304 West Orling 105

 Note that the key field in this file would be Centre Number (it uniquely identifies each school)
 Both disks and tapes can be used to store a file serially.

Sequential File Organization

 A collection of records stored in key sequence


 To add/delete a record youre-write the whole file to another disk
 Used as master files
 A sequential file is one in which the records are stored, one after the other, in the order of the
key field.
 The entries were added in the order: Kettlewood, Queens Park, St Mary’s, Wilton High, West
Orling but they are stored in the order of the key field – Centre Number:

Centre Number Centre Name No of Candidates


12304 West Orling 105
27102 Kettlewood 85
30446 Wilton High 156
38240 Queens Park 103
64715 St Mary’s 121

 As with a serial file, both tape and disks can be used to store a file sequentially and access to the
records must take place from the beginning of the file.
 Sequential files allow the records to be displayed in the order of the key field – this makes the
process of adding a record slower, but significantly speeds up searches.

 All records are stored in some sort of order (ascending, descending, alphabetical).
 The order is based on a field in the record. For example a file holding the records of
employeeID, date of birth and address. The employee ID is used and records stored is group
accordingly (ascending/descending).
 Can be used with both direct and sequential access.

88
Miss gwenzi form 1 notes
Advantages
 Simple file design
 Very efficient when most of the records must be processed e.g. Payroll
 Very efficient if the data has a natural order
 Can be stored on inexpensive devices like magnetic tape.

Disadvantages
 Entire file must be processed even if a single record is to be searched.
 Transactions have to be sorted before processing
 Overall processing is slow

Direct (Random) File Organization


 records are stored and retrieved according to their disk address / relative position within file
 to add, use the hashing algorithm to work out the appropriate memory location
 to delete, set flag = 0 but leave the value there, therefore space can be reused but is not actually
empty
 to search for a record continue until either the record is found or empty space is encountered
 The records are stored randomly but each record has its own specific position on the disk
(address).
 With this method no time could be wasted searching for a file. Instead it jumps to the exact
position and access the data/information.
 Can only be used with direct access method.A random file would have to be stored on a direct
access backing storage medium e.g. magnetic disc, CD, DVD
 A random access file is one in which a record can be written or retrieved without first
examining other records.
 A random access file must be stored on disk and the disk address is calculated from the primary
key.In its simplest form a record with a primary key of 1 will be stored at block 1, a record with
a primary key of 2 will be stored at block 2; a record with primary key 3 will be stored at block
3 etc:
It should be noted that this very simple method where [disk address] = [primary key] is very
inefficient in respect of disk space. For example:
o If the lowest primary key is 1001, then all the disk space below block 1001 will be wasted.
o If there are some values which the primary key never takes (for example odd values) –
these storage spaces will be wasted.
 In order to be more efficient with the use of disk space, random access files calculate disk
addresses by using a hashing algorithm (also known as just hashing).

Hashing
 Hashing is a calculation that is performed on a primary key in order to calculate the storage
address of a record.
 A hashing algorithm will typically divide the primary key by the number of disk blocks that
are available for storage, work out the remainder and add the start address. The answer will
be the storage address of the record.

[Disk address] = [primary key] MOD [number of blocks] + [start address]

Example
If a file was to be stored on the first 5000 blocks of a disk then: [disk address] = [primary key] MOD
5000

89
Miss gwenzi form 1 notes
That is, the primary key of each of the records would be divided by 5000 and the remainder would
be the disk address for the record.

This means that a record with primary key of 27102 would be stored at the disk address
calculatedas follows:
27102 MOD 5000= 5 remainder 2102

This means that the disk address for this record will be 2102.

The table shows some other disk addresses calculated using the same hashing algorithm:
Centre Number Centre Name No of Candidates Disk Address
27102 Kettlewood 85 2102
38240 Queens Park 103 3240
64715 St Mary’s 121 4715
30446 Wilton High 156 446
12304 West Orling 105 2304

Advantages
 Any record can be directly accessed.
 Speed of record processing is very fast.
 Up-to-date file because of online updating.
 Concurrent processing is possible.

Disadvantages
 More complex than sequential
 Does not fully use memory locations
 More security and backup problems

Indexed sequential file


 Each record of a file has a key field which uniquely identifies that record.
 An index consists of keys and addresses.
 An indexed sequential file is a sequential file (i.e. sorted into order of a key field) which has
an index.
 A full index to a file is one in which there is an entry for every record.

90
Miss gwenzi form 1 notes

 Indexed sequential files are important for applications where data needs to be accessed.....
o sequentially
o Randomly using the index.
 An indexed sequential file can only be stored on a random access device e.g. magnetic disc, CD.
 The records is stores in some order but there is a second file called the index-file that indicates
where exactly certain key points. Cannot be used with sequential access method.

Advantages
 Provides flexibility for users who need both type of accesses with the same file
 Faster than sequential

Disadvantages
 Extra storage space for the index is required

File Access Method


This is the way by which information/data can be retrieved. There are two methods of file accesses:

o Direct/Random Access
o Sequential Access
o Serial Access

Direct Access
 In this access method the information/data stored on a device can be accessed randomly and
immediately irrespective to the order it was stored.
 The data with this access method is quicker than sequential access. This is also known as
random access method. For example Hard disk, Flash Memory
 Direct Access
• Also known as Relative Access
• Fixed length logical records
• No particular order for read and write
• Based on disk model of a file
• File viewed as a numbered sequence of blocks or records

91
Miss gwenzi form 1 notes

 Direct Access
• Useful for immediate access to large volumes of data
• Most suitable for database applications
• Easy to read, write and delete a record

 Applications for Direct access


• Airline reservation system
• Customer account processing in a bank

Sequential Access
 In this access method the information/data stored on a device is accessed in the exact order in
which it was stored.
 Sequential access methods are seen in older storage devices such as magnetic tape.
 Sequential Access
• Simplest access method
• Information processed in order
• Most common
• Used by editors and compilers
• Based on a tape model of a file

 Applications for sequential access


• Payroll of employees
• Student data processing

Serial Access
 When a serial access medium is being used, the head that reads data from the storage medium
has limited freedom of movement. The only serial access medium is magnetic tape.
 To read a particular record/file from a serial access medium, all of the data that comes before
the record/file must be scanned through. The tape head cannot move to a particular record/file
on the tape without reading through all of the other records that come before it.
 Because of this it can take a very long time to locate a record/file on a tape and so tapes are only
used for specific applications such as backup and batch processing. For these applications the
speed of locating data is not important and the other advantages of magnetic tapes outweigh
the slow access speed.

Indexed Sequential Access:


 This access method is a slight modification of the direct access method.
 It is in fact a combination of both the sequential access as well as direct access.
 The main concept is to access a file direct first and then sequentially from that point onwards.
 This access method involves maintaining an index. The index is a pointer to a block.
 To access a record in a file, a direct access of the index is made. The information obtained from
this access is used to access the file. For example, the direct access to a file will give the block
address and within the block the record is accessed sequentially.
 Sometimes indexes may be big. So hierarchies of indexes are built in which one direct access of
an index leads to access another index directly and so on till the actual file is accessed
sequentially for the particular record.

92
Miss gwenzi form 1 notes
 The main advantage in this type of access is that both direct and sequential access of files is
possible.

DATABASE CONCEPTS
 Database: A collection of related information stored in a structured format.
 DBMS: Database management system. Is a program which lets you manage information in
databases.
 Conceptual data model - describes how data elements in the system are to be grouped
 Entity - thing of interest about which data is to be held e.g. student
 Attribute - property or characteristic of an entity
 Relationship - link or association between entities
 Entity-relationship diagram - diagrammatic way of representing the relationship between the
entities in a database
 Field: Fields describe a single aspect of each member of a table. A student record, for instance,
might contain a last name field, a first name field, a date of birth field and so on.
 Foreign key: A key used in one table to represent the value of a primary key in a related table.
While primary keys must contain unique values, foreign keys may have duplicates. For instance,
if we use student ID as the primary key in a Students table (each student has a unique ID), we
could use student ID as a foreign key in a Courses table: as each student may do more than one
course.
 Primary key: A field that uniquely identifies a record in a table.
 RDBMS: relational database management system. a program which lets you manage
structured information stored in tables and which can handle databases consisting of multiple
tables.
 Record: a record contains all the information about a single ‘member’ of a table, in a students’
table, each student’s details (name, date of birth, contact details, and so on) will be contained in
its own record. Records are also known as tuples in technical relational database parlance.
 Relational database: A database consisting of more than one table. In a multi-table database, you
not only need to define the structure of each table, you also need to define the relationships
between each table in order to link those tables correctly.
 Report: A form designed to print information from a database (either on the screen, to a file or
directly to the printer).
 Table: A single store of related information. A table consists of records, and each record is made
up of a number of fields. Just to totally confuse things, tables are sometimes called relations.
 Schema - different levels or views from which a database may be considered
 Secondary Key - not unique to each record but may be used to quickly locate a group of
records

Some of the alternative terminology used in database theory:


Table Relation File
Row Tuple Record
Column Attribute Field
The Database Administrator (DBA):
 Maintains the data dictionary/phrase book.
 Provides users with a suitable interface to the data.
 Controls user access to the data via password and access permissions.
 Looks after data security including backup processes and disaster recovery plans.

93
Miss gwenzi form 1 notes
What makes computerized databases much more popular than paper based or traditional
file approach?
Computerized Paper based/traditional file approach
Can hold vast amount of data Limited by physical storage space available
Very fast to find a specific record Time consuming to manually search through all
of the records
Easy to search for a specific record Difficult to search for a specific record
Can be used to analyse the data Very difficult to analyse the data
Data can be sorted using multiple criteria e.g. Difficult to sort data in more than one criteria
ascending order
Easier to update or amend a record e.g. Changes have to be done manually and data may
customer address after moving house end up untidy
Records are stored safely and they are available Records can be lost or misfiled making it hard to
when needed find them
The database can be kept secure by use of The only security would be locking up the
passwords records
Easy to make a back-up in case of data loss Difficult to make back-up because every page
would have to be rewritten

Advantages of a file based database


 All records are stored in one place
 Easy to understand
 You can use a single table in a DBMS to store it

Problems with the traditional file approach:-


 Data redundancy - same data duplicated in many different files
 Data inconsistency - when the same items of data are held in several different files, the data
should be updated in each file when it changes (if not -> data inconsistency)
 Program-data dependence - file format must be specified in each program. Changes to the
format of the data fields mean that every file which uses that program has to be changed
 Lack of flexibility - for non-routine data it could take weeks to assemble data from various files
and write new programs to produce the required reports
 Non-sharable data - if two departments need the same data, either a second copy of the data
would be made (-> data inconsistency) or the same file used (adding extra fields would mean
programs would need to be changed to reflect the new file structure)

Databases – Advantages
 Data independence - changes to the data structure do not affect the programs that access the
data.
 No data duplication.
 Data is updated via a single input.
 Data consistency - because it is easier to update
 Ad hoc enquiries are possible through the use of a query language.
 It is easier to control access to the data by the users since data is in one place.

Databases – Disadvantages
 Databases are complex systems so they require considerable skills and expertise to design and
manage them.
 There will be greater impact if the system fails since every application that uses it is affected.

94
Miss gwenzi form 1 notes
 More complex recovery procedures are needed when then the system corrupts.
 Larger size than conventional file approach so may require more powerful computer systems.
 If the data entered is wrong then all applications see the wrong data!
 Lack of security - all data in the database is accessible by all applications

Database system architecture


 Database system architecture means design or construction of database system.
 The architecture of most commercial database systems is based on the three-level architecture
proposed by Data Base Task Group (DBTG).

The Three Level Architecture: (ANSI SPARC)


 Databases can be viewed at three levels, known as external, conceptual and internal levels.
These levels form three-level architecture.
 Model refer to the structure of database, a database model describes the data, the relationships
between the data items, constraints on the data, and data meanings etc.
 The structure of database is called the intension of the database, or the database schema.
 Schema - different levels or views from which a database may be considered
 The data stored into the database at a given time is called the extension of database, or a
database instance.

The purpose of the three-level architecture is to separate the user applications and the physical
database. The reasons of this separation are:
o Different users need different views of the same data.
o Users should not have to deal directly with the physical database storage details.
o The DBA should be able to change the database storage structure or storage device without
affecting other user's views and applications.
Figure 2.1 shows the three-level architecture of the database system.
User view 1 User view 2 User view n

External schema

Conceptual schema

Internal schema

Database

External Level (User Views)

95
Miss gwenzi form 1 notes
 Describes a part of the database that is relevant to a particular user.
 Represent each user’s view according to his or her needs and access rights
 It hides the conceptual, internal, and physical details from the user.
 It excludes irrelevant data as well as data which the user is not authorized to access.

Conceptual Level / Logical schema


 The middle Level in the three-level architecture is a conceptual level, which is also referred to
as logical level.
 Describesthe data stored within the whole database and how the data is inter-related.
 It describes the entire structure of database such as entities, attributes, data types,
relationships, constraints, and user operations.
 The conceptual level supports the external level to present the data to end-users as they need.
 The conceptual level does not specify how the data is physically stored.

Internal Level
 The internal level is also referred to as physical / storage level.
 The internal level describes how the data is stored in the database.
 Concerned with file organization and access methods on storage devices
 It also describes how the data is actually stored in the database and on the computer hardware.

Database Schema
The database schema provides an overall description of the database structure (not actual data).
There are three types of schema which relate to the 3 Level Database Architecture.

External Schemas or sub schemas relate to the user views. The Conceptual Schema describes all the
types of data that appear in the database and the relationships between data items. Integrity
constraints are also specified in the conceptual schema. The Internal Schema provides definitions
for stored records, methods of representation, data fields, indexes, and hashing schemes etc...

Mappings and Data Independence


 Mappings between the different database schemas allows for data independence.
 The (DBMS) is responsible for managing these mappings and checking the schemas for
consistency.

Internal-Conceptual mappings
 Enable the DBMS to find records within the database storage medium that correspond to the
logical record in the conceptual schema.
External-Conceptual mappings
 Enable the DBMS to match names of data items etc... In the user's view with the parts of the
conceptual schema that correspond to those items.

96
Miss gwenzi form 1 notes

Data Independence
Data Independence means that the higher levels of the database model are designed to be
unaffected by changes to the lower levels (internal and physical). There are two types of Data
Independence.

- Logical data independence


- Physical data independence

Logical Data Independence


 Involves the external schema being unaffected by changes in the conceptual schema. For
example, a new field can be added to a table (relation) without any changes to application
programs etc... being required.

Physical Data Independence


 Means that the conceptual schema is not affected by changes made to the internal schema. An
example of a change to the internal schema would be changing the storage device used to store
the database data. This would not affect the conceptual or external schemas / layers.

Database Management System (DBMS)


 application program that provides an interface between the OS and the user in order to make
access of the data as simple as possible
 allows users to store, retrieve and update information without having to be aware of the
structure of the database
 ensures that problems do not arise when two people simultaneously try to access and update a
record
 has ability to recover database in event of system failure
 handles password allocation and access rights
 It is used by the Database Administrator to construct and maintain the database.

Functions of the DBMS


 Data storage, retrieval and update: the DBMS must allow users to store retrieve and update
information as easily as possible, without having to be aware of the internal structure of the
database.
 Creation and maintenance of data dictionary
 Managing the facilities for sharing the database: the DBMS has to ensure that problems do
not arise when two people simultaneously access a record and try to update it
 Backup and recovery: the DBMS must provide the ability to recover the database in the event
of system failure
 Security: the DBMS must handle password allocation and checking, and the view of the
database that a given user is allowed

Advantages of DBMS
Due to the centralised management and control, the database management system (DBMS) has
numerous advantages. Some of these are as follows:
 Minimal data redundancy: unnecessary duplication of data is avoided, since views of
different data files are integrated during database design into a single, logical, centralised
structure.

97
Miss gwenzi form 1 notes
 Program-data independence: In the database environment, it allows for changes at one level
of the database without affecting other levels. These changes are absorbed by the mappings
between the levels.
 Efficient data access: DBMS utilizes a variety of sophisticated techniques to store and retrieve
data efficiently.
 Improved data sharing: Since, database system is a centralised repository of data belonging to
the entire organisation it can be shared by all authorized users. Existing application programs
can share the data in the database.
 Improved data consistency: Inconsistency (variation) is the outcome to redundancy. So, if the
redundancy is removed or controlled, chances of having inconsistence data is also removed and
controlled.
 Improved data integrity: Data integrity means that the data contained in the database is both
accurate and consistent.
 Improved security: Database security is the protection of database from unauthorised users.
The database administrator (DBA) ensures that proper access procedure is followed, by
defining user names and passwords to identify people authorised to use the database.
 Enforcement of standards: With central control of the database, a DBA defines and enforces
the necessary standards.
 Economy of scale: Centralising of the entire organisation’s operational data into one database
results in drastic cost savings.
 Balance of conflicting requirements: Knowing the overall requirements of the organisation
the DBA resolves the conflicting requirements of various users and applications.
 Improved data accessibility and responsiveness: As a result of integration in database
system, data that crosses departmental boundaries is directly accessible to the end-users.
 Increased concurrency: DBMSs manage concurrent (simultaneous) databases access and
prevents the problem of loss of information or loss of integrity.
 Reduced program maintenance: The problems of high maintenance effort required in file-
oriented system are reduced in database system.
 Improved backup and recovery services: DBMS provides facilities for recovering from
hardware or software failures through its backup and recovery subsystem.
 Improved data quality: The database system provides a number of tools and processes to
improve data quality.

Disadvantages of DBMS
In spite of the advantages, the database approach entails involves) some additional costs and risks
that must be recognized and managed when implementing DBMS. The following are the
disadvantages of using DBMS:
 Increased complexity: A multi-user DBMS becomes an extremely complex piece of software
due to expected functionality from it.
 Requirement of new and specialized manpower: Because of rapid changes in database
technology and organisation’s business needs, the organisation need to hire, train or retrain its
manpower on regular basis to design and implement databases.
 Large size of DBMS: The large complexity and wide functionality makes the DBMS an
extremely large piece of software. It occupies many gigabytes of storage disk space and requires
substantial amounts of main memory to run efficiently.
 Increased installation and management cost: The large and complex DBMS software has a
high initial cost. It requires trained manpower to install and operate and also has substantial
annual maintenance and support costs.
 Additional hardware cost:due to the DBMS’s complexity the hardware need to be upgraded
time and again
 Conversion cost: The cost of conversion (both in terms of money and time) from legacy system

98
Miss gwenzi form 1 notes
(old file-oriented and/or older database technology) to modern DBMS environment is very
high.
 Need for explicit (precise) backup and recovery: For a centralised shared database to be
accurate and available all times, a comprehensive procedure is required to be developed and
used for providing backup copies of data and for restoring a database when damage occurs.
 Organisational conflict: A centralised and shared database requires a consensus on data
definitions and ownership as well as responsibilities for accurate data maintenance. Sometimes
there are conflicts on data definitions, data formats and coding, rights to update shared data,
and associated issues, which are frequent and often difficult to resolve.

Data Dictionary:
 Is that part of the database that holds data about the database?
 It is an important part of the DBMSit contains data about data (or metadata). It means that data
dictionary contains the actual database descriptions managed by the DBMS.
 Data dictionary is automatically updated as data is inserted and updated with the passage of
time.

The data dictionary contains the following, information.


- Logical structure of database such as table names, column names of each table and their
data types and other properties, indices created in a table, and stored procedure names etc.
- Schemas, mappings and constraints.
- Description about application programs.
- Description about physical database design such as storage structures, access paths etc.
- Descriptions about users of DBMS and their access rights.
 It also keeps record of accessing the database.

A table is given below, which shows the description of a table structure of database.
Field Size Type Value Range or Value Used In Tables
Format
Roll-No 2 Integer 1 - 99 Student,
Defaulters
Name 15 Character a - z, A - Z Student,
Defaulters
Class 3 Character A-Z Student,
Defaulters
Date-of- 8 Date MM, DD, YYYY Student
Birth

Different Types of Database Languages:


 Database language is an important part of DBMS, it is used to access the required data from a
database, to modify the data of database and to design the structure of database.
 A user uses a database language for interfacing with the DBMS to access the data from database.

The sub-language is further divided into two major parts. These are:
o Data Definition Language.
o Data Manipulation Language.

Data Definition Language:


 language used to define the logical structure and the files within the database
 In most DBMSs, the DDL is used to define both conceptual and external schemas.

99
Miss gwenzi form 1 notes
 The mappings between the two schemas may be defined in this language.
 The DBMS has a DDL compiler, which compiles the DDL statements and stores it in the DBMS
catalog known as data dictionary.

Data Manipulation Language:


 Once the database is designed and database is populated with data, the Data Manipulation
Language (DML) is used to manipulate (control) the database.
 In data manipulation, data is retrieved, inserted, updated, and deleted to and from the database.
DDL is not used for data manipulation.

There are two main types of Data Manipulation Language (DML) These are:
o Non-Procedural DML
o Procedural DML

Non-Procedural DML:
 A high-level or non-procedural DML allows the user to specify what data is required without
specifying how it is to be obtained.
 The end-users use a high-level query language to specify their requests to DBMS to retrieve
data.
 The part of a non-procedural DML, which is related to data retrieval from databases, is known
as Query Language.

Procedural DML:
 A low-level or procedural DML allows the user, i.e. programmer to specify what data is needed
and how to obtain-it.
 This type of DML typically retrieves individual records from the database and processes each
separately.

Structured Query Language (SQL)


 data access language which deals with the manipulation of tables and data
 SQL lets you access databases
 SQL is an ANSI (American National Standards Institute) standard
 SQL is used to communicate with a database.
 According to ANSI (American National Standards Institute), it is the standard language for
relational database management systems.
 SQL statements are used to perform tasks such as update data on a database, or retrieve data
from a database. Some common relational database management systems that use SQL are:
Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc.
 It is a query language used for accessing and modifying information in a database. Some common
SQL commands include "insert," "update," and "delete."

What Can SQL do?


o SQL can execute queries against a database
o SQL can retrieve data from a database
o SQL can insert records in a database
o SQL can update records in a database
o SQL can delete records from a database
o SQL can create new databases
o SQL can create new tables in a database
o SQL can create stored procedures in a database

100
Miss gwenzi form 1 notes
o SQL can create views in a database
o SQL can set permissions on tables, procedures, and views

DATA MODELS:
 A model is an abstract of a real system
 A data model (or database model) is a collection of concepts that can be used to describe the
structure of a database. It means that the data types, relationships between data, and
constraints that should hold on the data are described.
 The purpose of a data model is to represent data and to make the data understandable. By using
the data model, you can easily design a database.

The major types of these models are;


o Hierarchical Data Model.
o Network Data Model.
o Relational Data Model.

Hierarchical Data Model:


 The hierarchical data model is the oldest database model.
 The general shape of this model is like an Organizational chart and used the tree as its basic
structure.
 Consists of a hierarchy of nodes, with a single node, called the root, at the highest level. A node
represents a particular entity. A node may have any number of children, but each child node
may have only one parent node.
 This kind of structure is often referred to as "Inverted Tree". The parent-to-child creates one-to-
many relationship, but the child-to-parent creates one-to-one relationship.
 In hierarchical data model, records are arranged in a top-down structure.
 The nodes of the tree represent data records
 The relationships are represented as links or pointers between nodes.
 The figure 2.5 shows structure of a hierarchical data model for the 'University' system. In this
example, "University" is the root node and "Departments" are its children. Each department is
further divided into branches and so on.

Network Data Model:


 The network data model was developed to overcome the limited scope of hierarchical model.
 The network model uses a network structure, which is a data structure consisting of nodes and
branches.
 In this model, there is no difference between parent and child nodes as in the hierarchical
model. Each node may be related to more than one node.
 In the figure 2.6, network data model for 'university' system is shown. In the figure, the
'Mathematics Department' node is associated with 'Computer Department' node. Similarly,
'Computer Lab' and 'Library' nodes are associated with both the 'Mathematics Department' and
'Computer Department' nodes.

101
Miss gwenzi form 1 notes

The relational model


 A relational database is a collection of 2-dimensional tables which consist of rows and columns.
Tables are known as "relations", columns are known as "attributes" and rows (or records) are
known as "tuples".
 Tables / Relations are a logical structure therefore they are an abstract concept and they do not
represent how the data is stored on the physical computer system. Each column / attribute in a
relation represents an attribute of an entity. A single row / tuple contains all the information (in
the form of attributes) about a single entity.
 The "cardinality" of a relation is the number of row / tuples it has. The "degree" of a relation
refers to the number of columns / attributes in that relation. The order of records and columns
is irrelevant. Relations and columns should always be uniquely named and therefore uniquely
indentifiable. No duplicate rows occur in a single relation.
 Each cell of a relation contains a single value or element which is atomic. This means that arrays
or lists, for example, would not be stored under a single attribute. Multi-valued attributes are
possible though but this involves a technique of referring to another relation which holds these
multiple values.

Figure 2. A hypothetical relational database model

ENTITY-RELATIONSHIP (ER) DIAGRAM


 An entity-relationship (ER) diagram is a specialized graphic that illustrates the relationships
between entities in a database.
 ER diagrams often use symbols to represent three different types of information. Boxes are
commonly used to represent entities. Diamonds are normally used to represent relationships
and ovals are used to represent attributes.

102
Miss gwenzi form 1 notes

Cardinality of Relationship
While creating relationship between two entities, we may often need to face the cardinality
problem. This simply means that how many entities of the first set are related to how many entities
of the second set. Cardinality can be of the following three types.

One-to-One
 Only one entity of the first set is related to only one entity of the second set.
 E.g. A teacher teaches a student. Only one teacher is teaching only one student. This can be
expressed in the following diagram as:

One-to-Many

 Only one entity of the first set is related to multiple entities of the second set.
 E.g. A teacher teaches students. Only one teacher is teaching many students. This can be
expressed in the following diagram as:

Many-to-One
 Multiple entities of the first set are related to multiple entities of the second set.
 E.g. Teachers teach a student. Many teachers are teaching only one student. This can be
expressed in the following diagram as:

Many-to-Many
 Multiple entities of the first set is related to multiple entities of the second set.
 E.g. Teachers teach students. In any school or college many teachers are teaching many students.
This can be considered as a two way one-to-many relationship. This can be expressed in the
following diagram as:

Tips on How to Draw ER Diagrams


1. Identify all the relevant entities in a given system and determine the relationships among these
entities.
2. An entity should appear only once in a particular diagram.

103
Miss gwenzi form 1 notes
3. Provide a precise and appropriate name for each entity, attribute, and relationship in the
diagram. Terms that are simple and familiar always beats vague, technical-sounding words. In
naming entities, remember to use singular nouns. However, adjectives may be used to
distinguish entities belonging to the same class (part-time employee and full time employee, for
example). Meanwhile attribute names must be meaningful, unique, system-independent, and
easily understandable.
4. Remove vague, redundant or unnecessary relationships between entities.
5. Never connect a relationship to another relationship.
6. Make effective use of colors. You can use colors to classify similar entities or to highlight key
areas in your diagrams.

ER Diagram Templates
Below are some ER diagram templates so you can get started quickly. Clicking on the image and in
the new page that opens click the “Use as Template” button.

ER Diagram Template of exam database

A basic ER diagram template for a quick start

Benefits of ER diagrams
 ER diagrams constitute a very useful framework for creating and manipulating databases.
 First, ER diagrams are easy to understand and do not require a person to undergo extensive
training to be able to work with it efficiently and accurately. This means that designers can use
ER diagrams to easily communicate with developers, customers, and end users, regardless of
their IT proficiency.
 Second, ER diagrams are readily translatable into relational tables which can be used to quickly
build databases. In addition, ER diagrams can directly be used by database developers as the
blueprint for implementing data in specific software applications.
 Lastly, ER diagrams may be applied in other contexts such as describing the different
relationships and operations within an organization.

104
Miss gwenzi form 1 notes
Database Security Threats and Countermeasures
 Databases need to have level of security in order to protect the database against both malicious
and accidental threats.
 A threat is any type of situation that will adversely affect the database system. Some factors that
drive the need for security are as follows:
o Theft and fraud
o Confidentiality
o Integrity
o Privacy
o Database availability
 Threats to database security can come from many sources. People are a substantial source of
database threats. Different types of people can pose different threats.
 Users can gain unauthorised access through the use of another person's account. Some users
may act as hackers and/or create viruses to adversely affect the performance of the system.
Programmers can also pose similar threats.
 The Database Administrator can also cause problems by not imposing an adequate security
policy.

Some threats related to the hardware of the system are as follows:


o Equipment failure
o Deliberate equipment damage (e.g. arson, bombs)
o Accidental / unforeseen equipment damage (e.g. fire, flood)
o Power failure
o Equipment theft

Threats can exist over the communication networks that an organisation uses. Techniques such as
wire tapping, cable disruption (cutting / disconnecting), and electronic interference can all be used
to disrupt services or reveal private information.

Countermeasures
Some countermeasures that can be employed are outlined below:
o Access Controls (can be Discretionary or Mandatory)
o Authorisation (granting legitimate access rights)
o Authentication (determining whether a user is who they claim to be)
o Backup
o Journaling (maintaining a log file - enables easy recovery of changes)
o Encryption (encoding data using an encryption algorithm)
o RAID (Redundant Array of Independent Disks - protects against data loss due to disk
failure)
o Polyinstantiation (data objects that appear to have different values to users with different
access rights / clearance)
o Views (virtual relations which can limit the data viewable by certain users)
Distributed data processing system:
 Is a configuration in which many geographically dispersed computer systems are connected by
a telecommunication network, where messages, tasks, programs, data, and other resources are
transmitted between cooperating processors and terminals.
 Such an arrangement enables the sharing of many hardware and significant software resources
among several users who may be sitting far away from each other.

105
Miss gwenzi form 1 notes

Advantages:
 It allows greater flexibility in placing true computer power at the location where it is needed.
 Better computers resources are easily available to the end users.
 It facilitates quick and better access to data and information especially where distance is a
major factor.
 The availability of multiple processors in the network permits peak load sharing and provides
backup facilities in the event of equipment failure.
 User with access to nearby computer and databases may be able to react more rapidly.

Disadvantages:
 There are lack of proper security controls for protecting the confidential user programs that are
stored online and transmitted over network channels.
 Due to lack of adequate computing standard, it is not possible to link different equipment
produced by different vendors into a smoothly functioning network.
 Due to decentralization of resource at remote sites, management from central control point
becomes very difficult. This normally result in increased complexity.
 System reliability, flexibility, response time, vendor support, and the cost of
telecommunications facilities used, are some of the important factors that may disappoint
network users in some cases.
 Budget (availability of finance purchase equipment)

Batch Processing/ Offline Processing/ Stack Processing:


 In this mode data to be processed is accumulated over a period of time and processed
periodically.
 It is also known as stack processing because several jobs are stacked together and processed in
groups (batches) for efficient operations. It is used for office work like accounts, payroll, etc.
 A group of similar (routine) transactions are processed in the same processing-run. Input data
could be entered into the system over a period of time, or at the same time. But the actual
processing of the data commences only when the transactions data collection is complete and is
held in transactions files.
 A classic example of batch processing is an organization's payroll. Typically, the wages section
records transaction into small batches (e.g. one per department). In this way, most input data is
in smaller collections.
 This mode was formerly the major form of processing. It is still the most logical methods of
dealing with large transactions volumes at a specific time.
Batch Processing
Advantages Disadvantages
 Error detection is simpler  The system is time-driven and
 No special hardware/software so is not geared to rapid action
is needed (all computer  Preparing batches results in
systems should be able to duplication of efforts
adopt this).  Slow
 System design is simple  Delays decision making process
 If necessary, some part may be
processed now and the
remainder later.

106
Miss gwenzi form 1 notes
Real-Time Processing/ Online Processing/ Interactive Processing:
 Each transaction is processed as soon as at it received, there is no waiting time for
accumulation of a batch of transactions.
 Complete which can receive and process data quickly are capable for real-time processing. It is
used where immediate response is required like, banks, inventory systems, etc
Online processing
Advantages Disadvantages
 A higher level of customer  The system is relatively high-
satisfaction is achieved cost (in terms of hardware and
 Information needed is obtained software)
by adopting very simple  A high level of security is
procedures required
 Prompts and early information  System failure could causes
assists in improving and great organization problems
maintaining the quality of
management decisions

Overflow - when a number is too large for the exponent to be expressed (positive exponent)

Underflow - when a number is too near zero for the exponent to be expressed (negative exponent)

COMPUTER LANGUAGES:
Since the invention of the computers, three types of computer language have evolved:
 Machine language
 Assembly language (Low Level Language) and
 High-level languages

Characteristics of a Good Language:


 Simplicity: - languages should provide a programmer with a clear, simple, and unified set of
concepts which can be easily grasped.
 Naturalness: A language should be problem-oriented..
 Efficiency: A programming language should be such that its programs are efficiently translated
into machine code, are efficiently executed, and acquire as little space in the memory as
possible.
 Compactness: User of a high level, problem oriented language should be able to express
intended operations concisely (in brief).
 Suitability to Environment: the language must also be made suitable to its environment.
 Extensibility: A good programming language should also allow extension through simple,
natural, and elegant mechanism.

Machine Language/Language of Zero and One:


 A program written in machine language is a sequence of 1's and O's.
 This is the fundamental language of a computer, because computer can only understand the
language of zero's and one's.
 Basic instruction consists of two parts. First part of the instruction represents the operation
code (what is to be done) and second part represents the operand to the address (memory
location address) where operand is located.

107
Miss gwenzi form 1 notes
 Basic instruction set of the computer consists of add, subtract, multiply, divide, load, store, read,
write, and shift. Although machine language provides economy of instructions but they are
inconvenient to the user. They also require thorough knowledge of computer hardware.

Advantages of Machine language:


 Fast: Programs written in machine language can be executed very fast by the computer. This is
mainly because machine instructions are directly understood by the CPU and no translation of
the program is required
 Mother Language: This the fundamental language of a computer zero's and one's which is not
further translated.
 Economy of Instructions: Basic instruction set of the computer consists of add, subtract,
multiply, divide, load, store, read, write, and shift. Machine language provides all these
instruction set.
Disadvantages of Machine Language:
 Machine Dependent: if a company decides to change to another computer, the programmer
may be required to learn a new machine language and would have to rewrite all the existing
programs.
 Difficult to Program: Although easily used by the computer, machine language is difficult to
program. It is necessary for the programmer either to memorize the dozens of code numbers
for the commands in the machine's instruction set or to constantly refer to a reference card.
 Error Level: Since a programmer has to remember the operation code (OP code) and he must
also keep track of the storage location of data and instruction, it becomes very difficult this
frequently results in program errors. Hence, it is easy to make errors while using machine code.
 Difficult to Modify: (debugging): It is difficult to correct or modify machine language
programs.
 Knowledge of Hardware Required: Since machine language is dependent, so the programmer
must be aware of a particular machines characteristics and requirements as the program is
written.
 Memory Management: A machine language programmer must know how his machine works
and should have a good knowledge of the logical structure of his computer in order to write a
good machine language program.
 Higher Program Preparation Cost: Writing programs in machine language requires more
time and efforts which ultimately leads to higher program preparation cost.

Assembly language:
 In assembly language, instructions, data and addresses are given in “mnemonics”, symbols and
labels that are readily understood by the human brain.
 This language uses symbolic codes for different operations.
 Assembly language can be translated into a machine language. A program which performs this
translation is called an “Assembler”.
 Machine and assembly languages, being machine dependent languages, they are called “low-
level “languages.

Assembly Language/Low level /Symbolic language


 Instead of using a string of binary bits in a machine language, programmers started using
English-like words as commands that can be easily interpreted by programmers.
 In assembly language, instructions, data and addresses are given in “mnemonics”, symbols and
labels that are readily understood by the human brain.
 This language uses symbolic codes for different operations.
 Assembly language can be translated into a machine language. A program which performs this
translation is called an “Assembler”.

108
Miss gwenzi form 1 notes
 Machine and assembly languages, being machine dependent languages, they are called “low-
level “languages.
 In other words, the computer manufacturers started providing English-like words abbreviated
as mnemonics (a technique of improving the memory) that are similar to binary instructions in
machine languages. The program is in alphanumeric symbols instead of 1s and 0s. The ADD,
SUB, MUL, and DIV are some symbols called mnemonics.
 The programs written in other than the machine language need to be converted to the machine
language. Translators are needed for conversion from one language to another. Assemblers are
used to convert assembly language program to machine language

Advantages of Assembly Language over Machine Language:


 Easy to Understand and use: Assembly languages are easier to understand and use because
mnemonic are used instead of numeric OP codes and suitable names are used for data. The use
of mnemonics means that comments are usually not needed; the program itself is
understandable.
 Easy to Locate and Correct Errors: (Debugging): While writing programs in assembly
language, fewer errors are made and those that are made are easier to find and correct because
of the use of mnemonics and symbolic field names.
 Easier to Modify: Assembly language programs are easier for people to modify than machine
language programs. This mainly because they are easies to understand and hence it is easier to
locate, correct, and modify instructions as and when desired.
 Lower Program Preparation cost: Writing programs in assembly language requires less time
and effort which ultimately leads to lower program preparation cost.

Limitations of Assembly Language:


The following disadvantages of machine language are not solved by using assembly language:
 Machine Dependent: Because each instruction in the symbolic language is translated into
exactly one machine language instruction, assembly language are machine dependent. That is,
they are designed for the specific make and model of the processor being used. A decision to
change to another computer still usually requires learning a new language and the conversion
of all existing programs; a very expensive undertaking.
 Knowledge of Hardware Required: Since assembly language are also machine dependent, so
the programmer must be aware of a particular machine's characteristics and requirements as
the program is written.
 Machine Level Coding: In case of an assembly language, instructions are still written at the
machine code level, that is, one assembler instruction is substituted for one machine code
instruction.
 Need of Translator: (Assembler): computer can only understand the language of 0, 1. While
symbols and addresses are used in assembly language which are not understandable by the
computer. To convert assembly language instructions into computer readable form a translator
is used. The type of translator which converts assembly language into machine language is
called assembler. Machine and assembly languages being machine dependent, are referred to as
low-level language.
 Slow as Compared to Machine Language: An extra step of translation of instructions is added
which slow the execution of the program written in assembly language.

High-Level Language/Procedure oriented language


 The program written in the high-level languages can be run on any computer which supports
these languages with little or no modifications.
 Thus HLL are machine independent since they ran on any computer without modifications
 The structure of these languages is closer to that of a human language.

109
Miss gwenzi form 1 notes
 The computer cannot directly understand a high-level language. It is translated into machine
language before it is executed by the computer. A set of programs used for translation is called a
“compiler” and “interpreter”.
 These languages are employed for easy and speedy development of a program.
 The programmer does not need to remember the architecture and registers of a CPU for
developing a program.
 Testing and debugging a program is easier than in the assembly language.

Advantages of High Level Language:


High level language posses the following advantages over assembly language:
 Machine Independence: High-level languages are independent. This is very valuable
advantage because it means that a company changing computers will not be required to rewrite
all the programs that it is currently using.
 Easy to Learn and Use: (User Friendliness): These languages are very similar to the
languages normally used by us in our day-to-day life. Hence they are easy to learn and use
 Fewer Errors: In case of high level languages, since the programmer needs not write all the
small steps carried out by the computer, he is much less likely to make an error.
 Lower Program Preparation Cost: Writing program in high level languages requires less time
and effort which ultimately leads to lower program preparation cost.
 No Worry about Addresses: one of the greatest advantages of the high level language is that, it
eliminates worry about address for instructions and data.
 Better Documentation: A high level language is designed in such a way that its instructions
may be written more like the language of the problem. Thus, the statements of a program
written in a high-level language can be easily understood by a person familiar with the problem.
 Easier to maintain: Programs written in high level language are easier to maintain than
assembly language or machine language programs. This is mainly because they are easier to
understand and hence it is easier to locate, correct, and modifies instructions as and when
desired. Insertion or removal of certain instructions from a program is also possible without
any complication. Thus, major changes can be incorporated with very little effort.

Limitations of High Level Languages:


Lack of Flexibility: because the automatic features of high level languages they are not under the
control of the programmer, they are less flexible than assembly/machine language. This lack of
flexibility means that some tasks cannot be done in a high-level language or can be done only with
great difficulty.

Language processors and their characteristics


 Language processors are also called language translators.
 A program is a set of instructions for performing a particular task. The computer interprets the
instructions as 1's and 0's.
 A program can be written in assembly language as well as in high-level language. This written
program is called the source program.
 The source program is to be converted to the machine language, which is called an object
program. A translator is required for such a translation.
 Program translator translates source code of programming language into machine language-
instruction code.
 Generally, computer programs are written in languages like JAVA, Visual Basics, C, C ++ and
ASSEMBLY LANGUAGE, which should be translated into machine language before execution.

110
Miss gwenzi form 1 notes
 It is difficult to write computer program directly in machine code. The source code cannot be
executed directly by the computer.
 Every language has its own language processor (or translator). Therefore, language processor is
defined as: The special translator system software that is used to translate the program written
in high-level language (or Assembly language) into machine code
 The language processors are divided into three types.

Compiler
 Is a language processor that translates a complete source program as a whole into machine
code before execution?
 The C and C++ compilers are best examples of compilers.
 The program translated into machine code is called the object program.
 The source code is translated to object code successfully if it is free of errors.
 If there are any errors in the source code, the compiler specifies the errors at the end of
compilation. The errors must be removed before the compiler can successfully compile the
source code.
 The object program can be executed a number of times without translating it again.

Interpreter
 Is the language processor that translates (converts) each statement of source program into
machine code and executes it immediately before it translates the next statement
 Interpreter reads the program line by line, whereas in compiler the entire program is read by
the compiler, which then generates the object codes
 If there is an error in the statement the interpreter terminates its translating process at that
statement and displays an error message.
 The OWBASIC is an example of interpreter.
 The Interpreter differs from compiler that translates the entire source program into object
program before execution.
 The main advantage of Interpreter is that it makes easy to trace out and correct errors in the
source program.
 It is a time consuming process of translating and executing statements one by one.

Assembler
 It is used to translate the program written in Assembly language into machine code.
 An assembler performs the translation process in similar way as compiler. But assembler is the
translator program for low-level programming language, while a compiler is the translator
program for high-level programming languages.

111
Miss gwenzi form 1 notes

Difference between Compiler and Interpreter


No Compiler Interpreter
1 Compiler takes entire program as input Interpreter takes single instruction as input.
2 Intermediate Object Code is Generated No Intermediate Object Code is Generated
3 Conditional Control Statements are Conditional Control Statements are Executes
Executes faster slower
4 Memory Requirement : More (Since Object Memory Requirement is Less
Code is Generated)
5 Program need not be compiled every time Every time higher level program is converted
into lower level program
6 Errors are displayed after entire program Errors are displayed for every instruction
is checked interpreted (if any)
7 Example : C Compiler Example : BASIC

Difference between Source Code and Object Code

Source Code:
1. Source Code is in the form of Text.
2. Source Code is Human Readable.
3. Source Code is generated by Human.
4. Source Code is Input Given to Compiler.

Object Code:
1. Object Code is in the form of Binary Numbers.
2. Object Code is in Machine Readable.
3. Object Code is generated by Compiler.
4. Object code is Output of Compiler.

Source Code Object Code


COMPILER
(High Level Language) (Machine Language)

 The problem with using a compiler is that it uses a lot of computer resources
 When an error in a program occurs it is difficult to pin point its source in the original program

Compilation stages
 Whether a compiler or interpreter is used, the translation from a high level language to machine
code has to go through various stages and these are shown below:

Source Program

Lexical Analysis

Syntax Analysis

Semantic
Analysis
112

Intermediate
Language
Miss gwenzi form 1 notes

Lexical Analysis
 Aka "linear analysis", "scanning"
 The first stage of processing a language where stream of characters making up the source
program is read one at a time and grouped into lexemes (or "tokens") - word-like pieces such as
keywords, identifiers, literals and punctuation.
 The lexemes are then passed to the parser (to analyze (a string of characters) in order to
associate groups of characters with the syntactic units of the underlying grammar.)

Compiler:
 Compiler takes high level human readable program as input and convert it into the lower level
code.
 This conversion takes place using different phases.

Different phases of compilers:


1. Analysis Phase
2. Synthesis Phase

1. Analysis Phase :
 Lexical analysis
 Syntax analysis
 Semantic analysis

Lexical Analysis Phase:


 Task of Lexical Analysis is to read the input characters and produce as output a sequence of
tokens that the parser uses for syntax analysis.

1. Lexical Analyzer is First Phase of Compiler.


2. Input to Lexical Analyzer is “Source Code“
3. Lexical Analysis Identifies Different Lexical Units in a Source Code.

113
Miss gwenzi form 1 notes
4. Different Lexical Classes or Tokens or Lexemes
o Identifiers
o Constants
o Keywords
o Operators
5. Example : sum = num1 + num2 ;

So Lexical Analyzer will produce the following Symbol Table–


Token Type
Sum Identifier
= Operator
num1 Identifier
+ Operator
num2 Identifier
; Seperator

6. Lexical Analyzer is also called “Linear Phase” or “Linear Analysis” or “Scanning“


7. Individual Token is also Called Lexeme
8. Lexical Analyzer’s Output is given to Syntax Analysis.

Analysis Phase: 2nd Phase of Compiler (Syntax Analysis)


During the first Scanning phase i.e Lexical Analysis Phase of the compiler, symbol table is created by
the compiler which contains the list of leximes or tokens.

Syntax Analysis:
1. It is Second Phase of Compiler after Lexical Analyzer
2. It is also called Hierarchical Analysis or Parsing.
3. It Groups Tokens of source Program into Grammatical Production
4. In Short Syntax Analysis Generates Parse Tree

Parse Tree Generation:


sum = num1 + num2

114
Miss gwenzi form 1 notes
Now Consider above C Programming statement. In this statement we Syntax Analyzer will create a
parse tree from the tokens.

Syntax Analyzer will check only Syntax not the meaning of Statement

Explanation: Syntax Analysis


 We know , Addition operator plus (‘+’) operates on two Operands
 Syntax analyzer will just check whether plus operator has two operands or not. It does not
check the type of operands.
 Suppose One of the Operand is String and other is Integer then it does not throw error as it only
checks whether there are two operands associated with ‘+’ or not .
 So this Phase is also called Hierarchical Analysis as it generates Parse Tree Representation of
the Tokens generated by Lexical Analyzer

Semantic Analysis: Analysis Phase (3rd Phase of Compiler)


 Syntax analyzer will just create parse tree.
 Semantic Analyzer will check actual meaning of the statement parsed in parse tree.
 Semantic analysis can compare information in one part of a parse tree to that in another part
(e.g., compare reference to variable agrees with its declaration, or that parameters to a function
call match the function definition).

Semantic Analysis is used for the following -


1. Maintaining the Symbol Table for each block.
2. Check Source Program for Semantic Errors.
3. Collect Type Information for Code Generation.
4. Reporting compile-time errors in the code (except syntactic errors, which are caught by
syntactic analysis)
5. Generating the object code (e.g., assembler or intermediate code)

Now In the Semantic Analysis Compiler Will Check -


1. Data Type of First Operand
2. Data Type of Second Operand
3. Check Whether + is Binary or Unary.
4. Check for Number of Operands Supplied to Operator Depending on Type of Operator (Unary |
Binary | Ternary)

115
Miss gwenzi form 1 notes
Reverse Polish notation (RPN)
 Is a mathematical notation in which every operator follows all of its operands, in contrast to
Polish notation, which puts the operator in the prefix position?
 It is also known as postfix notation and is parenthesis-free as long as operator arities are fixed.
 During the 1970s and 1980s, RPN was known to many calculator users, as it was used in some
handheld calculators of the time designed for advanced users: for example, the HP-10C series
calculators.
 In computer science, postfix notation is often used in stack-based and concatenative
programming languages. It is also common in dataflow and pipeline-based systems, including
Unix pipelines.
 In reverse Polish notation the operators follow their operands; for instance, to add 3 and 4, one
would write "3 4 +" rather than "3 + 4". If there are multiple operations, the operator is given
immediately after its second operand; so the expression written "3 − 4 + 5" in conventional
notation would be written "3 4 − 5 +" in RPN: first subtract 4 from 3, then add 5 to that.
 An advantage of RPN is that it obviates the need for parentheses that are required by infix.
While "3 − 4 * 5" can also be written "3 − (4 * 5)", that means something quite different from
"(3 − 4) * 5".
 In postfix, the former could be written "3 4 5 * −", which unambiguously means "3 (4 5 *) −"
which reduces to "3 20 −"; the latter could be written "3 4 - 5 *" (or 5 3 4 - *, if you wish to keep
similar formatting), which unambiguously means "(3 4 -) 5 *".
 Despite the name, reverse Polish notation is not exactly the reverse of Polish notation, for the
operands of non-commutative operations are still written in the conventional order (e.g. "/ 6 3"
in Polish notation and "6 3 /" in reverse Polish both evaluating to 2, whereas "3 6 /" in reverse
Polish notation would evaluate to ½).
 In comparison testing of reverse Polish notation with algebraic notation, reverse Polish has
been found to lead to faster calculations, for two reasons. Because reverse Polish calculators do
not need expressions to be parenthesized, fewer operations need to be entered to perform
typical calculations. Additionally, users of reverse Polish calculators made fewer mistakes than
for other types of calculator.
 Later research clarified that the increased speed from reverse Polish notation may be attributed
to the smaller number of keystrokes needed to enter this notation, rather than to a smaller
cognitive load on its users.
 However, anecdotal evidence suggests that reverse Polish notation is more difficult for users to
learn than algebraic notation.

Example

The infix expression "5 + ((1 + 2) * 4) − 3" can be written down like this in RPN:

512+4*+3-

The expression is evaluated left-to-right, with the inputs interpreted as shown in the following table
(the Stack is the list of values the algorithm is "keeping track of" after the Operation given in the
middle column has taken place):

Input Operation Stac Comment


k
5 Push value 5
1 Push value 1
5

116
Miss gwenzi form 1 notes
2 Push value 2
1
5
+ Add 3 Pop two values (1, 2) and push result (3)
5
4 Push value 4
3
5
* Multiply 12 Pop two values (3, 4) and push result (12)
5
+ Add 17 Pop two values (5, 12) and push result (17)
3 Push value 3
17
− Subtract 14 Pop two values (17, 3) and push result (14)
Result (14)

 When a computation is finished, its result remains as the top (and only) value in the stack; in
this case, 14.
 The above example could be rewritten by following the "chain calculation" method described by
HP for their series of RPN calculators
 As was demonstrated in the Algebraic mode, it is usually easier (fewer keystrokes) in working a
problem like this to begin with the arithmetic operations inside the parentheses first.

12+4*5+3−

Code generators
 code generation is the process by which a compiler's code generator converts some
intermediate representation of source code into a form (e.g., machine code) that can be readily
executed by a machine.
 run time support routines

ARCHITECTURE
 The way in which various components of the computer system are connected with one another
is called computer architecture.

Difference between Harvard and Von Neumann computer architectures


There are basically two types of digital computer architectures. The first one is called Von Neumann
architecture and later Harvard architecture was adopted for designing digital computers.

Von Neumann Architecture:

 It was named after the mathematician and early computer scientist John Von Neumann.
 Its design is simpler than that of Harvard architecture
 This has one shared memory for instructions (program) data with one data bus and one
address bus between CPU and memory
 Instructions and data have to be fetched in sequential order (known as the Von Neumann
Bottleneck), limiting the operation bandwidth (instructions are fetched and executed one at a
time in a serial manner)
 It is mostly used to interface to external memory

117
Miss gwenzi form 1 notes
 Processor needs two clock cycles to complete an instruction. Pipelining the instructions is not
possible with this architecture.
 In the first clock cycle the processor gets the instruction from memory and decodes it. In the
next clock cycle the required data is taken from memory. For each instruction this cycle repeats

and hence needs two cycles to complete an instruction.

Harvard Architecture:
 The name is originated from "Harvard Mark I" a relay based old computer.
 The computer has two separate memories for storing data and program with dedicated buses
for each of them.
 Instructions and operands can be fetched simultaneously
 Processor can complete an instruction in one cycle if appropriate pipelining strategies are
implemented.
 In the first stage of pipeline the instruction to be executed can be taken from program memory.
In the second stage of pipeline data is taken from the data memory using the decoded
instruction or address.
 Most of the modern computing architectures are based on Harvard architecture. But the
number of stages in the pipeline varies from system to system.
 Two separate memory systems can perform better, but would be difficult to implement.

Pipelining
 A pipeline is a set of data processing elements connected in series, so that the output of one
element is the input of the next one.
 The elements of a pipeline are often executed in parallel or in time-sliced fashion; in that case,
some amount of buffer storage is often inserted between elements.
 Pipelining is an implementation technique where multiple instructions are overlapped in
execution.
 The computer pipeline is divided in stages. Each stage completes a part of an instruction in
parallel. The stages are connected one to the next to form a pipe - instructions enter at one end,
progress through the stages, and exit at the other end.

118
Miss gwenzi form 1 notes
 Pipelining does not decrease the time for individual instruction execution. Instead, it increases
instruction throughput. The throughput of the instruction pipeline is determined by how often
an instruction exits the pipeline.
 Because the pipe stages are hooked together, all the stages must be ready to proceed at the
same time. We call the time required to move an instruction one step further in the pipeline a
machine cycle. The length of the machine cycle is determined by the time required for the
slowest pipe stage.

Pipeline categories
Linear and non-linear pipelines
 A linear pipeline processor is a series of processing stages which are arranged linearly to
perform a specific function over a data stream. The basic usages of linear pipeline are
instruction execution, arithmetic computation and memory access.
 A non-linear pipeline (also called dynamic pipeline) can be configured to perform various
functions at different times. In a dynamic pipeline there is also feed forward or feedback
connection.

Costs and drawbacks


 High pipelining leads to increase of latency - the time required for a signal to propagate through
a full pipe.
 A pipelined system typically requires more resources (circuit elements, processing units,
computer memory, etc.) than one that executes one batch at a time, because its stages cannot
reuse the resources of a previous stage.
 Moreover, pipelining may increase the time it takes for an instruction to finish.

Buses

 are circuits or highways used transmit data and instructions between system components
 A system bus is a set of parallel wires connecting two or more components of the computer
 The CPU is connected to the main memory by three separate buses. When the CPU wishes to
access a particular memory location, it sends this address to memory on the address bus. The
data in that location is returned to the CPU on the data bus. Control signals are sent along the
control bus
 Every bus has a clock speed measured in MHz. A fast bus allows data to be transferred faster,
which makes applicationsrun faster. On PCs, the old ISA bus is being replaced by faster buses
such as PCI.
 Computer buses are divided into three categories:
 Address bus
 Data bus
 Control bus
 Data and control signals travel in both directions between the processor, memory and I/O
controllers. Addresses on the other hand, travel only one way along the address bus. The
processor sends the address of an instruction, or of data to be stored or retrieved, to memory or
to an I/O controller as shown below.

119
Miss gwenzi form 1 notes

Address bus
 Carries the location (address) the data is sent from, and the address it is going to
 Each part of the system is numbered. We call this number the address. The address bus carries
addresses, i.e. it carries a number that identifies a particular part of the system. Most addresses
apply to memory locations but it is also possible to have address for interface.
 The number of wires in an address bus determines the amount of memory that can be used in
the system
 When a processor wishes to read a word (say 8, 16 or 32bits) of data from memory, it first puts
the address of the desired word on the address bus
 The width of the address bus determines the maximum possible memory capacity of the
system. e.g. if the address bus consisted of only 8 lines, then the maximum address it could
transmit would be (in binary) 11111111 or 255 – giving a maximum memory capacity of 256
(including address 0)-28.
 The address bus is also used to address I/O ports during input/output operations
 It is unidirectional
 Used to specify a physical memory address/location. This can include primary memory (e.g.
RAM and ROM) secondary memory (e.g. hard disk drives) and any other connected devices.
Monitors, printers, scanners, and keyboards will all be mapped to memory.
 The width of the address bus determines the amount of memory that can be addressed. A 32-bit
bus can address 4,294,967,296 (2 ^ 32) bytes of memory. This explains the 4 GB memory
restriction on 32-bit operating systems.

Data bus
 Carries the data to and from the processor
 This is used to transfer data from one device to another. Each wire in the bus transfer one
binary digit (bit), so the number of wires determines the amount of data that can be transferred
at one time.
 Is a bi-directional path for moving data and instructions between system components?
 The width of the data bus determine overall system performance
 It connects the microprocessor (CPU) with other devices mapped onto the system. This is often
described pictorially using a memory map.
 Unlike the address bus, the data bus is two-way (it supports read and write operations).
 The data bus is not limited to transferring data; it is also used to transfer program instructions.

Control bus

120
Miss gwenzi form 1 notes
 Sends instructions ( control signals) from the Control Unit to processor to allow
synchronization of commands
 The physical connection that carry control information between the CPU and other devices
within the computer
 Carries signals that control the operation of each device. There will be a clock signal to provide
synchronization (management).
 There will be control signals that command the memory to read or write to ensure that the
system operate successfully.
 Is a bi-directional bus meaning that signal can be carried in both directions
 Ensure access to and use of the data and address buses by the different component of the
system does not lead to conflict.
 The purpose of the control bus is to transmit command, timing and specific status information
between system components
 Carries commands from and returns status signals to the microprocessor.
 The control unit inside a CPU manages the internal control bus and the external control bus.
 Some control signals are Read, Write and Op code fetch etc. Various operations are performed
by microprocessor with the help of control bus.
 This is a dedicated bus, because all timing signals are generated according to control signal.

Relationship between number of address m and maximum number of addressable


memory cells
No. of address lines, Maximum no. of Max no. of addressable cell expressed as a
m addressable cells power of two, 2m
1 2 21
2 4 22
3 8 23
4 16 24
8 256 28
16 65536 216
20 1048576 220
24 16777216 224

Fetch – Decode – Execute Cycle


The primary responsibility of a computer processor is to execute a sequential/chronological set of
instructions that constitute a program. CPU executes each instruction in a series of steps, called
instruction cycle as shown below. An instruction cycle involves four steps

Fetching:
 The control unit fetches (gets) the instruction from the memory.
 The fetched instruction is placed in the Instruction Register.
 For this to happen the CPU makes use of a vital hardware path called the address bus
 Data from this address then moves from main memory into the CPU by travelling along another
hardware path called the data bus
 Program Counter holds the address of next instruction to be fetched and is incremented after
each fetch.

Decoding:

121
Miss gwenzi form 1 notes
 The control unit decode the instructions (decides what it means) and directs the necessary data
moved from memory to the arithmetic logic unit.
 These first two steps together are called instruction time, or I-time.
 The instruction that is fetched is broken down into parts or decoded.
 The next step is for the CPU to make sense of the instruction it has just fetched
 Decides what the instruction means
 The instruction is translated into commands so that they correspond to those in the CPU’s
instruction set

Executing:
 The decoded instruction or the command is executed.
 This is part of the cycle when data processing actually takes place
 The ALU performs the operation implied by the program instruction. For example, if it is an
ADD instruction, addition is performed.
 The instruction is carried out upon the data. The result of this processing is stored in yet
another register

Storing
 CPU writes back the results of execution, to the computer’s memory. The arithmetic logic unit
stores the result of this operation in memory or in a register.
 Step c and d together are called execution time, or E-time.
 The control unit eventually directs memory to release the result to an output device or a
secondary storage device.
 The combination of I-time and E-time is called the machine cycle.

How does the fetch-decode-execute cycle work?


 The program counter in the processor holds the address of the next instruction needed from
main memory.

122
Miss gwenzi form 1 notes
 The program counter copies its contents into the memory address register. The memory
address register then sends the address along the address bus to main memory and the
contents of the memory location specified by the address are sent along the data bus to the
memory buffer register.
 The contents of the memory buffer register are then copied to the current instruction register
where they are decoded and executed.

Summarised Fetch-Execute Cycle


Fetch-execute cycle - complete process of retrieving an instruction from store, decoding it and
carrying it out

Fetch Phase
1. The address of the next instruction to be executed is copied from the SCR to the MAR
2. The instruction held at that address is copied to the MDR
3. Simultaneously the contents of the SCR is incremented so that it holds the address of the next
instruction
4. The contents of the MDR are copied to the CIR

Execute Phase
5. The instruction held in the CIR is decoded
6. The instruction is executed

Memory mapping
 A technique whereby computer peripherals may be addressed as though they formed part of
the main memory of the computer
 A memory map is a structure of data (which usually resides in memory itself) that indicates
how memory is laid out.
 A memory map is a massive table, in effect a database that comprises complete information
about how the memory is structured in a computer system. A memory map works something
like a gigantic / massive office organizer.
 In the map, each computer file has a unique memory address reserved especially for it, so that
no other data can accidentally overwrite or corrupt it.
 In order for a computer to function properly, its OS (operating system) must always be able to
access the right parts of its memory at the right times.
 When a computer first boots up (starts), the memory map tells the OS how much memory is
available. As the computer runs, the memory map ensures that data is always written to, and
read from, the proper places. The memory map also ensures that the computer's debuggers can
resolve memory addresses to actual stored data.
 If there were no memory map, or if an existing memory map got corrupted, the OS might (and
probably would) write data to, and read data from, the wrong places. As a result, when data was
read, it would not always pertain to the appropriate files or application programs.
 The problem would likely start out small and unnoticeable, worsen with time, and become
apparent only after considerable damage had been done to stored data and programs. In the
end, some or all of the applications would fail to run, and many critical data files would be
ruined.

Interrupts

123
Miss gwenzi form 1 notes
 Is a signal from a device or source seeking the attention of the processor
 When an interrupt occurs, the OS saves the state of the interrupted process and passes control
to the appropriate routine
 The interrupt signal is sent along a control bus to the processor, and the currently executing
program is suspended while control is passed to an interrupt service routine.

Types of interrupt
o generated by running process - e.g. process may need to perform I/O
o I/O interrupts - generated by I/O hardware to signal to CPU that status of a channel or device
has changed
o external interrupts - e.g. expiry of time-slice
o restart interrupts - when operator presses restart button
o program check interrupts - e.g. division by zero
o machine check interrupts - caused by malfunctioning/faulty hardware

 An operating system usually has some code that is called an interrupt handler. The interrupt
handler prioritizes the interrupts and saves them in a queue if more than one is waiting to be
handled.
 The operating system has another little program, sometimes called a scheduler , which figures
out which program to give control to next.
 In general, there are hardware interrupts and software interrupts. A hardware interrupt occurs,
for example, when an I/O operation is completed such as reading some data into the computer
from a tape drive. A software interrupt occurs when an application program terminates or
requests certain services from the operating system

Examples of interrupt priorities


Class of interrupt Source of interrupt Priority
Hardware failure Power failure 1
Memory parity error 1
Program Arithmetic overflow 2
Division by zero 2
Attempt to execute an illegal machine instruction 2
Reference outside a user’s allowed memory space 2
Timer Generated by internal clock within the processor 3
I/O I/O device signals normal completion or the occurrence of 4
an error condition

Memory address modes


 Are methods used to locate data and instructions in memory
 Addressing modes allocate RAM into portions that may be individually referenced so that the
Central Processing Unit, or CPU, can determine which memory location is being used by a
machine instruction
 Determine the method used within the program to access data either from within the CPU or
external RAM
 Some memory addressing modes can control program flow

The five memory address modes are:


o Direct

124
Miss gwenzi form 1 notes
o Indirect
o Immediate
o Indexed
o Relative

Immediate addressing
 Means that the data to be used is hard coded into the instruction itself
 This is the simplest and fastest method of addressing as it does not involve main memory at all
 For example, if you want to add 2 to the content of accumulator, the instruction is:
ADC 2
Nothing has been fetched from memory; the instruction simply adds 2 to the accumulator
immediately
 Immediate addressing is very useful carry out instructions involving constants (as opposed to
variables). For example you might want to use PI as a constant 3.14 within your code.
 The data is located within the operands of the instruction itself, not in a separate memory
location.
 This is the least flexible of the addressing modes to execute and is the least used of the five in
practice.

Direct addressing

 For direct addressing, the operands of the instruction contain the memory address where the
data required for execution is stored.
 For the instruction to be processed the required data must be first fetched from that location.

Indirect addressing

 When using indirect addressing, the operands give a location in memory similarly to direct
addressing.
 However, rather than the data at this location, there is instead another memory address given
where the data actually is located.
 This is the most flexible of the modes, but also the slowest as two data lookups are required.

Direct Addressing Mode


 This is a very simple way of addressing the memory – direct addressing means the code refers
directly to a location in memory.
For example
SUB (3001)
In this instance the value held at the absolute location 3001 in RAM is subtracted from the
accumulator.
 Direct addressing is fast (but not as fast as immediate addressing) the bad thing about direct
addressing is that the code depends on the correct data always being present at same location.
 In the direct mode, the address field contains the address of the operand.
 It requires a single memory reference to read the operand from the given location. However, it
provides only a limited address space.
 Direct addressing– in this mode, the operand gives the address of the data to be used in the
operation. For example:
LDA MEM ; load contents of location MEM into the accumulator

125
Miss gwenzi form 1 notes
 The number of locations which can be addressed using direct addressing is limited because only
say, 10 out of 16 bits are available to hold the address, and often more than one word is used to
for holding the address.
 This type of instruction is slow, for locating the data it involves 3 or maybe 4 memory
operations, 3 to load the 3-byte instruction and then another to go and get the data to be
operated on.

Indirect Addressing Mode


 In the indirect mode, the memory cell pointed to by the address field contains the address of
(pointer) the operand, which in turn contains the full-length address of the operand.
 This mode has a large address space, unlike direct and immediate addressing, but because
multiple memory accesses are required to find the operand it is slower.
 Indirect addressing – with this type of addressing, the address of data in memory is held in
one of the registers, and the operand of the instruction holds the number of register to refer to.
LDA (7) ; load the contents of the memory location whose address is in
register 7
 Generally the 8-bit or 16-bit op code contains all the information needed, what operation is to
be performed, and which register holds the data address

Displacement Addressing Mode


Displacement mode consists of 3 variations:
o Relative addressing
o Base register addressing
o Indexing addressing.
This mode can be considered a combination of direct and register indirect addressing. The address
holds two values: base value and a register that contains an integer displacement that is added or
subtracted from the base to form the effective address in memory.

Indexed addressing – this is a variation on indirect addressing, where the operand address is
calculated by adding to a base address the value held in an index register. Using this mode of
addressing, the address of the operand can be modified by operating on the contents of the index
register.
For example, suppose we wish to set to set to zero the contents of TABLE to TABLE + 99. Using
an index register X, the following instruction can be used:
LDA #0 ; load 0 into the accumulator
LDX #0 ; load 0 into the index register
LOOP STA TABLE (X); store contents of accumulator in TABLE + X
INX ; increment the index register
CPX #99 ; compare X with 99
BNE LOOP ; branch if not equal to LOOP

Relative addressing – this type of addressing is often used branch instructions to specify where
the next instruction is located relative to the instruction whose address is held in the PC. An
example is:
JMP +10 ; branch to the instruction 10 bytes on
A ‘jump relative’ with a one-byte operand can only jump forwards or backwards 127 bytes. Relative
jumps allow the code to be re-locatable anywhere in memory.

Registers

126
Miss gwenzi form 1 notes
 A register is a small area of memory, within the processor itself, where data or control
information is temporarily stored. Registers are used because transferring data to and from a
register is much quicker than transferring the data between the processor and main memory.
 These are used to store data and instructions during program execution. The size of the register
is 2 or 4 or 8 bytes or more.
 Is a special storage location in the CPU circuitry used to hold information temporarily while it is
being decoded or manipulated
 A series of special on-chip memory that monitor, store binary data and control the information
being Fetched & Executed

PC - Program Counter:
 Holds the address of the next instruction to be executed. It is also known as the sequence
control register (SCR) or the sequence register
 Determines the sequence in which the program instructions are executed
 It ensures that the CPU always knows where it has reached and is able to resume at the correct
point following the execution of an instruction

MAR - Memory Address Register


 This register contains the address (memory location) of the data or instruction that is being
transferred between the CPU and main memory
 Holds the address of the data or instructions currently being carried out or accessed in the main
memory (sent from the above PC) i.e. the address of the data / instruction that has been just
been fetched

CIR - Current Instruction Register


 Instructions from memory are placed here so that the contents can be decoded and
executed. i.e. It holds the instruction while it is being decoded / executed
 CIR holds the current instruction in the processor while it is being decoded and executed. This
speed of the whole execution process. Because the time needed to access the instruction
register is much less than continual checking of the memory location itself.
 contains both the operator (what is to be done) and the operand (the address) on the current
instruction. For example, a machine language instruction to load the contents of location 1000
into the accumulator might be written
LDA 1000
 Where LDA is the operator and 1000 is the operand

MDR - Memory Data Register (also known as buffer register)


 This register contains the data/instruction that is currently being copied from/to main
memory.
 All instructions and data pass in and out of main memory via MDR
 Is used to temporarily store data read from or written to memory. The instruction (for example
LDA 1000) is placed here then routed to the CIR where it will be decoded. When the instruction
has been decoded, the operand 1000 will be placed in the MAR and the contents of the location
1000 will then be copied to the MDR.
 All transfers from memory to the CPU go via MDR. Both the MDR and the MAR serve as buffer
registers to compensate for difference in speed between the CPU and memory.

SR - Status Register (also known as Flag Register)

127
Miss gwenzi form 1 notes
 The flag register is specially designed to contain all the appropriate 1-bit status flags, which are
changed as a result of operations involving the arithmetic and logic unit.
 It contains 'bits' that are set or cleared based on the result of an instruction. (also known as
Program Status Words or PSWs)
 Status registers also contain information about interrupts

Instruction Register (IR)

 This is used to hold the current instruction in the processor while it is being decoded and
executed, in order for the speed of the whole execution process to be reduced.
 This is because the time needed to access the instruction register is much less than continual
checking of the memory location itself.

Index register
 Is a special register used to adjust the address part of an instruction

General Purpose Registers (Including the Accumulator)


o GPRs are used for performing arithmetic functions
o Some computers have only one, the Accumulator;
 Others have up to 16 general purpose registers.

Accumulator (AX, or ACC)


Is where results are temporarily held and is used in conjunction a working register to do
calculations.
 The accumulator is used to hold the result of operations performed by the arithmetic and logic
unit, as covered in the section on the ALU.
 Results of processing operations (answers) are stored here temporarily, before being sent to
memory (RAM)

Logic Gates
 Logic gateA relatively simple, digital, electronic circuit that processes two-state signals
according to a logicalrule. It has one or more inputs and a single output.
 Binary information is represented using signals in two states off or on which correspond to 0 or
1, respectively.
 The manipulation/treatment of the binary information is done using logic gates.
 Logic gates are the hardware electronic circuits which operate on the input signals to produce
the output signals.
 Each logic gate has a unique symbol and its operation is described using algebraic expression.
 For each gate, the truth table shows the output that will be outputted for the different possible
combinations of the input signal.
 Most logic gates have two inputs and one output.
 At any given moment, every terminal is in one of the two binary conditions low (0) or high (1),
represented by different voltage levels.
 In most logic gates, the low state is approximately zero volts (0 V), while the high state is
approximately five volts positive (+5 V).
 There are seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR, and XNOR.
 Logic gates process signals which represent true or false. Normally, the positive supply voltage
+5V represent true and 0V represents false.
 Other terms which are used for the true and false states are shown in the table. It is best to be
familiar with them all.

128
Miss gwenzi form 1 notes
Logic
States
True False
1 0
High Low
On Off
+5V 0V

NB: Gates are identified by their function: AND, OR, NOT, NAND, NOR, EX-OR and EX-NOR. Capital
letters are normally used to make it clear that the term refers to a logic gate.

The above said logic gates can be classified into following categories:
1. Basic Logic Gates
a. AND Gate
b. OR Gate
c. NOT Gate
2. Universal Gates
a. NAND Gate
b. NOR Gate
3. Combinational Gates
a. X-OR Gate
b. X-NOR Gate
The basic operations are described below with the aid of truth tables.

Basic Logic Gates


AND Gate
 If both of the inputs are high then the output is high
 A dot (.) is used to show the AND operation i.e. A.B. Bear in mind that this dot is sometimes
omitted i.e. AB.

OR Gate
 If at least one of the inputs is high the output is high
 A plus (+) is used to show the OR operation.

NOT gate

129
Miss gwenzi form 1 notes
 If the input is high the output is lowor if the input is low the output is high It is also known
as an inverter. If the input variable is A the inverted output is known as NOT A. This is also
shown as A', or A with a bar over the top, as shown at the outputs.

Universal Gates
NAND Gate
This is a NOT-AND gate which is equal to an AND gate followed by a NOT gate. The outputs of all
NAND gates are high if any of the inputs are low. The symbol is an AND gate with a small circle on
the output. The small circle represents inversion.

**If at least one of the inputs is low then the output is high

NOR Gate
This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all NOR
gates are low if any of the inputs are high. The symbol is an OR gate with a small circle on the
output. The small circle represents inversion.

**If both of the inputs are low the output is high

Combinational Gates X-OR Gate


The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of its two
inputs are high. An encircled plus sign (⊕) is used to show the X-OR operation.

**If all the inputs are not equal then the output is high

X-NOR Gate
The 'Exclusive-NOR' gate circuit does the opposite to the X-OR gate. It will give a low output if
either, but not both, of its two inputs are high. The symbol is an X-OR gate with a small circle on
the output. The small circle represents inversion.

130
Miss gwenzi form 1 notes

**If all the inputs are equal then the output is high

Table 1: Logic Gate Symbols

Table 2 is a summary truth table of the input/output combinations for the NOT gate together with
all possible input/output combinations for the other gate functions.

Table 2: Logic gates representation using the Truth table

131
Miss gwenzi form 1 notes

132
Miss gwenzi form 1 notes

133
Miss gwenzi form 1 notes

134
Miss gwenzi form 1 notes

135
Miss gwenzi form 1 notes

136
Miss gwenzi form 1 notes

137
Miss gwenzi form 1 notes

138
Miss gwenzi form 1 notes

139

You might also like