CSEC Information Technology Notes
CSEC Information Technology Notes
Major functions:
1. Input – accepting data
2. Processing – manipulating data
3. Output – the results of processing
4. Storage – storing the data and results for future use
Components of a Computer
There are 5 general categories:
1. Central Processing Unit (CPU): this is the brain of the computer and controls how the rest of
the computer works. The CPU consists of :
a. Arithmetic Logic Unit (ALU) – performs all the calculations and logic (decision making)
operations.
b. Control Unit (CU) – carries out instructions in the software and directs the flow of data
through the computer system.
2. Input Devices: these put data into the computer, e.g. keyboard, mouse, scanner etc.
3. Output Devices: these get processed data out of a computer, e.g. printer, monitor, speakers
etc.
5. Storage Devices: these are devices used to read/write data and information to/from storage
media (CD, floppy etc), e.g. floppy disk drive, CD-ROM/DVD drive, hard disk drive etc.
Data vs Information
Data must be provided in a suitable form for any computer system to process it. ‘Input’ means
to enter data, programs, commands and user responses into the memory of a computer.
Definition: An input device is any device that transfers data from the outside world into a
computer.
KEYBOARD
A keyboard has a set of alphabet keys, number keys and various function keys, so the data
entered is in the form of individual letters, words or numbers. When you press a key on the
keyboard, a number (code) is sent to the computer to tell it which key was pressed.
The keyboard has the disadvantage that it is easy to make mistakes by hitting the wrong keys.
MOUSE
The most common pointing input device is the mouse. As you move it along a flat surface, the
pointer on the screen moves in the same direction. It usually has two buttons:
1. the left button which selects text and opens files
2. the right button which is used to access menus.
The mechanical mouse has a rubber ball underneath it to help it roll smoothly in all directions.
The optical mouse uses an optical system to track its movements. It is not physically
connected to the computer and uses infrared or radio waves to communicate with the
computer.
TOUCH SCREEN
Touch screens are specially mounted screens that are sensitive to touch, so there is no need for
a keyboard or mouse. Banks, malls and restaurants use touch screens to provide information to
the public.
TOUCH PAD
A touch pad is a flat rectangular surface which senses movement of a finger on its
surface. These devices are usually found on notebook computers and are used instead of a
mouse.
LIGHT PEN
Similar to a mouse, but you can move it over the screen and point at items on the screen to input
data.
SCANNER
A scanner allows the user to transfer pictures, graphics and text to a computer. It scans the
image from the top to the bottom, one line at a time and transfers it to the computer. The image
can then be used or modified in the paint program, sent out as a fax or printed.
BARCODE READER
Barcodes are groups of bars of different widths and are found on almost every product you
buy. Different groups of bars represent different numbers which are often printed above or
below the barcode. These numbers represent its country of origin, manufacture and item code.
The codes are read into the computer using a wand or a fixed scanner.
‘Output’ means to produce the results of processed data. The most common types of output are:
1. Hardcopy – this is called permanent output since it is printed for review away from the
computer, e.g. reports and pictures.
2. Softcopy – this is not permanent output. It includes output from a computer monitor, audio
(sound) from speakers, electrical signals from modems and output from one computer to
another.
Output devices include the following: monitors (display devices), printers (impact and non-
impact), plotters, speakers, microfilm etc.
Types of monitors:
1. Cathode Ray Tube (CRT)
2. Liquid Crystal Display (LCD)
2. Resolution – this determines how clear and detailed the output on the screen can
be. Pictures on a screen are made up of tiny dots
(1 dot = 1 pixel). The more pixels per inch, the clearer and more detailed the graphic.
3. Colour – the number of colours displayed can vary from 16 to 16.7 million. The more colours,
the smoother the graphics appear, especially photos.
PRINTERS
Printers are devices which output a hardcopy of your work.
Types of printers
1. Impact printers
2. Non-impact printers
Impact Printers
Impact printers strike through a carbon or inked ribbon, like a typewriter. They are noisy and
do not usually print acceptable graphics. However, they are useful for printing multiple copies
of documents using carbon paper.
1. Dot-matrix Printer – this type of printer uses pins to print a pattern of dots on paper.
Advantage: relatively low cost.
Disadvantage: poor quality of printing, readable but cannot be copied or used for business
letters
2. Line Printer – the characters in line printers are on a cylinder. Each segment of the cylinder
has a full set of characters in raised form around the edge. One complete line of text is printed
during one revolution of the cylinder.
Advantage: faster than other impact printers
Disadvantage: All the ‘A’s found in the text on that particular line are printed first, then all the
‘B’s and so on until all the letters that make up the words have been printed and the line is
complete.
Non-Impact Printers
These printers do not involve actually striking the paper. Instead, ink spray or toner is used and
the characters are fixed onto the paper by heating. Since the printing element is simple and has
no moving parts, these printers are inexpensive to manufacture. They also print documents
quickly and are silent.
1. Ink-jet Printer – these printers operate by spraying small droplets of ink onto the
paper. Speeds of 4 to 6 pages per minute may be achieved. The quality of the printout can be
nearly as good as that of a laser printer. Most suitable for use at home.
Disadvantages:
a. Slower than laser printers
b. The print heads become filled with ink and must be cleaned
c. Ink cartridges need to be replaced more frequently than toner cartridges of laser printers
2. Laser Printer – these printers produce attractive documents at a high resolution and are
much faster than ink-jets. They are used in many workplaces because they are quiet, print
quickly and can be stocked with a large number of sheets of paper and produce very high-
quality documents.
In the laser printer, the paper is charged electrostatically and attracts dry ink powder and the
pattern is then baked unto the paper. Many lines are printed simultaneously and speeds of 8 to
12 pages per minute can be achieved.
Disadvantage: Colour laser printers are far more expensive than colour ink-jet printers.
PLOTTERS
A plotter uses colour pens or toner to draw an image on paper. The paper is handled in
different ways depending on the type of plotter.
a. Flatbed plotter – the paper remains fixed while the pens move.
b. Drum plotter – rolls the paper over a cylinder. This type of plotter can produce very large
drawings.
Plotters are mostly used by Car Designers, Architects and Engineers to print accurate charts,
diagrams and 3D drawings.
MICROFILM
These are used as an alternative to paper. The output is ‘printed’ on a roll of film(computer
output microfilm) or a sheet of film (computer output microfiche) rather than paper.
Advantage: faster and it condenses large stacks of paper into small amounts of microfilm or
microfiche with no special programming.
Disadvantage: uses a special device to print the microfilm and a special viewer to read it.
MEMORY
Main Memory is located directly on the computer’s main circuit board, so that data can travel
quickly to and from the CPU. Data is stored at a specific location, called an address. The
contents of an address can be accessed to be read from, written to or processed.
TYPES OF MEMORY
1. Random Access Memory (RAM) – Inside a computer, you will find one or more memory
chips called RAM. These hold temporary operating instructions for the computer, its programs
and the data. This is the place where the CPU receives instructions and data to do its job.
Advantage: the computer can access data held in RAM almost immediately.
Disadvantage: RAM is volatile, i.e. data held in RAM is lost when the computer is turned off or
malfunctions.
Capacity: As computer programs and operating systems become more complex, the size of RAM
must be increased. Older computers come with 128 Mb, 256 Mb or 512 Mb. More recently, the
size of RAM can be as much as 4 Gb.
2. Read Only Memory (ROM) – ROM chips hold data and instructions necessary for starting up
the computer. The information is fixed at the time of manufacture and is sometimes described
as hard wired.
Advantage: ROM is non-volatile, i.e. the instructions are available every time the computer is
switched on. These instructions can only be read and cannot be changed.
3. Programmable ROM (PROM) – This is one step up from ROM. Once PROM has been
programmed with data its contents cannot be changed. They usually do not have any data
locked into it upon manufacture. However, a company using those PROMs to make a computer
can put its own information. If the code or data stored in PROM must be changed, the device
must be discarded. PROMs are ‘one-time programmable’ devices.
4. Erasable and Programmable ROM (EPROM) – EPROM is programmed in exactly the same
manner as PROM. However, EPROMs can be erased and re-programmed repeatedly. An EPROM
is erased by exposing the device to strong Ultraviolet (UV) light and this resets the chip to its
initial, un-programmed state. EPROMs are more expensive than PROMs.
SECONDARY STORAGE
Storage refers to the media used to keep programs, data and information for later use.
Secondary storage saves programs and data permanently, whereas primary storage uses main
memory (RAM) which is temporary.
Media are the actual object on which the computer keeps data, instructions and information for
future use.
Storage devices record and retrieve data, instructions and information to and from the storage
media.
MAGNETIC MEDIA
1. Floppy Disks (diskettes) – provides an easy way to transfer information from one computer
to another. Data is recorded on a thin circular plastic disk, coated with a magnetic material. Like
other magnetic disks, the diskette must be formatted or divided into areas before data can be
read from or written to it. Typical floppy disks can store up to 1.44Mb of data.
2. Hard Disks – these are rigid, inflexible disks made of highly polished metal. They can contain
a single disk or two or more disks stacked on a single spindle. There may be one read/write
head per disk or, on more expensive disks, more than one read/write head per disk, thereby
reducing the time taken to access information on the disk. Hard disks have very high storage
capacity compared to floppy disks. Typical capacity can range from 40 Gb to 160 Gb.
3. Magnetic tape – magnetic tape is a narrow strip of plastic coated with ferrous oxide. The
data is recorded along the length of the tape, with each symbol being encoded in binary form
across the width of the tape.
Magnetic tape is mainly used to back-up data on computer networks. This is a slow process and
is often done at night or at the end of a working day.
OPTICAL DISKS
Optical disks can store much more data than most magnetic media. It uses a laser beam
technique to write a magnetic pattern on the surface of the disk. This magnetic pattern is then
read using a second laser beam.
FLASH MEMORY
Flash memory is non-volatile computer memory that can be electrically erased and
reprogrammed. It is a technology that is primarily used in memory cards and USB flash drives
for general storage and transfer of data between computers and other digital products.
A memory card or flash memory card is a solid-state electronic flash memory data storage
device used with digital cameras, handheld and mobile computers, telephones, music players,
video game consoles, and other electronics.
Flash Drives or Memory sticks are handy devices that can be used to copy and store data from
computer hard drives. They were developed as an alternative data storage method to
diskettes. One end of the flash drive is inserted into the USB port on the computer. Once
attached to the computer, they operate in much the same way as floppy drives, but have
capacities that currently range from 1 Gb to 16 Gb.
Everything a computer does results from the turning ‘on’ or ‘off’ of different combinations of
microelectronic switches called transistors or bistable devices. The off and on states of the
transistors are used to represent zeros (0) and ones (1) that make up the binary number
system.
8 bits = 1 byte
1024 bytes = 1 kilobyte (Kb)
1024 Kb = 1 megabyte (Mb)
1024 Mb = 1 gigabyte (Gb)
1024 Gb = 1 terabyte (Tb)
A word is the amount of data that the computer can directly access at one time.
Read/Write Heads are used to record data on and retrieve data from the surface of magnetic
storage media. In magnetic tape and disk drives, the read/write heads remain stationary while
the disk spins.
Tracks – data is recorded on a magnetic disk in concentric circles called tracks. Each track has a
number. On a diskette, there are 80 tracks on each surface (top and bottom).
Disk Sector – Each side of a disk is subdivided into wedge-shaped slices called sectors. Each
sector is numbered. There are usually 18 sectors on each side of a diskette.
Track Sector – A track sector is the area where a track and a sector intersect. Data is recorded
along a track within a sector. Each track sector is identified by a unique address so that every
recording location can be identified
Cluster – A cluster is a set of track sectors, ranging from 2 to 32, depending on the formatting
scheme used.
Cylinder – A hard disk is actually a set of hard metal disks mounted on the same spindle. A
cylinder is a set of matched tracks on all the disks.
Hard Disk
Total storage space = number of disk read/write heads
x number of cylinders
x number of sectors per track
x number of bytes per sector
ACCESS TIME
After formatting the disk, the read/write heads need to access the stored data in as short a time
as possible. This access time depends on:
1. Seek Time – the time taken to move the heads to the particular track
2. Rotational Delay - the time it takes for the disk to rotate to the particular
sector
Data Transfer Rate – The time taken for data to be transferred to memory.
Types of Access
Sequential Access – Refers to reading or writing data records in sequential order, that is, one
record after the other. A tape drive is a sequential-access device because to get to point ‘Q’ on
the tape, the drive needs to pass through points ‘A’ through ‘P’ before ‘Q’ can be accessed.
Direct Access – Refers to locating and retrieving data immediately from a storage device
without having to start at the beginning and read all information until the requested data is
found.
For example, a hard disk drive is capable of directly accessing data.
BUFFERS
Sometimes the speed at which the C.U. is processing data to be output to disk is not the same as
the speed at which the data is being output. When this happens, the data that is waiting either
to be processed or output is stored in a temporary block of memory called a buffer.
The buffer then empties when the C.U. is ready to accept more data or the data has been
output. Buffering is used to match different speeds of the various devices and peripherals.
BINARY CONVERSIONS
The Binary number system is also known as Base 2. It consists of the digits 0 and 1.
The Decimal number system is also known as Base 10. It consists of the digits 0 to 9.
Ans.
Therefore, 2310 = 101112
Ans. The above binary number has 5 bits, therefore we need to construct a table with 5 columns
and 2 rows.
Binary addition
Binary addition works in the same way as decimal addition, except that only 0's and 1's can be
used, instead of the whole spectrum of 0-9.
This actually makes binary addition much simpler than decimal addition, as we only need to
remember the following:
0+0=0
0+1=1
1+0=1
1+1=10
1+1+1=11
Binary coded decimal
There are several other types of binary representation which can occur inside computers.
One of the most important is called Binary Coded Decimal. This is because, in this
system, each decimal digit is given its own binary code. There are several different types
of binary coded decimal (BCD). The most common is known as 8421 weighted code.
Let us use the example of representing 3591 in BCD. Each decimal digit is written as it
appears in the decimal number keeping the place values.
3 5 9
Each of the digits is then given the corresponding 4-bit binary code.
3 5 9
0011 0101 1001
Hence 35910 = 0011 0101 1001BCD
Sign Magnitude
The following 4-bit binary code should precede the BCD representation:
So the complete BCD representation of 35910 would be: 1010 0011 0101 1001BCD
SOFTWARE
A program is a series of computer instructions which tells the computer what to do.
APPLICATION SOFTWARE
Application software is defined as programs that enable the computer to carry out one or more
specific tasks.
1. General-purpose software – also known as ‘off the shelf’ software. This is the most popular
application programs that are used by organizations, businesses, schools and by individuals at
home. Examples include Microsoft Office, Games, Math Tutor, Typing Tutor etc.
These programs are called general-purpose because the user decides what to use the software
for, e.g. word processing software can be used to write letters, reports and memos, databases
can be used for searching and sorting data etc.
Generally much cheaper since it used by millions of people around the world and they are
generally error (bug) free.
2. Custom-written software – also known as ‘tailor-made’. This is software written to meet
the specific needs of a company. It may be written by individuals within the company or
contracted out to a software house (a company that specializes in writing software). This may
be necessary because there are no commercial applications available. Custom written software
is very expensive.
3. Specialized software – this is written solely for a specific task. Examples are software used
by air traffic controllers to manage the flights of thousands of aircrafts, accounting software,
airline reservations etc.
These are not general-purpose since the users of these kinds of software (for example
accountants and engineers) are trained in a particular field of expertise. Since this software is
specific to an organisation or business, it can be very costly to create.
4. Integrated software – this is a term used to describe a program that includes the major
types of applications such as word processing, spreadsheets, database, presentation programs
etc. and brings them together into a single software package, for example Microsoft Office
Professional 2007. A major advantage of these packages is the ease with which data can be
transferred from one component to another (via copy, paste, import etc.).
SYSTEMS SOFTWARE
The operating system and utility programs are the two major categories of system software.
Utility Programs
Utility programs help manage, maintain and control computer resources. These programs
are available to help you with the day-to-day chores associated with personal computing and to
keep your system running at peak performance.
Some examples of utility programs include:
✓Virus scanning software
✓Backup software
✓Scandisk
✓Disk defragmenter
Virus Scanning Software (Anti-virus software) is a utility program designed to protect your
computer from computer viruses. Virus scanning software is critical due to the number of
computer viruses. Updates insure that your virus scanning software will protect you from the
most recent viruses. Virus scanning packages come with directions on how to receive updates to
your software!
Backup software is software that assists you in backing up your files, including the entire
computer hard disk. It is important for you to back up your files regularly because in the event
of computer failure, all necessary data will be saved to another storage medium.
Scandisk is a utility provided with Windows computers. Scandisk scans your disks to see if
there are any potential problems on the disk, such as bad disk areas. Since disks are magnetic
media, all disks, including your hard disk can be corrupted.
Disk Defragmenter software assists you in reorganizing your disk drives. After files are saved,
deleted and re-saved 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.
Without operating system software, the computer would not be able to function. Therefore, the
O.S. is switched on as soon as the computer is power on or ‘boot’ the system.
Booting is the process of loading the operating system software into a computer’s main
memory from disk.
Microsoft Windows (e.g. Windows 98, Windows XP, Windows Vista) and Apple Macintosh OS
are also operating systems. They provide a picture-based interface called a graphical user
interface or GUI. With a GUI, you often use a mouse to select the operations you want to
perform. Other OS include Linux and Unix.
1. File management – performs functions such as saving, copying, renaming erasing, deleting
and backing-up files.
2. Memory management – the OS manages all the files on a computer. It keeps track of the
locations where programs and data are stored within the computer’s memory.
3. Security – allows the user to set passwords to allow only those users with the correct
password to use the system. The OS keeps a log which records users logged in, the length of
time each user spent on the system and what they did. Administrators can check the log to look
for security breaches and abuse of resources.
4. Device management – the OS sets rules for controlling hardware resources such as:
✓Peripherals – controlling devices such as keyboards, printers and scanners.
✓Memory – controlling the amount of memory used
✓CPU – controlling the time allocated to a task by the CPU
✓Disk space – controlling the amount of disk space used
5. Managing computer resources – the OS allows application software such word processors,
spreadsheets and database packages to communicate with the computer’s hardware. For
example printing a document.
6. Managing tasks – a computer can perform many tasks simultaneously. One way of doing this
is by multi-tasking, i.e. the ability of a computer to run more than one program at the same
time. For example, a user can listen to music while typing a document or playing a computer
game.
In the case of networks, multi-user OS allows more than one user to access the same data at the
same time.
Multiprogramming The ability of a computer to execute two or more programs at the same
time, using one CPU (or processor).
Multiprocessing The ability of a computer to execute programs on two more processors
simultaneously. The program is distributed over several processors.
USER INTERFACES
A computer-user interface determines how the user interacts with a computer and uses it.
After the computer has booted up and loaded the operating system, you will see the user
interface (also known as the human-computer interface).
There are three (3) main types of user interfaces:
1. Command-line interface
2. Menu-driven interface
3. Graphical user interface (GUI)
COMMAND-LINE INTERFACES
Command-line interfaces require you to type in commands using a special language. This
special language makes command-line interfaces difficult to use, especially for new computer
users. One example of this type of interface is Microsoft Disk Operating System (MS-DOS),
also known as Command Prompt.
MENU-DRIVEN INTERFACES
A menu is a list of options from which you can choose what you want to do. Application
programs use menus as an easy alternative to having to learn program commands. Menu-
driven interfaces were developed in order to make the interface ‘friendlier’ and ‘easier to
learn’. You can control the computer by choosing commands and available options from a
menu, using the keyboard or the mouse.
Window – A window is that part of the screen that holds its own document or message.
Icon – An icon is a tiny picture of an object that is displayed on the screen. They represent
programs, folders, files, recycle bin, disk drives and printers.
Menus
An advantage of using menus is that for most programs, the first few menus are always in the
same order (e.g. file, edit, view, insert etc.). They also carry out the same functions no matter
what program you are using. For example, the ‘File’ menu is always first and enables you to
create, save, print etc.
Pointers –A pointer is an arrow found on the screen. As the mouse moves, the pointer moves in
the same direction. The pointer is a very important part of a GUI as it enables you to:
• Control the computer and to choose window items
• Select text in a document
• Select cells in a spreadsheet
TYPES OF MENUS
Pull-down menus – these are activated by clicking on an item (such as ‘File’) using the left
mouse button. The menu ‘pulls-down’ just below the menu item.
Pop-up menus– are activated by clicking anywhere on the document screen by using the right
mouse button. Some standard commands and options are cut, copy and paste.
Data must be processed by the most suitable means. It can then be transferred to one or more
computer systems for further processing, output or storage. Processing can be achieved by
three methods:
1. Batch processing – data is collected in a batch before processing starts. With early
computers, data was entered on ‘punched cards’ (or Hollerith Cards), which were handled in
batches, hence the term batch processing. Most suitable for tasks where a large amount of data
has to be processed on a regular basis. When a batch job begins, it will continue until it is
completed or until an error occurs. Examples of batch processing include those that process
utility bills such as water and electricity, payroll systems and examination report cards.
Advantages
• Once the data is submitted, the computer can be left to run without human
interaction
• The computer is only used for a certain period of time for the batch job
• Jobs can be scheduled for a time when the computer is not busy
Disadvantages
• There is always a delay before the work is processed because batch jobs are
stored over a period of time
• Involves the use of an expensive computer and a large number of trained staff
2. On-line processing – computers and peripherals devices are ‘on-line’ when they are
connected to a main processor and powered on, so that the operator can interact with
them. Examples of on-line processing include devices such as printers which are on-line when
they are ready to receive data from the computer to print. Most printers have an on-line button
you can press to turn the machine on. If it is turned off, then you are off-line. You can also be
on-line if you are connected to the Internet through a modem or network.
3. Real-time processing – real-time processing systems process data without significant delay,
making it always up-to-date. Since processing must be connected to one or more computers to
process data, then it must also be on-line. (N.B. on-line systems do not necessarily imply that
processing is real-time since there may be delays with an on-line system). Examples include
aeroplane landing control system, flight simulation, electronic fund transfer systems and ticket
reservation systems.
Advantages
• No significant delay for response
• Information is always up-to-date
• Output from the computer may be used to adjust and improve the input back
into the system
Disadvantages
• The computer must be dedicated solely to the task
• The computer must always be on-line
Defining the program can be accomplished by decomposing the problem into three key
components:
1. What is given (input)
2. The tasks that must be performed (processing)
3. The expected results (output)
A table with three columns which represents the three components: input, processing and
output.
* Input refers to the source data provided - easily identified by the keywords – given, read or
accept, input
* Output refers to the end result required - keywords are print, display, produce, output
*Processing are the actions must be performed to achieve the required output - it answers the
question: What must I do with the inputs in order to produce the desired result?
PROBLEM 1:
Write a solution to read three numbers and calculate and print the total.
VARIABLES
INITALIZATION OF VARIABLES
* Variables that are used as counters or used to store totals should always be assigned an initial
value of zero (0) before they are used.
* This is called initialization, e.g. Count = 0
* This ensures that the variable is cleared of any values that may have been assigned in a
previous execution of the program
OPERATORS
The logical operators compare Boolean expressions (an expression that results in a value of either
TRUE or FALSE) and returns a Boolean result (either TRUE or FALSE).
AND
Expression A Expression B Result
OR
Expression A Expression B Result
NOT
Expression Result
False True
True False
WHAT IS AN ALGORITHM?
It is really used to expand the ‘processing’ part of the Defining Diagram in pseudocode or
pseudo-English.
ALGORITHM EXAMPLE 1
Write an algorithm that prompts the user to enter his/her nameand prints a welcome message
to the user.
Solution:
This algorithm prints a welcome message for the user and displays his/her
name. {Declaration}
name – stores the name which the user inputs {Variable}
Start
Print ‘Please enter your name’ Body
Input name
Print ‘Welcome to the world of problem-solving’,name
Stop {Terminator}
ALGORITHM EXAMPLE 2
Construct an algorithm to prompt the user to input three (3) numbers and calculate the average.
The algorithm should printboth the sum and average.
Solution
This algorithm calculates and prints the sum and average of three numbers. {Declaration}
num1,num2,num3 – stores the 3 numbers
Sum – stores the sum of the 3 numbers Variable(s)
Average – stores the average of the 3 numbers Declaration
Start
Print ‘Enter three numbers’
Input num1, num2, num3
Set Sum to num1+num2+num3 Body
Set Average to Sum/3
Print ‘The sum is: ‘,Sum
Print ‘The average is: ‘, Average
Stop {Terminator}
FLOWCHARTS vs PSEUDOCODE
Start
Print ‘Enter three numbers’
Input num1, num2, num3
Set Sum to num1+num2+num3
Set Average to Sum/3
Print ‘The sum is: ‘,Sum
Print ‘The average is: ‘, Average
Stop
PROGRAMMING CONSTRUCTS
SELECTION STRUCTURES
Selection (decision)- This construct is used when no action needs to be performed if the
expression returns false.
Syntax:
IF (expression) THEN
{Statement (s)} Execute statement(s) if logical expression is TRUE
Eg.1) Write an algorithm to read the score of a student in an examination and determine
whether the student has passed. If the score is greater than or equal to 50, the student has
passed. Print whether the student has passed.
Answer
Start
Print (‘Please enter the score’)
Input Score
IF Score >= 50 THEN
Print ‘PASS’
Stop
The IF … THEN … ELSE construct syntax:
IF (expression) THEN
{Statements} executed only if condition is TRUE
ELSE
{Statements} executed only if condition is FALSE
ENDIF
Only one group of statements could be executed each time the program is executed
Eg.2) Using the scenario in Example1, determine whether the student has passed or failed and
print the result.
Answer
Start
Print (‘Please enter the score’)
Input Score
IF Score >= 50 THEN
Print ‘PASS’
ELSE
Print ‘FAIL’
Stop
Eg.3) Write an algorithm which accepts a number and determines whether the number is ‘odd’
or ‘even’. Print the result.
Answer
Start
Print(‘Please enter a number’)
Input num
IF (num MOD 2 = 0) THEN
Print(num,’ is even’)
ELSE
Print(num,’ is odd’)
Stop
Eg.4) Write an algorithm which reads the age of a person and determine whether he/she is a
student. The person is considered a student if he/she is between the ages of 5 and 18. If the
person is under the age of 5 then he/she is a ‘toddler’. Otherwise, the person is an adult. Print
the age of the person.
Answer
Start
Print(‘Please enter the person’s age’)
Input age
IF (age <= 18) AND (age >=5) THEN
Print(‘You are a student’)
ELSE IF (age < 5) THEN
Print(‘You are a toddler’)
ELSE
Print(‘You are an adult’)
Stop
REPETITION STRUCTURES
Eg.) A man works 40 hours per week and he is paid an hourlyrate of $50.00 per hour. Construct
pseudocode algorithm and flowchart to read the names and hours worked for 10 employees.
Determine and print their weekly wages along with their names.
Answer
Start
FOR x = 1 to 10 DO
Print (‘Please enter a name and hours worked’)
Input Name, Hours
Set Wage to Hours * 50
Print (Name,’ $’,Wage)
ENDFOR
Stop
Eg 2.) Write a pseudocode algorithm to print a conversion tableto convert miles
to kilometres. The table ranges from 5 to 100 miles in steps of 5 [1 mile = 1.161km].
Answer
Start
FOR x = 1 to 100 DO STEP 5
km = x * 1.161
Print(x,’ miles = ‘,km)
ENDFOR
Stop
Start Start
Print(‘Please enter a number’) Print(‘Please enter a number’)
Read(num) Read(num)
WHILE (num <> 999) DO REPEAT
sum = sum + num sum = sum + num
Print(‘Please enter a number’) Print(‘Please enter a number’)
Read (num) Read(num)
ENDWHILE UNTIL (num = 999)
Print(‘The sum is: ‘, sum) Print(‘The sum is: ‘, sum)
Stop Stop
TRACE TABLES
A Trace Table is used to do a ‘dry run’ or ‘manual trace’ of the algorithm to test to see if it is
working.
Trace tables can be a very useful tool, consisting of a table in which each row shows the state of
each step in the algorithm.
Each column shows the value of a variable at a given step.The trace table allows you to check
the algorithm for errors.
FOR x = 1 to 3 DO
FOR y = 1 to 3 DO
Product = x*y
Print Product
EndFOR
TRACE TABLES – EXAMPLE 2
AMOUNT = 2
G=4
WHILE AMOUNT < 50 Do
G = G*2
AMOUNT = AMOUNT + G
Print AMOUNT, G
ENDWHILE
SWAPPING VARIABLES
When swapping the values stored in 2 variables, we would need to introduce a 3rd variablem
called a 'temporary' variable, which will hold the value of one variable while the value from the
other variable is transferred to the other one.
Eg.) Zack and Cody have the same last name. In entering their marks, Cody’s mark was entered
for Zack’s and vice versa. Construct pseudocode algorithm and flowchart to interchange these
two marks.
Answer
Start
Input zack_mark, cody_mark
temp_mark = zack_mark
zack_mark = cody_mark
cody_mark = temp_mark
Print(‘Zack’s mark: ‘,zack_mark)
Print(‘Cody’s mark: ‘,cody_mark)
Stop
DATA COMMUNICATION
Defn: Data communication is the transmission of data and information between two or more
computers.
Data communication is essential for electronic mail (e-mail), voicemail, facsimile (fax),
telecommuting, video conferencing, electronic data interchange (EDI), global positioning
systems (GPS), bulletin board systems (BBS), on-line services and the Internet.
NETWORKS
Defn: A network is a group of two or more computers linked together so that they can share
resources (hardware, software and data) and can communicate with one another.
Types of Networks
1. Local Area Network (LAN) – this is a network of computers situated within a building.
Each computer in a LAN is called a workstation or a client. There is usually one central
controlling computer called a file server or server.
The following hardware and software is needed for the workstation and file server:
• Network Card for each workstation and server
• Network Operating System
• Network Cables to connect the server and clients
• Hub
2. Wide Area Network (WAN) – this type of network connects networks across a large
geographical area such as a state or a country.
3. Metropolitan Area Network (MAN) – this is a large computer network which usually spans
an entire city.
4. Internet – A network of networks which connects computers worldwide via a huge set of
telecommunication links.
6. Extranet – The part of an intranet that is made accessible to customers, partners, suppliers or
others outside the company.
Defn: Network Topology refers to the configuration of cables, computers, and other peripherals
(such as printers and scanners).
There are three (3) main types of layout of computer networks: star, bus and ring.
1. Star Network – all the nodes (computers) are connected to a central hub. This means that
each computer has its own connection to the network and if there is a break in a cable, it will not
affect the operation of the other computers. However, if the hub breaks down, then all
computers on the hub will not work.
2. Bus Network – this is the simplest type of topology where the nodes are in a line. Bus
networks are cheap and reliable, but if there is a break in the cable, the network is split into two
unconnected parts. Bus networks are slower than star networks.
3. Ring Network – unlike a bus network, a ring network has no end to the line. The last node is
connected to the first node, forming a ring or loop. If a cable breaks, it will affect all computers
on the network. Ring networks are also slower than star networks.
COMMUNICATION MODES
2. Broadcast: using one computer to transmit data and information to serve the needs of
several terminals or computers connected to it in a network e.g. star network.
Transmission modes can be classified according to the direction in which the data flows.
1. Simplex – Data in a simplex line can flow in only one direction (just like traffic on a one-way
street). It is a ‘send-only’ or ‘receive-only’ line. Examples include radio, TV, public address
systems etc.
2. Half-Duplex – Data in a half-duplex line can travel in both directions, but not at the same
time. In other words, data can be sent or received at any given time, e.g. a walkie-talkie.
3. Full-Duplex – Data in a full-duplex line can be sent and received at the same time (like traffic
on a two-way street). Examples include: modems and telephones (both mobile and landlines).
BANDWIDTH
Bandwidth determines the volume of data that can be transmitted in a given time. The wider
the bandwidth, the more data it can transmit. Bandwidths can be grouped into three classes:
narrow-band, voice-band and broad-band.
1. Narrow-band: This type of channel, such as for a telegraph system, can transmit data at slow
speeds of between 10 to 30 characters per second (cps).
2. Voice-band: This type of channel can transmit data at the rate of 1000 to 8000 cps. A
telephone line is voice-band and is one of the most widely used methods of transferring data.
3. Broad-band: Transmits large volumes of data at speeds of over 100,000 cps. Coaxial cables,
fibre-optic cables, microwave links and communication satellites are commonly used to provide
these channels.
1. Cable/wired media – In a cabled computer network, all computers and other peripherals are
attached to transmission cables or cable/wired media. Examples include: twisted pair, coaxial
cable, fibre-optic etc.
CABLE/WIRED MEDIA
1. Twisted Pair – This is a convenient and cheap method of connecting computers and
peripherals in a network. It is normally used for home networking or on small sites where
distances between devices are small and there is no great need for speed.
2. Coaxial Cable- More expensive than twisted pair and is used to transmit voice, video and
data. It is ideal for a medium sized network and for cable TV. They use thickly insulated copper
wire and are capable of high-speed transmission.
3. Fibre-Optic Cable- These cables consist of clear glass fibres where each glass fibre or strand
is as thin as a single grain of hair. Data is transmitted through them as pulses of light rather
than electronic signals. This eliminates the problem of electrical interference, thus making
transmission virtually ‘error-free’. Fibre-optic cables can transmit signals over much longer
distances than coaxial and twisted-pair cables. They can also carry information at vastly greater
speeds and this makes services such as video conferencing possible.
WIRELESS
Wireless LANs use high frequency radio signals, infrared light beams or lasers to communicate
between workstations, file server and hubs. Each workstation and file server on a wireless
network has some sort of antenna (transceiver) to send and receive data.
Common techniques to wireless transmission at present:
1. Infrared transmission- This type operates by using an infrared light beam to carry the data
between devices. There must be a clear line of sight between receiving and transmitting devices.
These systems generate very strong signals as they are susceptible to interference such as light
coming in from windows.
2. Microwaves – These are radio waves which provide high speed transmission of analogue and
digital signals. They are limited to line-of-sight (straight line - no obstructions) transmission,
and is used where it is not possible to put a wire, such as across several city blocks.
3. Satellite transmission- systems are used to connect sites that are widely separated. Usually,
signals are sent to satellites in space, orbiting 22,300 miles above the earth. This orbit puts the
satellite in the same part of the sky relative to a ground based observer at all times.
1. Bluetooth- A specification for the use of low-power radio communications to wirelessly link
phones, computers and other network devices over short distances. Bluetooth technology was
designed primarily to support simple wireless networking of personal consumer devices and
peripherals, including cell phones, PDAs, and wireless headsets. Wireless signals transmitted
with Bluetooth cover short distances, typically up to 30 feet (10 meters).
2. Wi-Fi- This is a wireless networking technology used across the globe. In a Wi-Fi network,
computers with Wi-Fi network cards connect wirelessly to a wireless router (access point). The
router is connected to the Internet by means of a modem, typically a cable or DSL modem. Any
user within 200 feet or so (about 61 meters) of the access point can then connect to the
Internet. Wi-Fi networks can either be "open", such that anyone can use them, or "closed", in
which case a password is needed.
3. Hotspot- A hotspot is any public area where computers that have been fitted with wireless
network technology can gain access to the Internet. The computer accomplishes this by contacting a
nearby wireless network with its internal NIC (Network Interface Card). The NIC seeks out the radio
waves generated by wireless networks. When it detects a signal strong enough, it asks permission to
log on to the network. Though this access is often free, other times the wireless network requires
registration and a small fee before it will grant the computer access. Many cafés now feature a
wireless network environment or hotspot, so that customers can sit leisurely, sip coffee and work on
their laptops with full Internet access.
THE INTERNET
It was started in 1969 in the USA and was used by the military to communicate and share
confidential information in the event of a nuclear attack.
Today, businesses set up websites on the Internet to:
• Advertise what they sell
• Allow customers to e-mail them with orders, enquiries and requests
• Reach an international audience
Internet Protocol
This is a set of rules (sometimes known as a ‘protocol’) for sending and receiving data over the
Internet is known as TCP/IP (Transmission Control Protocol/Internet Protocol). TCP/IP
breaks down the data into little chunks or ‘packets’, which are sent to other to other computers
on the Internet. It is also responsible for ensuring that the data is re-assembled into its original
form.
The IP (Internet Protocol) address looks something like this: 69.93.141.146. This address maps
to a more human friendly address, such www.wiseGEEK.com. When you connect to the internet,
your personal computer also receives a unique IP address assigned by your ISP (internet service
provider). This address identifies your computer's location on the network.
Internet Addresses
Every site on the Internet has an address known as a URL (Uniform Resource Locator). To
access a website, the address or URL is entered in the web browser. The format of a URL is as
follows:
http://www.yourwebsite.com
http:// - HTTP stands for Hypertext Transfer Protocol. It is a set of rules that controls how
data travels between web server and client. This is the protocol that gives access to a website.
www – world wide web
yourwebsite - an identifier for your website
.com - the top-level domain which determines the type of website
TOP-LEVEL DOMAINS
The top level domain is the part of the URL that specifies what exactly that site is part of
(institution, government, business, etc.). These include:
A web page or webpage is a resource of information that is suitable for the World Wide Web
and can be accessed through a web browser. This information is usually in HTML or XHTML
format, and may provide navigation to other web pages via hyperlinks.
Hyperlink: is a link you can click on in a document to go to another section of the same
document or to another document that may be stored on a different web server. Hyperlinks
allow you to move easily from one document to the next.
Website: A website is a collection of Web pages that is accessible generally via HTTP on the Internet;
all publicly accessible websites in existence comprise the World Wide Web. The pages of a website
will be accessed from a common root URL, the homepage, and usually reside on the same physical
server.
Hypertext Markup Language (HTML)
This is a text based language used to create web pages for display by a web browser. It is a
formatting language since it consists of codes which instruct the browser how to create, format
and display the information on the web page. The data to be displayed is written in plain text
and the formatting codes are written amongst them. These codes are usually represented with
the <> brackets around them,
e.g. <html> is at the beginning of the document and </html> is at the end of the document.
1. Electronic Mail (e-mail): this is the most popular service on the Internet today. It allows you
to send, receive and manage electronic messages (text, sound, video and graphics) and
communicate with friends, family and businesses all over the world.
2. World Wide Web (www): popularly known as the web, is the main way of accessing
information on the Internet. The Web is based on pages of information called websites, which
are linked and viewed by a web browser. Please note that the Internet and Web are NOT the
same! The Web can be thought of as a subset of the Internet.
3. File Transfer Protocol (FTP): this is a set of rules for the transfer of files over the
Internet. It enables you to find an electronic file stored on a computer somewhere on the
Internet and ‘download’ it to your computer
Download – taking a file from a web server or a computer on one part of the Internet and
copying it to your computer.
Upload- this is sending files to other computers on the Internet or to websites.
4. Internet Relay Chat (IRC): allows users to go on-line at the same time and exchange text or
audio messages in real time. The most popular IRC services are Yahoo Messenger, MSN
Messenger, Google Talk etc.
5. Telnet – this is a remote log-in service provided by certain computer networks on the
Internet. You can search for and identify data on these computer systems. The service is
provided by companies and universities for home users to gain access to services.
6. Newsgroups: these are on-line discussion groups where users with common interests,
anywhere in the world can share their views. The software for accessing newsgroups is usually
included in your computer’s web browser
7. Bulletin Board Systems (BBS): An electronic message centre. Most bulletin boards serve
specific interest groups. They allow you to dial in with a modem, review messages left by others,
and leave your own message if you want. Bulletin boards are a particularly good place to find
free or inexpensive software products.
8. Podcasting: Podcasts are digital media files (most often audio, but they can be video as well),
which are produced in a series. You can subscribe to a series of files, or podcast, by using a piece
of software called a pod-catcher. Once you subscribe, your pod-catcher periodically checks to
see if any new files have been published, and if so, automatically downloads them onto your
computer or portable music player for you to listen to or watch, whenever you wish.
10. Blogs: A blog or web-log is a web site, usually maintained by an individual with regular
entries of commentary, descriptions of events, or other material such as graphics or video. The
blog can be like keeping an online diary of what is going on in your life for others to read. It can
be quite personal or used for more official purposes, like journalists writing about their
experiences while on a particular job. Some people may just be able to read its contents, and in
some cases, be able to respond or put up comments on the blog. Examples include: Google Blog,
Blogger.com etc.
11. E-commerce: a term used for the buying and selling of goods and services over the Internet.
The emergence of e-commerce as a way of customers purchasing has persuaded many
companies to create an e-commerce web site and virtual shops or malls. E-Commerce consists
of buying, marketing, selling and delivering services or goods by means of electronic
transactions and activities. An example is www.amazon.com .
12. E-learning: the use of technology to enable people to learn anytime and anywhere. E-
Learning can include training, the delivery of just-in-time information and guidance from
experts.
13. Search Engines: a software application that finds websites using keywords. If you don’t
know the URL of the site you wish to view, or you wish to research a particular topic, you can
use a search engine to locate it. Search engines have their own website. Some popular ones
include:
Data is said to have integrity if it is accurate and complete when it enters a system and does not
become inaccurate after further processing. Data integrity can be comprised in a number of
ways:
• Inaccurate data entry
• Viruses
• Hardware malfunctions
• Accidental or malicious deletion or changing of data
• Natural disasters such as fires, floods and earthquakes
Data security is a method used to ensure that data maintains integrity. This usually involves:
physical safeguards and software safeguards.
This deals with the protection of hardware and software from accidental or malicious damage
or destruction. For instance:
1. Use of a monitoring system using video cameras
2. Security guards
3. Storing data in a fire/water proof safe
4. Storing data in another building or in another location
5. Distributing sensitive work to a number of employees rather than just one.
MISUSE OF INFORMATION
Organisations gather information from a wide variety of sources including employees, suppliers,
customers and competitors. When information is voluntarily provided to an organisation, it is
usually for a specific purpose, e.g. for hospitals, clinics, insurance agencies etc.
Measures should therefore be in place to ensure that information is not misused. However,
security breaches are common. Also, the use of information for purposes other than that which
it was originally intended for is also common. Some countries have legislation that seeks to
protect individuals from the potential misuse of information, such as:
1. Information should be used only for the purpose for which it was provided
2. The individual has the right to examine the contents of any personal record representing the
individual.
3. The information must be accurate.
4. Security measures must be put into place to protect information.
5. The privacy of the individual must be protected.
COMPUTER CRIMES
Computers have given employees new tools that makes their jobs easier and allowed them to do
things that was not possible before. Unfortunately, this is also true for criminals.
Defn: A computer crime is any illegal action where the data on a computer is accessed without
permission.
This access doesn't have to result in loss of data or even data modifications. The worst computer
crime occurs when there are no indications that data was accessed. Computer crime is
often committed by hackers and crackers, but increasingly organized crime groups have
realized the relative ease of stealing data with relative low-level of risk.
Defn: A hacker is a person who breaks into computers and computer networks, either for profit
or just to prove that they can.
Defn: A cracker is someone who breaks into someone else's computer system, often on a
network; bypasses passwords or licenses in computer programs.
1. Unauthorised Access - This usually involves 'hacking' or 'cracking'. Some hackers see their
activities as a form of game-playing, where they try to match their skills against other
hackers, others have more destructive intentions such as breaking into an organisation's
computer system to commit acts like 'electronic vandalism' (e.g. deleting files, corrupting
software, and changing critical data).
a. Monitoring with utility software - all data that passes in and out of a network or an
individual's computer can be monitored. This is also known as 'packet sniffing', where a packet
is the message being checked. Messages can be monitored by utility software (such as
Packet Analyzer)or by using a computer on a network which can observe all packets passing
through the network.
c. Monitoring from a distance - done by the use of commercially available equipment which
can receive and process the radiation emittedby the monitor. Data being displayed on the
screen at the moment can then be observed without the knowledge of the user.
Defn: Copyright is the name given to the protection law of the rights of the person(s)
responsible for creating items such as text, a piece of music, a painting or a computer program.
Consider the application Microsoft Word, which was written and improved by hundreds of
programmers. If someone else were to copy the program code or steal it, it would be both
unfair and illegal. A copyright law (enforced by the Intellectual Properties Affairs office in
a country) would make it a criminal offence to be caught copying or stealing software.
Defn: Software piracy is the theft of computer programs and the unauthorised distribution and
use of these programs.
Defn: A Computer Virus is a program that infects computer files and makes them do something
unexpected or damaging.
TYPES OF VIRUSES
1. Those that infect program files - the virus code is attached to program files and when
the program is loaded, the virus is loaded as well.
2. Those that infect system or boot files - the boot file is a small program that tells the
computer how to load the rest of the operating
system. When this file gets infected, the virus is loaded into memory and is able to run when
the computer is on.
3. Macro Viruses - these are written in a macro language which is associated with an
application such a Microsoft Word. The macro virus is
carried by a document file and is executed when the document is opened. Over half of the
known viruses are macro viruses spread by
e-mail attachments.
PREVENTING VIRUSES
1. Install anti-virus software such as: Norton, McAfee, AVG, Avast etc.
2. Turn on program virus protection
3. Try to know the origin of each program or file you use
4. Never open an e-mail with an attachment which contains file extensions such as EXE,
COM, VBS etc.
WHAT IS A WORM?
Defn: A worm is another electronic threat. Unlike a virus, it does not require a host
program in order to be transmitted.
Worms can be transmitted via e-mail and are capable of copying themselves into
memory. Mass mailing worms can create infected e-mail messages and send them to
addresses saved on the infected computer. An example include w32/netsk.b@mm is a
mass mailing worm which e-mails itself to addresses and tries to copy itself onto networks.
Defn: A computer-aided design (CAD) system uses computer hardware and software in the drawing of
engineering or architectural designs.
A CAD package is designed to make easier to produce detailed plans and accurate technical
drawings. It contains software that provides a set of basic elements such as points, lines, circles,
shapes, solids etc., from which all CAD drawings are constructed.
CAD programs can produce 3-dimensional drawings that can be rotated and viewed from many
different angles with the push of a button. In addition, the computer keeps track of design
dependencies, so that when a value is changed all other dependent values are automatically changed.
Advantages of CAD:
1. Designs can be done faster, hence reducing cost
2. Changes to the original design can be easily made
3. Duplicates can be easily made
4. Documentation is generated with the design
Advantages of CAM:
1. Faster production of parts and products
2. Production of a more consistent product
3. The ability to better control and maintain the quality of a product.
CAD/CAM SYSTEMS
These systems are used in the design and manufacturing of products. Engineers use the system to
create the product designs and then to control the manufacturing process.
Two (2) CAD/CAM software packages currently available are: SolidWorks and MasterCAD. They can
create drawings and model trajectories (develop and work out the movements) of cutting tools.
EXPERT SYSTEMS
Defn: An expert system or knowledge-based system is a program that analyses input data and
provides answers at the level of an expert in a particular field.
An expert system is useful in providing support for making decisions and can also suggest alternatives
or other issues to be considered. It consists of two parts:
a. Knowledge Base – this contains a large volume of information in a particular field, for example, the
different types of diseases, symptoms and possible treatments.
b. Inference Engine – this analyses the input data using ‘reasoning’ methods and the knowledge base
arrives at a conclusion. It also provides the user with an explanation of how it arrived at its conclusion
by showing the concepts that were used.
ROBOTICS
Robots are computer-controlled machines that include functions such as locomotion, mobility,
grasping and recognition.
Robots are mainly used in the manufacturing industry:
• Automotive industry
• Electrical and Electronic industry
Defn: A spreadsheet is a grid of cells which organises data into rows and columns.
Spreadsheets enable you to not only store numerical data, but also to apply formulae to carry
out operations on the numerical data, create charts and graphs, sort and filter data.
SPREADSHEET BASICS
Rows – these run left to right across the window and they are identified by a number.
Columns – these run from top to bottom of the window and they are identified by a letter.
Active Cell – This is the cell that is highlighted by a black border so you can tell where you are
in the worksheet.
Label - A text entry. A label is used to identify what we are talking about and is not part of any
spreadsheet calculation.
Worksheet – The row and column sheet where you place your calculations.
FORMULAS IN EXCEL
Defn: A formula is an instruction that tells the computer to work out the answer for the values
entered.
All formulae in Excel must begin with an equal sign (=). The arithmetic operators specify the
arithmetic operation to use in the calculation.
+ Addition = A1 + A2
_ Subtraction = A1 – A2
* Multiplication = A1/A2
/ Division = A1 * A2
If you have many operators in a formula, it is important to follow the rules for the order of
operation:
BODMAS (Brackets, Operators, Division, Multiplication, Addition, Subtraction)
A formula can be entered directly into a cell, or you can use the mouse to point to the cells you
want to include.
When creating a formula, you may use:
• Actual values, e.g. =7*5
• Cell addresses, e.g. =C4+B2+D22
• A combination of the two, e.g. =C2/8
FUNCTIONS
Since a function is a formula, it again begins with an equal sign.The syntax or structure of a
function is as follows: