CSC 111 Lecture Notes 2019
CSC 111 Lecture Notes 2019
1
RESTRICTED
RESTRICTED
Unit 4: In this unit you will be familiarized with hardware components of the
computer. This will enable you to appreciate the importance of each component
to the overall smooth operations of the computer.
Unit 5: This unit introduces the computer software in some details. You will learn
about the system software, language translators such as compliers and the utility
software, and application programs in greater detail.
Unit 6: In this unit you will learn about computer programming languages such as
low level language (machine language and assemblers) and the high level
languages.
Unit 8: This unit advances further on unit 10 by discussing the use of flowchart and
algorithms in computer programming. These two concepts are essential
ingredients to the writing of well structured computer programs.
Unit 9: This is the concluding unit of this course. It presents discussion on computer
virus as one of the major threats to the smooth operations of the computers.
Detailed discussions on computer virus, its mode of transmission, detection,
prevention and cure, are presented.
2
RESTRICTED
RESTRICTED
4
RESTRICTED
RESTRICTED
Computer Method
The computer method of carrying out data processing has the following major
features:
a. Data can be steadily and continuously processed
b. The operations are practically not noisy
c. There is a store where data and instructions can be stored temporarily and
permanently.
d. Errors can be easily and neatly corrected.
e. Output reports are usually very neat, decent and can be produced in
various forms such as adding graphs, diagrams, pictures etc.
f. Accuracy and reliability are highly enhanced.
g. Below are further attributes of a computer which makes it to be an
indispensable tool for human being:
• Generations of computer.
1.0 Introduction
The computer as we know it today has evolved over the ages. An attempt is
made in this unit to present in chronological order the various landmarks and
milestones in the development of the computer. Based on the milestone
achievement of each era the computer evolution is categorized into
generations. The generational classification however, is not rigid as we may find
one generation eating into the next.
2.0 Objectives
The objective of this unit is to enable the student to know the processes leading
to the emergence of the modern computer. There can be no present without the
past just as the future depends on the present. By the end of this unit, students
should be able to appreciate and visualize the direction of research in computer
technology in the nearby future.
3.0 A Brief History of Computer Technology
A complete history of computing would include a multitude of diverse devices
such as the ancient Chinese abacus, the Jacquard loom (1805) and Charles
Babbage’s “analytical engine” (1834). It would also include discussion of
mechanical, analog and digital computing architectures. As late as the 1960s,
mechanical devices, such as the Marchant calculator, still found widespread
application in science and engineering. During the early days of electronic
computing devices, there was much discussion about the relative merits of
analog vs. digital computers. In fact, as late as the 1960s, analog computers were
routinely used to solve systems of finite difference equations arising in oil reservoir
modeling. In the end, digital computing devices proved to have the power,
economics and scalability necessary to deal with large scale computations.
Digital computers now dominate the computing world in all areas ranging from
the hand calculator to the supercomputer and are pervasive throughout society.
Therefore, this brief sketch of the development of scientific computing is limited
to the area of digital, electronic computers.
6
RESTRICTED
RESTRICTED
who deserves the credit for this idea, but no one knows how important the idea
was to the future of general purpose computers. ENIAC was controlled by a set
of external switches and dials; to change the program required physically altering
the settings on these controls. These controls also limited the speed of the internal
electronic operations. Through the use of a memory that was large enough to
hold both instructions and data, and using the program stored in memory to
control the order of arithmetic operations, EDVAC was able to run orders of
magnitude faster than ENIAC. By storing instructions in the same medium as data,
designers could concentrate on improving the internal structure of the machine
without worrying about matching it to the speed of an external control.
Regardless of who deserves the credit for the stored program idea, the EDVAC
project is significant as an example of the power of interdisciplinary projects that
characterize modern computational science. By recognizing that functions, in the
form of a sequence of instructions for a computer, can be encoded as numbers,
the EDVAC group knew the instructions could be stored in the computer’s
memory a long with numerical data. The notion of using numbers to represent
functions was a key step used by Goedel in his incompleteness theorem in 1937,
work which Von Neumann, as a logician, was quite familiar with. Von Neumann’s
background in logic, combined with Eckert and Mauchly’s electrical engineering
skills, formed a very powerful interdisciplinary team.
Software technology during this period was very primitive. The first programs were
written out in machine code, i.e. programmers directly wrote down the numbers
that corresponded to the instructions they wanted to store in memory. By the
1950s programmers were using a symbolic notation, known as assembly
language, then hand translating the symbolic notation into machine code. Later
programs known as assemblers performed the translation task.
As primitive as they were, these first electronic machines were quite useful in
applied science and engineering. Atanasoff estimated that it would take eight
hours to solve a set of equations with eight unknowns using a Marchant
calculator, and 381 hours to solve 29 equations for 29 unknowns. The Atanasoff-
Berry computer was able to complete the task in under an hour. The first problem
run on the ENIAC, a numerical simulation used in the design of the hydrogen
bomb, required 20 seconds, as opposed to forty hours using mechanical
calculators. Eckert and Mauchly later developed what was arguably the first
commercially successful computer, the UNIVAC; in 1952, 45 minutes after the polls
closed and with 7% of the vote counted, UNIVAC predicted Eisenhower would
defeat Stevenson with 438 electoral votes (he ended up with 442).
8
RESTRICTED
RESTRICTED
10
RESTRICTED
RESTRICTED
11
RESTRICTED
RESTRICTED
b. General purpose
4. Classification by size
a. Micro computers
b. Mini computers
c. Main frame
d. Super computers
1.0 Introduction
The computer has passed through many stages of evolution from the days of the
mainframe computers to the era of microcomputers. Computers have been
classified based on different criteria. In this unit, we shall classify computers based
on three popular methods.
2.0 Objectives
The objectives of this unit are to:
i. Classify computers based on size, type of signal and purpose.
ii. ii. Study the features that differentiate one class of the computer from the
others.
14
RESTRICTED
RESTRICTED
Digital Computer
Represent its variable in the form of digits. It counts the data it deals with, whether
representing numbers, letters or other symbols, are converted into binary form on
input to the computer. The data undergoes a processing after which the binary
digits are converted back to alpha numeric form for output for human use.
Because of the fact that business applications like inventory control, invoicing and
payroll deal with discrete values (separate, disunited, discontinuous); they are
beset processed with digital computers. As a result of this, digital computers are
mostly used in commercial and business places today.
Analog Computer
It measures rather than counts. This type of computer sets up a model of a system.
Common type represents it variables in terms of electrical voltage and sets up
circuit analog to the equation connecting the variables. The answer can be either
15
RESTRICTED
RESTRICTED
by using a voltmeter to read the value of the variable required, or by feeding the
voltage into a plotting device. They hold data in the form of physical variables
rather than numerical quantities. In theory, analog computers give an exact
answer because the answer has not been approximated to the nearest digit.
Whereas, when we try to obtain the answers using a digital voltmeter, we often
find that the accuracy is less than that which could have been obtained from an
analog computer.
It is almost never used in business systems. It is used by the scientist and engineer
to solve systems of partial differential equations. It is also used in controlling and
monitoring of systems in such areas as hydrodynamics and rocketry; in
production.
There are two useful properties of this computer once it is programmed:
1. It is simple to change the value of a constant or coefficient and study the
effect of such changes.
2. It is possible to link certain variables to a time pulse to study changes with
time as a variable, and chart the result on an X-Y plotter.
Hybrid Computer
In some cases, the user may wish to obtain the output from an analog computer
as processed by a digital computer or vice versa. To achieve this, he set up a
hybrid machine where the two are connected and the analog computer may
be regarded as a peripheral of the digital computer. In such a situation, a hybrid
system attempts to gain the advantage of both the digital and the analog
elements in the same machine. This kind of machine is usually a special-purpose
device which is built for a specific task. It needs a conversion element which
accepts analog inputs, and output digital value. Such converters are called
digitizers. There is need for a converter from analog to digital also.
It has the advantage of giving real-time response on a continuous basis. Complex
calculations can be dealt with by the digital elements, thereby requiring a large
memory, and giving accurate results after programming. They are mainly used in
aerospace and process control applications.
job. In such machines, the steps or operations that the computer follows may be
built into the hardware. Most of the computers used for military purposes fall into
this class. Other example of special purpose computers include:
• Computers designed specifically to solve navigational problems.
• Computers designed for tracking airplane or missiles.
• Computers used for process control applications in industries such as oil
refinery, chemical manufacture, steel processing and power generation.
• Computers used as robots in factories like vehicles assembly plants and
glass industries.
General Attributes of Special Purpose Computers
Special purpose computer are usually very efficient for the tasks for which they
are specially designed.
They are very much less complex than the General-Purpose Computers. The
simplicity of the circuiting stems from the fact that provision is made only for limited
facilities.
They are very much cheaper than the General-Purpose type since they involve
less components and are less complex.
General-Purpose Computers
General-Purpose computers are computers designed to handle wide range of
problems.
Theoretically, a general-purpose computer can be adequate by means of some
easily alterable instructions to handle any problems that can be solved by
computation. In practice however, there are limitations imposed by memory size,
speed and the type of input/output devices. Examples of areas where the
general purpose are employed include the following:
a. Payroll
b. Banking
c. Billing
d. Sales analysis
e. Cost accounting
f. Manufacturing scheduling
g. Inventory control
17
RESTRICTED
RESTRICTED
They are less efficient than the special-purpose computers due to such problems
as;
· Inadequate storage;
· Low operating speed;
· Coordination of the various tasks and subsection may take time.
· General Purpose Computers are more complex than the special purpose
ones.
1. Micro Computers
Microcomputers, also known as single board computers, are the cheapest class
of computers. In the microcomputer, we do not have a Central Processing Unit
(CPU) as we have in the larger computers rather we have a microprocessor chip
as the main data processing unit. They are the cheapest smallest and can
operate under normal office condition. Examples are IBM, APPLE, COMPAQ,
Hewlett Packard (HP), Dell, Toshiba, e.t.c.
Palmtop Computer
Palmtop computer is far smaller in size. All the components are complete as any
of the above but made smaller so that it can be held on the palm.
19
RESTRICTED
RESTRICTED
2. Mini Computers
It is a medium sized computer with moderate cost, available indigenously and
used for large volume applications. It can serve multi-users simultaneously. It is a
midsize multi-processing system capable of supporting up to 250 users
simultaneously.
3. Workstations
Workstation is a computer used for engineering applications (CAD/CAM),
desktop publishing, software development, and other such types of applications
which require a moderate amount of computing power and relatively high-
quality graphics capabilities.
Workstations generally come with a large, high-resolution graphics screen, large
amount of RAM, inbuilt network support, and a graphical user interface. Most
workstations also have a mass storage device such as a disk drive, but a special
type of workstation, called a diskless workstation, comes without a disk drive.
Common operating systems for workstations are UNIX and Windows NT. Like PC,
Workstations are also single-user computers like PC but are typically linked
together to form a local-area network, although they can also be used as stand-
alone systems.
4. Mainframe
The Main Frame Computers often called number crunches have large memory
and they are very expensive. They can execute up to 100MIPS (Meanwhile
Instructions Per Second). They have large systems and are used by many people
for a variety of purpose.
They have large storage and high computing speed (but relatively lower than the
super computers). They are used in applications like weather forecasting, space
20
RESTRICTED
RESTRICTED
applications etc., they support a large number of terminals for use by a variety of
users simultaneously, but are expensive.
5. Super Computers
These have extremely large storage capacities and computing speeds which are
at least 10 times faster than other computers. These are used for large scale
numerical problems in scientific and engineering disciplines such as electronics,
weather forecasting etc. The first super computer was developed in U.S.A. by
CRAY computers. In India the indigenous super computer was developed under
the name Param.
21
RESTRICTED
RESTRICTED
1.0 Introduction
Your Personal Computer (PC) is really a collection of separate items working
together as a team-with you as the captain. Some of these components are
essential; others simply make working more pleasant or efficient. Adding extra
items expands the variety of tasks you can accomplish with your machine.
Architecture of computers
A computer is made up of a group of interrelated entities working together to
achieve a common goal, so it is a ‘system’. All types of computers follow the same
basic physical structure and perform the following five basic operations for
converting raw input data into information useful to their users: Take Input, Store
Data, Processing Data, Output Information, and Control the workflow.
22
RESTRICTED
RESTRICTED
Input Unit
This unit contains devices with the help of which we enter data into computer.
This unit makes link between user and computer. The input devices translate the
information into the form understandable by computer.
Output unit
Output unit consists of devices with the help of which we get the information from
computer. This unit is a link between computer and users. Output devices translate
the computer's output into the form understandable by users.
23
RESTRICTED
RESTRICTED
Note: The most common use keyboard is the QWERTY keyboard. Generally
standard Keyboard has 104 keys.
24
RESTRICTED
RESTRICTED
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 called cells. 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
locations. The address of these locations varies from 0 to 65535.
Memory is primarily of three types:
• Cache Memory
• Primary Memory/Main Memory
• Secondary Memory
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.
Advantages
• Cache memory is faster than main memory.
25
RESTRICTED
RESTRICTED
Secondary Memory
Secondary memory is where programs and data are kept on a long-term basis,
common secondary storage devices are the hard disk and optical disks.
• The hard disk has enormous storage capacity compared to main
memory.
• The hard disk is usually contained inside the case of a computer
• The hard disk is used for a long-term storage of programs and data
• Data and programs on the hard disk are organized into files
• A file is a collection of data on the disk that has a name
The secondary memory (ROM) is also known as external memory or non-volatile.
ROM stands for Read Only Memory. It is slower than main memory. These are used
for storing data/Information permanently. CPU directly does not 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.
A hard disk might have a storage capacity of 500 gigabytes (room for about 500
x 109 characters). This is about 100 times the capacity of main memory. A hard
disk is slow compared to main memory. If the disk were the only type of memory
the computer system would slow down to a crawl. The reason for having two
types of storage is this difference in speed and capacity. Large blocks of data are
copied from disk into main memory. The operation is slow, but lots of data is
copied, Then the processor can quickly read and write small sections of that data
in main memory. When it is done, a large block of data is written to disk. Often,
while the processor is computing with one block of data in main memory, the next
block of data from disk is read into another section of main memory and made
ready for the processor. One of the jobs of an operating system is to manage
main storage and disks this way.
▪ Fast ▪ Slow
▪ Expensive ▪ Cheap
▪ Low capacity ▪ Large capacity
▪ Works directly with the processor▪ Not connected directly to the processor
27
RESTRICTED
RESTRICTED
28
RESTRICTED
RESTRICTED
over the floppy disk storage media (a magnetic media), which only has a
capacity of 1.44 MB.
3. Flash Disk: A storage module made of flash memory chips. A Flash disks
have no mechanical platters or access arms, but the term "disk" is used
because the data are accessed as if they were on a hard drive. The disk
storage structure is emulated.
6. Utility software
1.0 Introduction
The computer hardware are driven by the software. The usefulness of the
computer depends on the programs that are written to manipulate it. Computer
software come in different forms: the operating system, utility software, language
translators and application software. This unit therefore presents detailed
discussions of each category of computer software.
2.0 Objectives
The objective of this unit are to:
i. Identify the different types of computer software.
ii. Discuss the importance of each type of software.
The operating system is the first component of the systems programs that interests
us here. Systems programs are programs written for direct execution on computer
30
RESTRICTED
RESTRICTED
hardware in order to make the power of the computer fully and efficiently
accessible to applications programmers and other computer users. Systems
programming is different from application programming because the requires an
intimate knowledge of the computer hardware as well as the end users’ needs.
Moreover, systems programs are often large and more complex than application
programs, although that is not always the case. Since systems programs provide
the foundation upon which application programs are built, it is most important
that systems programs are reliable, efficient and correct. In a computer system
the hardware provides the basic computing resources. The applications
programs define the way in which these resources are used to solve the
computing problems of the users. The operating system controls and coordinates
the use of the hardware among the various systems programs and application
programs for the various users.
The basic resources of a computer system are provided by its hardware, software
and data. The operating system provides the means for the proper use of these
resources in the operation of the computer system. It simply provides an
environment within which other programs can do useful work.
The operating system acts as the manager of these resources and allocates them
to specific programs and users as necessary for their tasks. Since there may be
many, possibly conflicting, requests for resources, the operating system must
decide which requests are allocated resources to operate the computer system
fairly and efficiently. An operating system is a control program. This program
controls the execution of user programs to prevent errors and improper use of the
computer.
Operating systems exist because they are a reasonable way to solve the problem
of creating a usable computing system. The fundamental goal of a computer
system is to execute user programs and solve user problems.
The primary goal of an operating system is a convenience for the user. Operating
systems exit because they are supposed to make it easier to compute with an
operating system than without an operating system. This is particularly clear when
you look at operating system for small personal computers.
31
RESTRICTED
RESTRICTED
1. To control the allocation and use of the computing system’s resources among
the various users and tasks, and
Modern computer operating systems may be classified into three groups, which
are distinguished by the nature of interaction that takes place between the
computer user and his or her program during its processing. The three groups are
called batch, time-shared and real time operating systems.
32
RESTRICTED
RESTRICTED
The third class of operating systems, real time operating systems, are designed to
service those applications where response time is of the essence in order to
prevent error, misrepresentation or even disaster. Examples of real time operating
systems are those which handle airlines reservations, machine tool control, and
monitoring of a nuclear power station. The systems, in this case, are designed to
be interrupted by external signal that require the immediate attention of the
computer system.
In fact, many computer operating systems are hybrids, providing for more than
one of these types of computing service simultaneously. It is especially common
to have a background batch system running in conjunction with one of the other
two on the same computer.
Network operating systems are not fundamentally different from single processor
operating systems. They obviously need a network interface controller and some
low-level software to drive it, as well as programs to achieve remote login and
remote files access, but these additions do not change the essential structure of
the operating systems.
True distributed operating systems require more than just adding a little code to a
uniprocessor operating system, because distributed and centralized systems differ
in critical ways. Distributed systems, for example, often allow program to run on
several processors at the same time, thus requiring more complex processor
scheduling algorithms in order to optimize the amount of parallelism achieved.
33
RESTRICTED
RESTRICTED
Language Translator
A programming language is a set of notations in which were express our
instructions to the computer. At the initial stage of computer development,
programs were written in machine language conducting the binary system i.e. 0
and 1. Such programs were hard to write, read, debug and maintain. In an
attempt to solve these problems, other computer languages were developed.
However, computers can run programs written only in machine language. There
is therefore the need to translate programs written in these other languages to
machine language. The suites of languages that translate other languages to
machine language are called Language Translator. The initial program written in
a language different from machine language is called the source program and
its equivalent in machine language is called object program.
Utility Software
i. File Conversion: This covers data transfer from any medium to another,
making an exact copy or simultaneously editing and validating.
ii. File Copy: It makes an exact copy of a file from one medium to another or
from an area of a medium to another area of the same medium.
34
RESTRICTED
RESTRICTED
Application software
i. Word Processor: A Word Processor is used to create, edit, save and print
reports. It affords the opportunity to make amendments before printing is
done. During editing character, word sentence or a number of lines can be
removed or inserted as the case may be. Another facility possible is spell
checking. A document can be printed as many times as possible. Word
processors are mainly used to produce: Letters, Mailing lists, Label, Greeting
Cards, Business Cards, Reports, Manual, Newsletter. Examples are:
WordPerfect, WordStar, Display Writer, Professional Writer, LOTUS
Manuscript, Ms-Word, LOCO Script, MM Advantage II etc.
ii. Spreadsheet: Is an application mainly designed for numerical figures and
reports. Spreadsheets contain columns and rows, in which numbers can be
entered. It is possible to change numbers before printing is done. Other
features of spread sheets is the ability to use formulas to calculate, use sum
and average function, ability to perform automatic recalculation and has
the capacity to display reports in graphical modes. Spreadsheet is used for
Budget, Tables, Cost analysis, Financial reports. Tax and Statistical analysis.
Examples are: LOTUS 123, Supercalc, MS Multiplan, MS-excel, VP Planner
etc.
iii. Integrated Packages: They are programs or packages that perform a
variety of different processing operations using data that is compatible with
35
RESTRICTED
RESTRICTED
There are so many packages around, virtually for every field of study but these
are just to mention a few of them. Advantages of these packages include quick
and cheaper implementation, time saving, minimum time for its design, they have
been tested and proven to be correct, they are usually accompanied by full
documentation and are also very portable.
User Programs
This is a suit of programs written by programmers for computer users. They are
required for the operation of their individual business or tasks. Example is a payroll
package developed for salary operation of a particular company.
36
RESTRICTED
RESTRICTED
4.0 Conclusion
Apart from the operating systems, we need program translators for us to be able
to program and use the computer effectively. Since computers do not
understand natural languages, there is the need to have language translators
such as assemblers, interpreters and compilers. Utility programs such file
conversion and scandisk on the other hand, enable us to maintain and enhance
the operations of the computer. Application and user programs such as the word
processors, spreadsheet and the like help us to perform specific tasks on the
computer.
1.0 Introduction
In this unit, we shall take a look at computer programming with emphasis on:
2.0 Objective
The objective of this unit is to introduce the student to the background information
about programming the Computer.
37
RESTRICTED
RESTRICTED
Basically, human beings cannot speak or write in computer language, and since
computers cannot speak or write in human language, an intermediate language
had to be devised to allow people to communicate with the computers. These
intermediate languages, known as programming languages, allow a computer
programmer to direct the activities of the computer. These languages are
structured around unique set of rules that dictate exactly how a programmer
should direct the computer to perform a specific task.
With the powers of reasoning and logic of human beings, there is the capability
to accept an instruction and understand it in many different forms. Since a
computer must be programmed to respond to specific instructions, instructions
cannot be given in just any form. Programming languages standardize the
instruction process. The rules of a particular language tell the programmer how
the individual instructions must be structured and what sequence of worlds and
symbols must be used to form an instruction.
The operation code tells the computer what to do such as add, subtract, multiply
and divide. The operands tell the computer the data items involved in the
operations. The operands in an instruction may consist of the actual data that the
computer may use to perform an operation, or the storage address of data.
Consider for example the instruction: a = b + 5. The ‘=’ and ‘+’ are operation
codes while ‘a’, ‘b’ and ‘5’ are operands. The ‘a’ and ‘b’ are storage addresses
of actual data while ‘5’ is an actual data.
Some computers use many types of operation codes in their instruction format
and may provide several methods for doing the same thing. Other computers use
fewer operation codes, but have the capacity to perform more than one
operation with a single instruction.
a) input-output instructions;
b) arithmetic instructions;
c) branching instructions;
d) logic instructions.
38
RESTRICTED
RESTRICTED
An input instruction directs the computer to accept data from a specific input
device and store it in a specific location in the store. An output instruction tells the
computer to move a piece of data from a computer storage location and record
it on the output medium.
All of the basic arithmetic operations can be performed by the computer. Since
arithmetic operations involve at least two numbers, an arithmetic operation must
include at least two operands.
The effective utilization and control of a computer system is primarily through the
software of the system. We note that there are different types of software that
can be used to direct the computer system. System software directs the internal
operations of the computer and applications software allows the programmer to
use the computer to solve user made problems. The development of
programming techniques has become as important to the advancement of
computer science as the developments in hardware technology. More
sophisticated programming techniques and a wider variety of programming
languages have enabled computers to be used in an increasing number of
applications.
a) Machine language
39
RESTRICTED
RESTRICTED
b) Assembly language
c) High level symbolic language
d) Very high level symbolic language.
The earliest forms of computer programming were carried out by using languages
that were structured according to the computer stored data, that is, in a binary
number system. Programmers had to construct programs that used instructions
written in binary notation 1 and 0. Writing programs in this fashion is tedious, time-
consuming and susceptible to errors.
40
RESTRICTED
RESTRICTED
actual locations for each piece of data used by the program. The most popular
assembly language is the IBM Assembly Language.
While the flexibility of high-level languages is greater than that of the machine
and assembly languages, there are close restrictions in exactly how instructions
are to be formulated and written. Only a specific set of numbers, letters, and
special characters may be used to write a high-level program and special rules
must be observed for punctuation. High level language instructions do resemble
English language statements and the mathematical symbols used in ordinary
mathematics. Among the existing and popular high-level programming
languages are Fortran, Basic, Cobol, Pascal, Algol, Ada and P1/1. The schematic
diagram of the translation process of a high-level language into the machine
41
RESTRICTED
RESTRICTED
language is shown in the diagram below. The high-level languages are, generally,
described as Third Generation (computer) Language (3GL).
(a) Program development systems that help users to learn programming, and to
program in a powerful high level language. Using a computer screen(monitor)
and keyboard under the direction of an interactive computer program, users are
helped to construct application programs.
(d) Debuggers that are programs that help computer user to locate errors (bugs)
in the application programs they write.
The very high level language generally described as the Fourth Generation
(computer) Language (4GL), is an ill-defined term that refers to software intended
to help computer users or computer programmers to develop their own
application programs more quickly and cheaply. A 4GL, by using a menu system
for example, allows users to specify what they require, rather than describe the
procedures by which these requirements are met.
The detail procedure by which the requirements are met is done by the 4GL
software which is transparent to the users. A 4GL offers the user an English-like set
of commands and simple control structures in which to specify general data
processing or numerical operations. A program is translated into a conventional
high-level language such as Cobol, which is passed to a compiler. A 4GL is,
therefore, a non-procedural language. The program flows are not designed by
the programmer but by the fourth-generation software itself. Each user request is
for a result rather than a procedure to obtain the result.
Table of Content
Problem solving with Computer.
Principles of programming.
Stages of programming.
42
RESTRICTED
RESTRICTED
1.0 Introduction
Computer programming is both an art and a science. In this unit, we students shall
be exposed to some arts and science of computer programming including
principles of programming and stages of programming.
2.0 Objectives
vii. Readability: The Code of a program must be well laid out and explained
with comments.
The program is then read (or loaded) into the computer and processed by a
language translator. The function of the translator is to convert the program
statements into the binary code of the computer called the object code. As part
of the translation process, the program statements are examined to verify that
they have been coded correctly, if errors are detected, a series of diagnostics
referred to as an error message list is generated by the language translator. With
this list in the hand of programmer, enters the second level of debugging is
reached.
The error message list helps the programmer to find the cause of errors and make
the necessary corrections. At this point, the program may contain entering errors,
as well as clerical errors or logic errors. The programming language manual will be
very useful at this stage of program development.
After corrections have been made, the program is again read into the computer
and again processed by the language translator. This is repeated over and over
again until the program is error-free.
(vii) Program testing
The purpose of testing is to determine whether a program consistently produces
correct or expected results. A program is normally tested by executing it with a
given set of input data (called test data), for which correct results are known.
45
RESTRICTED
RESTRICTED
For effective testing of a program, the testing procedure is broken into three
segments.
a. The program is tested with inputs that one would normally expect for
an execution of the program.
b. Valid but slightly abnormal data is injected (used) to determine the
capabilities of the program to cope with exceptions. For example,
minimum and maximum values allowable for a sales-amount field
may be provided as input to verify that the program processed them
correctly.
c. Invalid data is inserted to test the program’s error-handling routines.
If the result of the testing is not adequate, then minor logic errors still
abound in the program. The programmer can use any of these three
alternatives to locate the bugs.
(viii) Program documentation
Documentation of the program should be developed at every stage of the
programming cycle. The following are documentations that should be done for
each program.
1. Problem Definition Step
· A clear statement of the problem
· The objectives of the program (what the program is to accomplish)
· Source of request for the program.
· Person/official authorizing the request.
2. Planning the Solution Step
· Flowchart, pseudocode or decision tables
· Program narrative
· Descriptive of input, and file formats
3. Program source coding sheet
4. User’s manual to aid persons who are not familiar with the program to apply
it correctly. It contains a description of the program and what it is designed
to achieve.
5. Operator’s manual to assist the computer operator to successfully run the
program. This manual contains:
a. Instructions about starting, running and terminating the program.
b. Message that may be printed on the console or VDU (terminal) and their
meanings.
c. Setup and take down instruction for files.
Advantages of Program documentation
46
RESTRICTED
RESTRICTED
i. It provides all necessary information for anyone who comes in contact with
the program.
ii. It helps the supervisor in determining the program’s purpose, how long the
program will be useful and future revision that may be necessary.
iii. It simplifies program maintenance (revision or updating)
iv. It provides information as to the use of the program to those unfamiliar with
it.
v. It provides operating instructions to the computer operator.
4.0 Conclusion
The intelligence of a computer derives to a large extent from the quality of the
programs.
In this unit, we have attempted to present in some details, the principles and the
stages involved in writing a good computer program.
1.0 Introduction
In this unit you are introduced to the principles of flowcharts and algorithms. The
importance of these concepts are presented and the detailed steps and
activities involved are also presented.
2.0 Objectives
The objective of this unit is to enable the student grasp the principles of good
programming ethics through flowcharting and algorithms.
3.0 Flowchart
A Flowchart is a graphical representation of the major steps of work in process. It
displays in separate boxes the essential steps of the program and shows by means
of arrows the directions of information flow. The boxes most often referred to as
illustrative symbols may represent documents, machines or actions taken during
the process. The area of concentration is on where or who does what, rather than
on how it is done. A flowchart can also be said to be a graphical representation
of an algorithm, that is, it is visual picture which gives the steps of an algorithm
and also the flow of control between the various steps.
3.1 Flowchart Symbols
47
RESTRICTED
RESTRICTED
Flowcharts are drawn with the help of symbols. The following are the most
commonly used flowchart symbols and their functions:
Name Symbol Uses
3.2 Algorithms
Before a computer can be put to any meaningful use, the user must be able to
come out with or define a unit sequence of operations or activities (logically
ordered) which gives an unambiguous method of solving a problem or finding
out that no solution exists. Such a set of operations is known as an ALGORITHM.
An algorithm, named after the ninth century scholar Abu Jafar Muhammad Ibn
Musu Al-Khowarizmi, is defined as follows:
Example
Write an algorithm to compute a customer’s bill. Note bill = unit price x Quantity.
Solution
1. Input values for Unit price and Quantity
2. Compute value for Bill
49
RESTRICTED
RESTRICTED
Example 1: The diagram below represents a program flowchart for finding the
sum of first five natural numbers ( i.e. 1,2,3,4,5).
50
RESTRICTED
RESTRICTED
Example 2: Draw the flowchart for computing a customer’s bill. Hints: Bill = unit price x
Quantity.
Start
Compute Bill
Output Bill
51
RESTRICTED
RESTRICTED
Example 4
Draw a flowchart to find the largest of three numbers A, B, and C.
52
RESTRICTED
RESTRICTED
3.4 Pseudocode
Pseudocode is a program design aid that serves the function of a flowchart in
expressing the detailed logic of a program. Sometimes a program flowchart
might be inadequate for expressing the control flow and logic of a program. By
using Pseudocode, program algorithm can be expressed as English-language
statements. These statements can be used both as a guide when coding the
program in specific language and as documentation for review by others.
Because there is no rigid rule for constructing pseudocodes, the logic of the
program can be expressed in a manner without confronting to any particular
programming language. A series of structured words is used to express the major
program functions. These structured words are the basis for writing programs using
a technical term called “structure programming”.
STORE 1 TO COUNT
DO WHILE COUNT not greater than 50
ADD COUNT to SUM
INCREMENT COUNT by 1
ENDWHILE
OUTPUT SUM
END
4.0 Conclusion
Flowcharts, pseudocodes and algorithms are essential ingredients to the writing
of good programs. If they are done properly, they lead to reduction in errors in
programs. They help minimize the time spent in debugging. In addition, they make
logic errors easier to trace and discovered.
5.0 Summary
In this unit we have learnt that:
i. A Flowchart is a graphical representation of the major steps of work in
process. It displays in separate boxes the essential steps of the program and
shows by means of arrows the directions of information flow.
ii. Pseudocode is a program design aid that serves the function of a flowchart
in expressing the detailed logic of a program.
iii. An algorithm is a set of rules for carrying out calculation either by hand or
a machine.
1.0 Introduction
One of the biggest fears of having computers are viruses, viruses are malicious
programs designed entirely for destruction and havoc. Viruses are created by
people who either know a lot about programming or know a lot about
computers.
2.0 Objectives
The objective of this unit is to introduce students to the concept of computer virus,
its mode of transmission, detection, prevention and cure.
54
RESTRICTED
RESTRICTED
55
RESTRICTED
RESTRICTED
individuals and do not infect the same locations of memory and or files this
could mean multiple viruses can be stored in one file, diskette or computer.
6. Can make the system never show outward signs. Some viruses will hide
changes made such as when infecting a file the file will stay the same size.
7. Can stay on the computer even if the computer is formatted. Viruses have
the capability of infecting different portions of the computer such as the
CMOS battery.
HOW VIRUSES MAY EFFECT FILES
Viruses can affect any files however usually attack .com, .exe, .sys, .bin, .pif or
any data files. Viruses have the capability of infecting any file however will
generally infect executable files or data files such as word or excel documents
which are open frequently.
• It can increase the files size, however this can be hidden. When infecting
files virtues will generally increase the size of the file however with more
sophisticated viruses these changes can be hidden.
• It can delete files as the file is ran. Because most files are loaded into
memory and then ran once the program is in memory the Virus can
delete the file.
• It can corrupt files randomly. Some destructive viruses are not designed
to destroy random data but instead randomly delete or corrupt files.
• It can cause write protect errors when executing .exe files from a write
protected disk. Viruses may need to write themselves to files which are
executed because of this if a diskette is write protected you may receive
a write protection error.
• It can convert .exe files to .com files. Viruses may use a separate file to
run the program and rename the original file to another extension so the
exe is ran before the com.
• It can reboot the computer when a files is ran. Various computers may
be designed to reboot the computer when ran.
DETECTING VIRUSES
The most commonly used method of protecting against and detecting viruses is
to purchase a third-party application designed to scan for all types of viruses. This
is known as an antivirus.
Alternatively, a user can look at various aspects of the computer and detect
possible signs indicating a virus is on the computer. While this method can be used
to determine some viruses it cannot clean or determine the exact virus you may
or may not have.
4.0 Conclusion
56
RESTRICTED
RESTRICTED
Computer viruses are perhaps the greatest threats to the computer. If not
detected and promptly cured, computer virus attack could lead to the total
breakdown of the computer. With the aid of our discussion in this unit, students
should be able to prevent, detect and clean viruses in a computer installation.
5.0 Summary
In this unit we have learnt the following:
(a) That computer viruses are programs written by programmers with the aim of
causing havoc to the computer.
(b) Computer viruses could lead to malfunctioning and total breakdown of the
computer.
(c) Computer viruses are transferred from one computer to another through the
use of infested storage media such as flash drive, CDROM, or across a computer
network (internet).
(d) There are antivirus packages specially written to prevent, detect and clean
viruses.
57
RESTRICTED