0% found this document useful (0 votes)
48 views76 pages

CSC 111 Complete

Tyyyyjuuiiijjiiiiiiioooookllollkkkkkkkklolkhhjiiiiiiiiiiiiikgghjjjkhggghjjkkkkgghjjkkkkkkkkkkkjjkkkkkkkkkkkkkiiiiiioiooooffhjjkkkkkkkookijjjkikiiioooooooooooooooooijjjkiiiiiiooooiiiiiijkiiiiiiiiiiiiiiiiiiiiiiiiiiiikhhjkghkkhjkkkjhuuyghijjjjjj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views76 pages

CSC 111 Complete

Tyyyyjuuiiijjiiiiiiioooookllollkkkkkkkklolkhhjiiiiiiiiiiiiikgghjjjkhggghjjkkkkgghjjkkkkkkkkkkkjjkkkkkkkkkkkkkiiiiiioiooooffhjjkkkkkkkookijjjkikiiioooooooooooooooooijjjkiiiiiiooooiiiiiijkiiiiiiiiiiiiiiiiiiiiiiiiiiiikhhjkghkkhjkkkjhuuyghijjjjjj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

MODULE ONE
DEFINITION, CHARACTERISTICS, CLASSIFICATIONS AND
HISTORICAL DEVELOPMENT OF COMPUTER SYSTEM

1.0 BASIC COMPUTING CONCEPTS


A computer can be described as an electronic device that accepts data as input, process the data
based on a set of predefined instructions called program to produce the result of these operations
as output called information. From this description, a computer can be referred to as an Input-
Process-Output (IPO) system, pictorially represented in the figure below:

INPUT PROCESS OUTPUT

Input – Process –Output representation of a Computer System


Data is a piece of basic raw fact, such as a score in examination or the name of a student, for
example 55 or Malik respectively. There are three types of data – Numeric, alphabetic, and
alphanumeric. Numeric data consists of digits 0 – 9 (e. g. 31), while alphabetic data consist of any
of the English language alphabets (e. g. Toyin). An alphanumeric data can consist of a number,
an alphabet or a special character, such as a vehicle plate number (e. g. AE 731 LRN).

Information: data as described above contain no meaning, however, when it is transformed into
a more meaningful and useful form, it is called information. The transformation process involves
a series of operations to be performed by the computer on the raw data that are fed into it. The
operation can be arithmetic (such as addition, subtraction, multiplication, and division), logical
comparison or character manipulation (as in text processing).

Logical comparison means testing whether one data item is greater than, equal to, or less than
another item, and based on the outcome of the comparison, a specified action can be taken. The
output of the processing can be in form of reports which can be displayed or printed.

1.1 CHARACTERISTICS OF A COMPUTER SYSTEM


A typical electronic computer has the following characteristics:

1
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1. Electronic in nature - Data are represented in form of electrical pulses. Operation is


electronic and basic components are also electronic e.g. integrated circuit
2. High speed - in the order of Nanoseconds (that is 10-9 of a second.)
3. High degree of accuracy, in the order of 10-15
4. Consistency – that is given the same set of input data, the same result will always be
produced
5. Ability to perform repetitive operations without getting bored or fatigued
6. Could store information on a long term basis
7. Automatic control – once initiated, it could operate on its own, without human
intervention, under the control of stored sequences of instructions called program
8. Flexibility and programmability

These characteristics have made computer to be very versatile in all human endeavours such as
scientific researches, weather forecasting, medicine, security systems, library system, language
translations, classroom instructions, engineering design, payroll, billing, sales analysis, inventory,
office automation and so on.
1.2 CLASSIFICATION OF COMPUTERS
Computer can be classified into various forms because of the complexity and diversification in its
application. In this text, four basic classifications will be adopted. These are classification
according to generations, classification according to types, classification according to size and
classification according to usage or functions.

1.2.1 Classification according to Generation


The industrial revolution during and after the 2nd world war was fully annexed by the stakeholders
in information technology to fully actualize their dreams of having a very reliable computer, hence,
the classification of computers into generations. There are five basic generation to which computer
can be classified.
1. First Generation Computer: These were the early computers that were manufactured in
1940’s and last till 1950’s. The first generation computers were characterized with the use
of vacuum tubes as its major components. These vacuum tubes generate enormous heat
and consume much electricity. The first generation computers introduce the concept of

2
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

stored programs. Exclusively, computer experts can program the computer only in machine
language, which makes it programmable. Examples are UNIVAC, ENIAC etc
2. Second Generation Computer: These were the set of computers that succeeded the first
generation computers. Their advent was in early 1950’s and the lasted until late 1950’s.the
components of the second generation of computer were built around transistors which
replaces the vacuum tube in the first generation. The resultant effect of the transistors in
place of vacuum tube is reduction in size compare with first generation computers, less
power consumption, generation of less heat and improved storage facility due to
introduction of magnetic devices for storage medium. The overall effects are the improved
reliability and introduction of symbolic languages for programming. Examples are
ATLAS, IBM 1400 series, PDP I & II etc.
3. Third Generation Computer: This generation of computer succeeded the second
generation computers. The advent of this generation was between early 1960’s to late
1960’s. Due to the technological advancement that has taken place in the industrial sector
which makes many transistors to be coupled into a single unit component. Hence, the major
component that characterized the third generation computer is the Integrated Circuitry (IC),
which is a resultant effect of thousands of transistors combined into a single unit
component. The integration of transistors into one component makes the computer smaller
in size compare with first and second generation computers, faster machine, consume less
power and generate less heat. The concept of multi-programming was introduced in this
generation of computer. Programming was made easier by the use of high level languages.
Examples include: IBM 360/370 series, ICL 1900 series etc.
4. Fourth Generation Computer: The emphasis in the first three generations of computer
has been on the development of a computer system that is less expensive, more portable
and highly reliable. The fourth generation computers were also developed having in mind
the above assertions. These generations of computers were built around Very Large-Scale
Integrated Circuitry (VLSI) in which over ten thousand flip-flops were placed in a single
silicon chip i.e thousands of ICs were combined into a single chip. These period witness
the era of microcomputer with the introduction of microprocessors as its major component.

3
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The system came into being in the early 1970’s and still in existence till date. Examples
include: IBM, COMPAQ 2000 series, Dell series, Toshiba etc.
5. Fifth Generation Computer: The development of the fifth generation computers started
in the 1980’s and classical researches are still going on in this generation of computers.
Although, some of these machines are already in use, but a lot of work still need to be done
to actualize the reasons for this generation of computer. The objective of this computer
system is to build a computer system that mimic the intelligence of human expert in a
knowledge domain such as medicine, law, education, criminal investigation, etc. This
objective is achieved through the implementation of Artificial Intelligence and Expert
Systems development.

1.2.2 Classification according to Types


Computer types can be classified into three. These are Analogue, Digital and Hybrid computers
1. Analogue Computer: This type of computer deals with quantities that are continuously
varying. It measures changes in current, temperature or pressure and translates these data
into electrical pulses for processing. Examples are speedometer, electric meter, water
meter, thermometer etc.
2. Digital Computer: This operates on data representation in form of discrete values or digits
(e.g 0,1,2,3,X,Y,Z,…). They handle numbers discretely and precisely rather than
approximately. These types of computers are very common in use both at home and offices.
3. Hybrid Computer: These types of computers combine the features of both analogue and
digital computers. They handle data in both discrete quantity and variable quantities. They
are mostly found in industrial processes for data acquisition and data processing purposes.
In most cases, analogue signal generated from the analogue computer needs to be converted
to digital signal which has to be processed by the digital computer, hence, the need for
Analogue-to-Digital Converter and Digital-to-Analogue Converter
modulator/demodulator (Modem).

1.2.3 Classification according to size


Computer classifications based on sizes are as follows:

4
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1. Mainframe Computer: This is a system that has a very powerful Central Processing Unit
(CPU) linked by cable to hundreds or thousands of terminals, this system is cable of
accepting data simultaneously from all the terminals at the same time. These type of
computers are very big and very expensive general-purpose computers with memory
capacity more than 100 million bytes and processing power of well above 10 million
instructions per second (MIPS). Mainframe computers are used in large organizations such
as Banks, Oil companies, big hospitals, airline reservations companies, examination bodies
such as WAEC, NECO, JAMB etc. that have very large volumes of data to process which
also need to be adequately secured. Examples include ICL 1900 and IBM 360/370 series,
IBM 704 etc.
2. Minicomputer: This type of computer share similar features with mainframe computer
but it is smaller in physical size; generate lower heat, less instruction set and less expensive.
It requires the same conditions for its operation like mainframe; such conditions are very
cool environment because of the enormous heat being generated, raise or false floor, dust
free environment, high-secured office accommodation. Examples of minicomputers are
IBM AS/400, NCR Tower 32, DEC System, PDP 7 etc.
3. Microcomputer: These types of computer are much smaller in size compare to mini and
mainframe computers. They are ridiculously cheaper in terms of naira value compare to
either mainframe or minicomputer. On these systems, various integrated circuits and
elements of computer are replaced by a single integrated circuit called “chip”.
Microcomputer was first developed by companies like Apple Computers and later by IBM
PC in 1981. It is also called Personal Computer (PC).
4. Super Computers: The super computers are extraordinarily powerful computers and they
are the largest and fastest computer systems in recent time. They provide high level of
accuracy, precision and speed for mathematical computations, meteorological,
astronomical and oil exploration applications. In most of the Hollywood’s movies it is used
for animation purposes. It is also helpful for forecasting weather reports worldwide.
Examples are Cray-1, Cyber series, Fujistu, ETA-10 system. Most of these machines are
not available for commercial use.

5
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

5. Notebook Computers: The have small size and low weight. The notebook is easy to carry
anywhere. This is easy to carry around and preferred by students and business people to
meet their assignments and other necessary tasks. The approach of this computer is also
the same as the personal computer. It is a replacement of personal desktop or
microcomputer. Also referred to as laptop. E.g HP 530, Dell etc
Other types of computers based on size are palmtop and PDA (Personal Digital Assistant).

1.2.4 Classification according to usage/function


There are two classifications to which computer are classified according to its usage or function.
These are special purpose and general purpose computers.
1. Special Purpose Computer: This type of computer is specially developed to perform only
one task. The system is highly efficient and economical but lacks flexibility. The program
for the machine is built into the machine permanently. Some areas of usage include air
traffic control system; military weapons control system, ship navigation system and
industrial process controls.
2. General Purpose Computer: These computers have the ability to handle a wide variety
of programs and to solve many problems such as payroll, numerical analysis, software
development for accounting, inventory system etc. It makes use of stored program for
switching from one application to another.

1.3 Advantages of Computer


i. The fast way by which computer processes data cannot be compared with the manual
ways of achieving the same result.
ii. The volume of information that can be processed is significantly increased. Computer is
always employed to ease the pressure of work to be processed.
iii. The accuracy of information cannot be doubted.
iv. Quick access to information. The ability to link a number of computer users via a network
improves the distribution and dissemination of information within and outside a particular
environment. Hence, access to information is highly improved both within and outside the
primary organization level.
6
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

v. Reduction in manpower needs at organizational level. This reduces the level of human
errors and the overhead cost that can be incurred in data processing.
vi. Vast data storage capacity coupled with ease of retrieval and modification. Computer
allows for more data storage facilities than any manual method of data processing can provide.
vii. Computer provides high integrity/reliability and security for data and information.

1.4 Disadvantages of Computer


i. Computer Error. This is a type of error due to machine fault, execution error (the process
logic that is faulty) or wrong data usage. Hence, the output produced from the system is
invalid. This type of error may not be easily detected until a later date.
ii. It required people being trained and retrained on their job.
iii. Computer usage sometimes creates partial unemployment. This is because some people
will be relieved of their jobs.
iv. Though computerization is good, but the cost of achieving partial or total
computerization is enormous in a short term. On the long run, the money spent on such
computerization is not a waste.
v. Fraud.

1.5 THE HISTORY OF COMPUTER


In the early days of man, fingers and toes were used for counting. Later on, sticks and
pebbles were used. Permanent records of the result of counting were kept by putting marks on the
ground, wall and so on using charcoal, chalk and plant juice.
The historical development of computing focuses on the digital computer from the Abacus to the
modern electronic computer. It is not possible neither is it necessary to name all the people who
have contributed to the development of computing all over the world. However, some of these
people whose contributions have been widely acknowledged will be discussed:

1.5.1 THE ABACUS


The abacus was invented to replace the old methods of counting. It is an instrument known
to have been used for counting as far back as 500 B.C. in Europe, China, Japan and India and it is
still being used in some parts of China today.
7
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The abacus qualifies as a digital instrument because it uses beads as counter to calculate in discrete
form. It is made of a board that consists of beads that slide on wires. The abacus is divided by a
wooden bar or rod into two zones. Perpendiculars to this rod are wires arranged in parallel, each
one representing a positional value. Each zone is divided into two levels - upper and lower. Two
beads are arranged on each wire in the upper zone, while five beads are arranged on each wire in
the lower zone.
The abacus can be used to perform arithmetic operations such as addition and subtraction
efficiently.

A more modern abacus.


Note that the abacus is really just a representation of the human fingers: the 5 lower rings
on each rod represent the 5 fingers and the 2 upper rings represent the 2 hands.

1.5.2 BLAISE PASCAL


Pascal was born at Clermont, France in 1623 and died in Paris in 1662. Pascal was a Scientist as
well as a Philosopher. He started to build his mechanical machine in 1640 to aid his father in
calculating taxes. He completed the first model of his machine in 1642 and it was presented to the
public in 1645.
The machine, called Pascal machine or Pascaline, was a small box with eight dials that resembled
the analog telephone dials. Each dial is linked to rotating wheel that displayed the digits in a
register window. Pascal’s main innovative idea was the linkage provided for the wheels such that
an arrangement was made for a carry from one wheel to its left neigbour when the wheel passed
from a display of 9 to 0. The machine could add and subtract directly.
Pascal's Pascaline [photo © 2002 IEEE]

8
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

A Pascaline opened up so you can observe the gears and cylinders which rotated to display
the numerical result

1.5.3 JOSEPH MARIE JACQUARD


In 1801 the Frenchman Joseph Marie Jacquard invented a power loom that could base its weave
(and hence the design on the fabric) upon a pattern automatically read from punched wooden cards,
held together in a long row by rope. Descendents of these punched cards have been in use ever
since.

Jacquard's Loom showing the threads and the punched cards

By selecting particular cards for Jacquard's loom you defined the woven pattern [photo ©
2002 IEEE]
9
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1.5.4 CHARLES BABBAGE


Charles Babbage was born in Totnes, Devonshire on December 26, 1792 and died in London on
October 18, 1871. He was educated at Cambridge University where he studied Mathematics. In
1828, he was appointed Lucasian Professor at Cambridge. Charles Babbage started work on his
analytic engine when he was a student. His objective was to build a program-controlled,
mechanical, digital computer incorporating a complete arithmetic unit, store, punched card input
and a printing mechanism.
The program was to be provided by the set of Jacquard cards. However, Babbage was unable to
complete the implementation of his machine because the technology available at his time was not
adequate to see him through. Moreover, he did not plan to use electricity in his design. It is
noteworthy that Babbage’s design features are very close to the design of the modern computer.
Babbage invented the modern postal system, cowcatchers on trains, and the ophthalmoscope,
which is still used today to treat the eye.

A small section of the type of mechanism employed in Babbage's Difference Engine [photo
© 2002 IEEE]
1.5.5 AUGUSTA ADA BYRON
Ada Byron was the daughter of the famous poet Lord Byron and a friend of Charles
Babbage, (Ada later become the Countess Lady Lovelace by marriage). Though she was only 19,
she was fascinated by Babbage's ideas and through letters and meetings with Babbage she learned
enough about the design of the Analytic Engine to begin fashioning programs for the still unbuilt
machine. While Babbage refused to publish his knowledge for another 30 years, Ada wrote a series
of "Notes" wherein she detailed sequences of instructions she had prepared for the Analytic

10
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Engine. The Analytic Engine remained unbuilt but Ada earned her spot in history as the first
computer programmer. Ada invented the subroutine and was the first to recognize the importance
of looping.

1.5.6 HERMAN HOLLERITH


Hollerith was born at Buffalo, New York in 1860 and died at Washington in 1929. Hollerith
founded a company which merged with two other companies to form the Computing Tabulating
Recording Company which in 1924 changed its name to International Business Machine (IBM)
Corporation, a leading company in the manufacturing and sales of computer today.
Hollerith, while working at the Census Department in the United States of America became
convinced that a machine based on cards can assist in the purely mechanical work of tabulating
population and similar statistics was feasible. He left the Census in 1882 to start work on the
Punch Card Machine which is also called Hollerith desks.
This machine system consisted of a punch, a tabulator with a large number of clock-like counters
and a simple electrically activated sorting box for classifying data in accordance with values
punched on the card. The principle he used was simply to represent logical and numerical data in
the form of holes on cards.
His system was installed in 1889 in the United States Army to handle Army Medical statistics. He
was asked to install his machine to process the 1890 Census in USA. This he did and in two years,
the processing of the census data was completed which used to take ten years. Hollerith’s machine
was used in their countries such as Austria, Canada, Italy, Norway and Russia.

Hollerith desks [photo courtesy The Computer Museum]

Two types of computer punch cards

11
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1.5.7 JOHN VON NEUMANN


Von Neumann was born on December 28, 1903 in Budapest, Hungary and died in Washington D.
C. on February 8, 1957. He was a great mathematician with significant contribution to the theory
of games and strategy, set theory and the design of high speed computing machines. In 1933, he
was appointed one of the first six professors of the school of mathematics in the institute for
Advanced Study at the Princeton University, USA, a position he retained until his death.
Neumann with some other people presented a paper titled “The Preliminary discussion of the
Logical Design of an Electronic Computing Instrument” popularly known as Von Neumann
machine. This paper contains revolutionary ideas on which the present day computers are based.
The machine has Storage, Control, Arithmetic and input/output units. The machine was to be a
general purpose computing machine. It was to be an electronic machine and introduced the
concept of stored program. This concept implied that the operations in the computer were to be
controlled by a program stored in the memory of the computer. This program was to consist of
codes that intermixed data with instructions.
As a result of this, it became possible for computations to proceed at electronic speed, perform the
same set of operations or instructions repeatedly and the concept of program counter, which
implied that whenever an instruction is fetched, the program counter which is a high-speed register
automatically contains the address of the instruction to be executed next.

1.5.8 J. V. ATANASOFF
One of the earliest attempts to build an all-electronic (that is, no gears, cams, belts, shafts, etc.)
digital computer occurred in 1937 by J. V. Atanasoff, a professor of physics and mathematics at
12
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Iowa State University. By 1941 he and his graduate student, Clifford Berry, had succeeded in
building a machine that could solve 29 simultaneous equations with 29 unknowns. This machine
was the first to store data as a charge on a capacitor, which is how today computers stored
information is in their main memory. It was also the first to employ binary arithmetic. However,
the machine was not programmable, it lacked a conditional branch, its design was appropriate for
only one type of mathematical problem, and it was not further pursued after World War II.

The Atanasoff-Berry Computer [photo © 2002 IEEE]

1.5.9 HOWARD AIKEN


Howard Aiken of Harvard was the principal designer of the Mark I. The Harvard Mark I computer
was built as a partnership between Harvard and IBM in 1944. This was the first programmable
digital computer made in the U.S. But it was not a purely electronic computer. Instead the Mark I
was constructed out of switches, relays, rotating shafts, and clutches. The machine weighed 5 tons,
incorporated 500 miles of wire, was 8 feet tall and 51 feet long, and had a 50ft rotating shaft
running its length, turned by a 5 horsepower electric motor. The Mark I ran non-stop for 15 years.

The Harvard Mark I: an electro-mechanical computer

13
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

One of the four paper tape readers on the Harvard Mark I

1.5.10 GRACE HOPPER


Grace Hopper was one of the primary programmers for the Mark I. Hopper found the first
computer "bug": a dead moth that had gotten into the Mark I and whose wings were blocking the
reading of the holes in the paper tape. The word "bug" had been used to describe a defect since at
least 1889 but Hopper is credited with coining the word "debugging" to describe the work to
eliminate program faults.

The first computer bug [photo © 2002 IEEE]

In 1953 Grace Hopper invented the first high-level language, "Flow-matic". This language
eventually became COBOL which was the language most affected by the infamous Y2K problem.
A high-level language is designed to be more understandable by humans than is the binary
language understood by the computing machinery. A high-level language is worthless without a
program -- known as a compiler -- to translate it into the binary language of the computer and
14
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

hence Grace Hopper also constructed the world's first compiler. Grace remained active as a Rear
Admiral in the Navy Reserves until she was 79.

1.5.11 BILL GATES


William (Bill) H. Gates was born on October 28, 1955 in Seattle, Washington, USA. Bill Gates
decided to drop out of college so he could concentrate all his time writing programs for Intel 8080
categories of Personal Computers (PC). This early experience put Bill Gates in the right place at
the right time once IBM decided to standardize on the Intel microprocessors for their line of PCs
in 1981. Gates founded a company called Microsoft Corporation (together with Paul G. Allen) and
released its first operating system called MS-DOS 1.0 in August, 1981 and the last of its group in
(MS-DOS 6.22) April, 1994. Bill Gates announces Microsoft Windows in November 10, 1983.
Microsoft’s latest Operating System is Windows 7 was released in October 22, 2009. Microsoft is
the largest software manufacturing company in the world.

1.5.12 PHILIP EMEAGWALI


Philip Emeagwali was born in 1954, in the Easter part of Nigeria. He had to leave school because
his parents couldn't pay the fees and he lived in a refugee camp during the civil war. He won a
scholarship to university. He later migrated to the United States of America. In 1989, he invented
the formula that used 65,000 separate computer processors to perform 3.1 billion calculations per
second.
Philip Emeagwali, a supercomputer and Internet pioneer is regarded as one of the fathers of the
internet because he invented an international network which is similar to, but predates that of the
Internet. He also discovered mathematical equations that enable the petroleum industry to recover
more oil. Emeagwali won the 1989 Gordon Bell Prize, computation's Nobel prize, for inventing a
formula that lets computers perform the fastest computations, a work that led to the reinvention of
supercomputers.

15
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

MODULE 2
COMPONENTS OF A COMPUTER SYSTEM

2.0 COMPONENTS OF A COMPUTER SYSTEM


A computer system can be divided into hardware, software and human-ware

2.1 THE HARDWARE

The hardware refers to the physical components and the devices which make up the visible
computer. It can be divided into two: Central Processing Unit (CPU) and the Peripherals. The
CPU is responsible for all processing that the computer does while the peripherals are responsible
for feeding data into the system and for collecting information from the system.
The CPU consists of Main storage, ALU and Control Unit. The main storage is used
for storing data to be processed as well as the instructions for processing them. The ALU is the
unit for arithmetic and logical operations. The control unit ensures the smooth operation of the
other hardware units. It fetches instruction, decode (interprets) the instruction and issues
commands to the units responsible for executing the instructions.
The peripherals are in three categories: Input devices, Output devices and auxiliary storage
devices.
The input device is used for supplying data and instructions to the computer. Examples
are terminal Keyboard, Mouse, Joystick, Microphone, Scanner, Webcam, and so on.
Output device is used for obtaining result (information) from the computer. Examples are
Printers, Video Display Unit (VDU), loudspeaker, projector, and so on.
Auxiliary Storage Devices are used for storing information on a long-term basis. Examples are
hard disk, flash disk, magnetic tape, memory card, and soon on.

16
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

A simple model of the hardware part of a computer system is shown below

Peripherals

Input
Unit Auxiliary Output
Storage Unit
Unit

Main Memory

Central
Processing Arithmetic
Unit and Logic
Unit

Control Unit

Data Flow Signals/Commands

2.2 THE SOFTWARE


Software are basically referred to as programs. A program consists of sequence of instructions
required to accomplish a well-defined tasks. Examples of such tasks include:
1. Finding the average score of a student
2. Computing the net pay of an employee
3. Solving a set of simultaneous linear equations

It is the software that enables the hardware to be put into effective use. There are two main
categories of software – System software and Application software.

17
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

2.3 SYSTEMS SOFTWARE


System software are programs commonly written by computer manufacturers, which have direct
effect on the control, performance and ease of usage of the computer system. Examples are
Operating System, Language Translators, Utilities and Service Programs, and Database
Management Systems (DBMS).

Operating System is a collection of program modules which form an interface between the
computer hardware and the computer user. Its main function is to ensure a judicious and efficient
utilization of all the system resources (such as the processor, memory, peripherals and other system
data) as well as to provide programming convenience for the user. Examples are Unix, Linux,
Windows, Macintosh, and Disk Operating system.

Language Translators are programs which translate programs written in non-machine languages
such as FORTRAN, C, Pascal, and BASIC into the machine language equivalent. Example of
language translators are assemblers, interpreters, compilers and preprocessor.
 Assemblers: This is a program that converts program written in assembly language (low
level language) into machine language equivalent.

 Interpreter: This is a program that converts program written in high level language (HLL)
into its machine language (ML) equivalent one line at a time. Language like BASIC is
normally interpreted.

 Compiler: This is a program that translates program written in high level language (HLL)
into machine language (ML) equivalent all at once. Compilers are normally called by the
names of the high level language they translate. For instance, we have COBOL compiler,
FORTRAN compiler etc.

 Preprocessor: This is a language translator that takes a program in one HLL and produces
equivalent program in another HLL. For example, there are many preprocessors to map
structured version of FORTRAN into conventional FORTRAN.

18
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Database Management System (DBMS) is a complex program that is used for creation, storage,
retrieving, securing and maintenance of a database. A database can be described as an organized
collection of related data relevant to the operations of a particular organization. The data are stored
usually in a central location and can be accessed by different authorized users.

Linker is a program that takes several object files and libraries as input and produces one
executable object file.
Loader is a program that places an executable object file into memory and makes them ready for
execution. Both linker and loader are provided by the operating system.

Utility and Service Programs


These are programs which provide facilities for performing common computing tasks of a routine
nature. The following are some of the examples of commonly used utility programs:
 Sort Utility: This is used for arranging records of a file in a specified sequence –
alphabetic, numerical or chronological of a particular data item within the records. The
data item is referred to as the sort key.
 Merge Utility: This is used to combine two or more already ordered files together to
produce a single file.
 Copy Utility: This is used mainly for transferring data from one storage medium to the
other, for example from disk to tape.
 Debugging Facilities: These are used for detecting and correcting errors in program.
 Text Editors: These provide facilities for creation and amendment of program from the
terminal.
 Benchmark Program: This is a standardized collection of programs that are used to
evaluate hardware and software. For example, a benchmark might be used to compare the
performance of two different computers on identical tasks, assess the comparative
performance of two operating systems etc.
2.4 APPLICATION SOFTWARE
These are programs written by a user to solve his/her own application problem. They do not have
any effect on the efficiency of the computer system. An example is a program to calculate the

19
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

grade point average of all the 100L students. Application software can be divided into two namely:
Application Package and User’s Application Program. When application programs are written
in a very generalized and standardized nature such that they can be adopted by a number of
different organizations or persons to solve similar problem, they are called Application Packages.
There are a number of micro-computer based packages. These include word processors (such as
Ms-word, WordPerfect, WordStar); Database packages (such as Oracle, Ms-access, Sybase, SQL
Server, and Informix); Spreadsheet packages (such as Lotus 1-2-3 and Ms-Excel); Graphic
packages (such as CorelDraw, Fireworks, Photoshop etc), and Statistical packages (such as SPSS).
User’s Application Program is a program written by the user to solve specific problem which is
not generalized in nature. Examples include writing a program to find the roots of quadratic
equation, payroll application program, and program to compute students’ results.

2.5 THE HUMANWARE


Although, the computer system is automatic in the sense that once initiated, it can, without
human intervention, continue to work on its own under the control of stored sequence of
instructions (program), however, it is not automatic in the sense that it has to be initiated by a
human being, and the instructions specifying the operations to be carried out on the input data are
given by human being. Therefore, apart from the hardware and software, the third element that
can be identified in a computer system is the humanware. This term refers to the people that work
with the computer system. The components of the humanware in a computer system include the
system analyst, the programmer, data entry operator, end users etc.

2.6 ORGANIZATIONAL STRUCTURE OF A TYPICAL COMPUTER


INSTALLATION

The following diagram shows the organizational structure of a typical computer installation

DPM

System Development Operations Team

System Analysts Programmers 20 Operators Control Clerks

Data Entry Operator


AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Organizational Structure of a typical computer installation

Data Processing Manager (DPM) supervises every other persons that work with him and is
answerable directly to the management of the organization in which he works.

A System Analyst is a person that understudies an existing system in operation in order to


ascertain whether or not computerization of the system is necessary and/or cost-effective. When
found necessary, he designs a computerized procedure and specifies the functions of the various
programs needed to implement the system.

A Programmer is the person that writes the sequence of instructions to be carried out by the
computer in order to accomplish a well-defined task. The instructions are given in computer
programming languages.

A data entry operator is the person that enters data into the system via keyboard or any input
device attached to a terminal. There are other ancillary staffs that perform other functions such as
controlling access to the computer room, controlling the flow of jobs in and out of the computer
room.

An end-user is one for whom a computerized system is being implemented. The end-user interacts
with the computerized system in their day-to-day operations of the organization. For example a
cashier in the bank who receives cash from customers or pay money to customers interacts with
the banking information system.

21
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

MODULE 3
NUMBER BASES AND COMPUTER ARITHMETIC
3.0 NUMBER BASE ARITHMETIC
Numbers in the decimal system are represented by means of positional notation. That is,
the value or weight of a digit depends on its location within the number. A number N,
when expressed in positional notation in the base b, is written as:
anan-1an-2 … a1a0.a-1a-2 … a-m
and defined as
anbn + an-1bn-1 + … + a1b1 + a0b0 + a-1b-1 + a-2b-2 + … + a-mb-m

The “a” in the above equation are called digits and may have one of “b” possible values.
Positional notation employs the radix point to separate the integer and fractional parts of
the number. Decimal arithmetic uses the decimal point while binary arithmetic uses binary
point.
We shall be considering four bases – decimal, binary, octal, and hexadecimal

Decimal: base, b = 10, digits, a = {0,1,2,3,4,5,6,7,8,9}


Binary: base, b = 2 digits, a ={0,1}
Octal: base, b = 8 digits, a = {0,1,2,3,4,5,6,7}
Hexadecimal: base, b = 16 digits, a = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}

Subscript is used to indicate the base of a number when necessary, for example, 123 10,
4568, 10112.

People normally work in decimal and computers in binary. The purpose of the octal and
hexadecimal systems is as an aid to human memory since they are shorter than binary
22
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

digits. Moreover, octal and hexadecimal numbers are more compact than binary numbers
(one octal digit equals three binary digits and one hexadecimal digit equals four binary
digits), they are used in computer texts and core-dumps (printout of part of the computer’s
memory). The advantage of binary number is in decoding electrical signals that switch on
(logical one), or switch off (logical zero) a device.

a. CONVERSION OF INTEGERS FROM DECIMAL TO BINARY


To convert a decimal integer to binary, divide the number successively by 2, and after each
division record the remainder which is either 1 or 0. The process is terminated only when
the result of the division is 0 remainder 1. The result is read from the most significant bit
(the last remainder) upwards.

For example: to convert 12310 to binary, we have


Numerator Divisor Quotient Remainder
123 2 61 1
61 2 30 1
30 2 15 0
15 2 7 1
7 2 3 1
3 2 1 1
1 2 0 1
Consequently, 12310 = 11110112

b. CONVERSION OF INTEGERS FROM DECIMAL TO OCTAL


Just as in binary above except that the divisor is 8. The process of conversion ends when
the final result is 0 remainder R (where 0 ≤ R < 8).

For example: to convert 462910 to octal, we have

Numerator Divisor Quotient Remainder


4629 8 578 5
578 8 72 2
72 8 9 0
9 8 1 1
1 8 0 1
23
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Therefore, 462910 = 110258

c. CONVERSION OF INTEGERS FROM DECIMAL TO HEXADECIMAL


Just as in binary and octal. The divisor is 16. The remainder lies in the decimal range 0 to
15, corresponding to the hexadecimal range 0 to F.
For example: to convert 5324110 to hexadecimal, we have

Numerator Divisor Quotient Remainder


53241 16 3327 9
3327 16 207 15 = F
207 16 12 15 = F
12 16 0 12 = C
Therefore, 5324110 = CFF916

d. CONVERSION OF INTEGERS FROM OTHER BASES TO DECIMAL


Just express in the positional notation earlier stated above. But take note of the base.
For example, to convert 10101112, 64378, and 1AC16 to decimal
i.
10101112 = 1 × 26 + 0 × 25 + 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 1 × 20
= 1 × 64 + 0 × 32 + 1 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 1 × 1
= 64 + 0 + 16 + 0 + 4 + 2 + 1
= 8710
ii.
64378 = 6 × 8 3 + 4 × 8 2 + 3 × 81 + 7 × 8 0
= 6 × 512 + 4 × 64 + 3 × 8 + 7 × 1
= 3072 + 256 + 24 + 7
= 335910

iii. 1AC16 = 1 × 162 + 10 × 161 + 12 × 160


= 1 × 256 + 10 × 16 + 12 × 1
= 256 + 160 +12
= 42810

e. CONVERSION FROM BINARY INTEGER TO OCTAL


Form the bits into groups of three starting at the binary point and moving leftwards.
Replace each group of three bits with the corresponding octal digits (0 to 7).
For example, to convert 110010111012 to Octal
110010111012 = 11 001 011 101

24
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

11 = 1 × 21 + 1 × 20 = 3; 001 = 0 × 22 + 0 × 21 + 1 × 20 = 1; 011 =0 × 22 + 1 × 21 + 1 ×
20 = 3; 101 = 1 × 22 + 0 × 21 + 1 × 20 = 5
Therefore 110010111012 = 31358

f. CONVERSION FROM BINARY INTEGER TO HEXADECIMAL


The binary number is formed into groups of four bits starting at the binary point. Each
group is replaced by a hexadecimal digit from 0 to 9, A, B, C, D, E, F.
For example, to convert 110010111012 to hexadecimal
110010111012 = 110 0101 1101
110 = 1 × 22 + 1 × 21 + 0 × 20 = 6; 0101 = 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 5;
1101 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 13 = D
Therefore 110010111012 = 65D16

g. CONVERSION FROM OCTAL TO BINARY


Converting an octal number into its binary equivalent requires the reverse procedure of
converting from binary to octal. Each octal digit is simply replaced by its binary
equivalent.
For example, to convert 413578 to binary
413578 : converting each digit into binary, we have
4 = 100 1 = 001 3 = 011 5 = 101 7 = 111
Replacing each octal digit by its binary equivalent:
413578 = 100 001 011 101 111 = 1000010111011112

h. CONVERSION FROM HEXADECIMAL TO BINARY


Each hexadecimal digit is replaced by its 4-bit binary equivalent. For example, to convert
AB4C16 to binary
AB4C16: A = 10 =1010 B = 11 = 1011 4 = 0100 C = 12 =
1100
AB4C16 = 1010 1011 0100 1100 = 1010101101001100

i. CONVERSION FROM HEXADECIMAL TO OCTAL


25
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Conversion between hexadecimal and octal values is best performed via binary. For
example, to convert 12BC16 to octal
12BC16 = 1 0010 1011 1100
Regrouping into three bits from the right-hand side
12BC16 = 1 001 010 111 100
Converting each group into octal digit
12BC16 = 112748
j. CONVERSION FROM OCTAL TO HEXADECIMAL
For example, to convert 413578 to hexadecimal
413578 = 4 =100 1 = 001 3 = 011 5 = 101 7 = 111
Regrouping into four bits
413578 = 100 0010 1110 1111
= 4 2 14 15
= 42EF16

k. CONVERSION OF BINARY FRACTIONS TO DECIMAL


Treat all fractions as integers scaled by an appropriate factor. For example, to convert
0.011012
By expressing in standard form, we have
0.011012 = 0 × 2-1 + 1 × 2-2 + 1 × 2-3 + 0 × 2-4 + 1 × 2-5
= 0 × + 1 × 1/ 22 + 1 ×1/ 23 + 0 × 1/24 + 1 × 1/25
=0 × +1× +1× +0× +1×
=0+ + +0+ = + + = = =0.40625
0.011012 = 0.4062510

l. CONVERSION OF DECIMAL FRACTIONS TO BINARY


To convert a decimal fraction to binary fraction, the decimal fraction is multiplied by two
(2) and the integer part noted. The integer, which is either 1 or 0, is then stripped from the
number to leave a fractional part. The new fraction is multiplied by two (2) and the integer
part noted. The process is carried out repeatedly until it ends or a sufficient degree of
26
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

precision has been achieved. The binary fraction is formed by reading the integer parts
from the top to the bottom.
For example, to convert 0.687510 to binary

0.6875 × 2 = 1.3750
0.3750 × 2 = 0.7500
0.7500 × 2 = 1.5000
0.5000 × 2 = 1.0000

0.687510 = 0.10112

We can convert from decimal fractions to octal or hexadecimal fractions by using the same
algorithms used for binary conversions. We only need to change the base (that is: 2, 8, 16).

m. CONVERSION OF BINARY FRACTIONS TO OCTAL/HEXADECIMAL


Split the binary digits into groups of three (four for hexadecimal), start grouping bits at the
binary point and move to the right. Any group of digits remaining on the right containing
fewer than three (four for hexadecimal) bit must be made up to three (four for hexadecimal)
bit by the addition of zeros to the right of the least significant bit.
For example, to convert 0.101011002 and 0.101011112 to octal
0.101011002 = 0. 101 011 00(0)2 = 0.5308
0.101011112 = 0. 101 011 11(0)2 = 0.5368
To convert to hexadecimal
0.101011002 = 0. 1010 1100 = 0.AC16
0.1010110012 = 0. 1010 1100 1(000) =0.AC816
n. CONVERSION OF OCTAL/HEXADECIMAL FRACTIONS TO BINARY
0.4568 = 0. 100 101 110 = 0.1001011102
0.ABC16 = 0. 1010 1011 1100 = 0.1010101111002

27
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

MODULE 4
LOGIC AND BOOLEAN ALGEGBRA
4.0 LOGIC

Logic can be viewed as black boxes with binary input (independent variable) and binary output
(dependent variable). It also refers to both the study of modes of reasoning and the use of valid
reasoning. In the latter sense, logic is used in most intellectual activities. Logic in computer science
has emerged as a discipline and it has been extensively applied in the fields of Artificial Intelligence,
and Computer Science, and these fields provide a rich source of problems in formal and informal
logic.

Boolean logic, which has been considered as a fundamental part to computer hardware, particularly,
the system's arithmetic and logic structures, relating to operators AND, NOT, and OR.
Logic gates
A logic gate is an elementary building block of a digital circuit. Complex electronic circuits are built
using the basic logic gates. At any given moment, every terminal of the logic gate is in one of the
two binary conditions low (0) or high (1), represented by different voltage levels.

There are 3 basic logic gates: AND, OR, NOT.

Other gates- NAND, NOR, XOR and XNOR are based on the 3 basic gates.

The AND gate

The AND gate is so called because, if 0 is called "false" and 1 is called "true," the gate acts in the
same way as the logical "and" operator. The following illustration and table show the circuit symbol
and logic combinations for an AND gate.

The output is "true" when both inputs are "true." Otherwise, the output is "false."

28
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The OR gate

The OR gate gets its name from the fact that it behaves after the fashion of the logical "or." The
output is "true" if either or both of the inputs are "true." If both inputs are "false," then the output is
"false."

The NOT gate

A logical inverter, sometimes called a NOT gate to differentiate it from other types of electronic
inverter devices, has only one input. It reverses the logic state (i.e. its input).
29
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

As previously considered, the AND, OR and NOT gates’ actions correspond with the AND, OR and
NOT operators.

Any more complex functionality can be constructed from the three basic gates by using
DeMorgan’s Law:

The NAND gate

The NAND gate operates as an AND gate followed by a NOT gate. It acts in the manner of the
logical operation "and" followed by negation. The output is "false" if both inputs are "true."
Otherwise, the output is "true". It finds the AND of two values and then finds the opposite of the
resulting value.

30
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The NOR gate

The NOR gate is a combination of an OR gate followed by an inverter. Its output is "true" if both
inputs are "false." Otherwise, the output is "false". It finds the OR of two values and then finds the
complement of the resulting value.

The XOR gate

The XOR (exclusive-OR) gate acts in the same way as the logical "either/or." The output is "true" if
either, but not both, of the inputs are "true." The output is "false" if both inputs are "false" or if both
31
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

inputs are "true." Another way of looking at this circuit is to observe that the output is 1 if the inputs
are different, but 0 if the inputs are the same.

XOR gate

A B Z

0 0 0

0 1 1

1 0 1

1 1 0

The XNOR gate

The XNOR (exclusive-NOR) gate is a combination of an XOR gate followed by an inverter. Its
output is "true" if the inputs are the same, and"false" if the inputs are different. It performs the
operation of an XOR gate and then inverts the resulting value.

XNOR gate

A B Z

0 0 1

0 1 0

1 0 0

1 1 1

32
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

With the combinations of several logic gates, complex operations can be performed by electronic
devices. Arrays (arrangement) of logic gates are found in digital integrated circuits (ICs).

As IC technology advances, the required physical volume for each individual logic gate decreases
and digital devices of the same or smaller size become capable of performing much-more-
complicated operations at an increased speed.

Combination of gates

A goes into the NOT gate and is inverted, after inversion, it goes into the AND gate along with the
variables B and C. The final output at the output terminal of the AND gate is BC. More complex
circuitry can be developed using the symbolic representation in this same manner.

33
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

34
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Questions

1. Draw the physical representation of the AND, OR, NOT and XNOR logic gates.
2. Draw the logic circuit and truth table for Z= A.B.C, W= (P.Q) + (R+S)

BOOLEAN ALGEBRA

The knowledge of Boolean algebra serves two main purposes: firstly, to formally describe
and define the function of a logic circuit; and secondly, by simplifying the Boolean expression
defining a particular circuit, one can simplify or reduce the associated hardware, ie make more
efficient use of the available hardware resources. Boolean algebra is also referred to as Boolean
logic. It was developed by George Boole sometime on the 1840s and is greatly used in
computations and in computer operations. The name Boolean comes from the name of the
author.

Boolean algebra is a logical calculus of truth values. It somewhat resembles the arithmetic
algebra of real numbers but with a difference in its operators and operations. Boolean operations
involve the set {0,1}, that is, the numbers 0 and 1. Zero [0] represents “false” or “off” and One
[1] represents “true” or “on”.

1 – True, on
0 – False, off

This has proved useful in programming computer devices, in the selection of actions based on
conditions set.
35
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Basic Boolean operations

1. AND
The AND operator is represented by a period or dot in-between the two operands e.g
- X .Y

The Boolean multiplication operator is known as the AND function in the logic domain;
the function evaluates to 1 only if both the independent variables have the value 1.

2. OR
The OR operator is represented by an addition sign. Here the operation + is different from
that defined in normal arithmetic algebra of numbers. E.g. X+Y
The + operator is known as the OR function in the logic domain; the function has a value
of 1 if either or both of the independent variables has the value of 1.
3. NOT
The NOT operator is represented by X' or X̅.
This operator negates whatever value is contained in or assigned to X. It changes its value
to the opposite value. For instance, if the value contained in X is 1, X' gives 0 as the result
and if the value stored in X is 0, X' gives 1 as the result. In some texts, NOT may be
represented as !X but this is not a common way of representing it.

To better understand these operations, we present a truth table for the result of any of the
operations on any two variables.

Truth Tables

Truth tables are a means of representing the results of a logic function using a table. They
are constructed by defining all possible combinations of the inputs to a function in the Boolean
algebra, and then calculating the output for each combination in turn. The basic truth table shows
the various operators and the result of their operations involving two variables only. More
complex truth tables can be built from the knowledge of the foundational truth table. The
number of input combinations in a Boolean function is determined by the number of variables in
the function and this is computed using the formula .

Number of input combinations = . Where n is number of variable(s).

36
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

For instance, a function involving two variables has an input combination of =4. One involving
three variables has =8 input combinations.

AND OR
X Y X.Y X Y X+Y
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 0 1 1 1

The NOT operation is not a binary operator (that is, it requires only a single operand) but a
unary operator.

NOT

X X'
0 1
1 0

Example:
• Draw a truth table for A+BC.

A B C BC A+BC

0 0 0 0 0

0 0 1 0 0

0 1 0 0 0

0 1 1 1 1

1 0 0 0 1

1 0 1 0 1

37
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1 1 0 0 1

1 1 1 1 1

There are other Boolean operators which are the XOR and XNOR operators.

Based on Boolean definitions the following axiomatic relationships hold:

for a, b, c  B

A1 Closure (a) a  b  B (b) a.b  B

A2 Identity (a) a  0  a (b) a.1  a

A3 Commutation (a) a  b  b  a (b) a.b  b.a

A4 Distribution (a) a.(b  c)  (a.b)  (a.c) (b) a  (b.c)  (a  b).(a  c)

A5 Inverse (a) a  a  1 (b) a.a  0

To check that the axioms do indeed accord with the definitions, Properties A1 are immediately
obvious while the following truth tables verify A2:

A a+0 a a.1
0 0.1=0
0 0+0=0
1 1.1=1
1 1+0=1

A3 may also be verified by truth table:

A b a+b b+a a.b b.a


0 0 0+0=0 0+0=0 0.0=0 0.0=0
0 1 0+1=1 1+0=1 0.1=0 1.0=0
1 0 1+0=1 0+1=1 1.0=0 0.1=0
1 1 1+1=1 1+1=1 1.1=1 1.1=1
38
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

We next consider A4(a)

a b c b+c a.(b+c) a.b a.c (a.b)+(a.c)


0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1

Axiom A4(b) may be similarly verified and is left as an exercise.

Finally, the A5 relations are verified from

a a a+a a.a
0 1 1 0
1 0 1 0

An important feature of Boolean algebra is duality. The set of (b) axioms are said to be duals of
the (a) axioms, and vice versa, in that a (b) axiom can be formed from its (a) counterpart by
exchanging operators and identity elements:

  . and 1  0

Thus for every theorem derived from one particular set of axioms, one can construct a dual
theorem based on the corresponding set of dual axioms.

Precedence

Just as order of precedence exists on other areas of mathematical operations, order of


precedence also exists in Boolean algebra and this should be followed in Boolean computations.
These operators defined above have an order precedence of operation as defined here:

NOT operations have the highest precedence, followed by AND operations, followed by OR
operations.

39
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Also, brackets can be used. For example, X.(Y + Z), X+(Y+Z), X.Y+(X+Y)

X.Y + Z and X.(Y + Z) are not the same function.

The brackets should be evaluated first to reduce the complexity of the Boolean operation.

These Boolean operations are foundational tools used in building computers and electronic
devices.

Consider this practical application of a Boolean operation:

“I will take an umbrella with me if it is raining or the weather forecast is bad”.

This statement functionally has two propositions which are:

a. It is raining; and
b. The weather forecast is bad.
Let “It is raining” be variable X , “The weather forecast is bad” be Y and the result (taking an
umbrella) be Z.

We can generate truth values in a truth table from this problem statement.

From the statement, if either of the conditions is true, an umbrella would be taken.

In functional terms we can be consider the truth value of the umbrella proposition as the
output or result of the truth values of the other two.

X (Raining) Y (Bad weather) Z(Take umbrella)


False False False
False True True
True False True
True True True

Another practical application of Boolean logic is this:

“I will sweep the class only if the windows are opened and the class is empty”.

From this statement, we can get two propositions which are “Windows opened” and “Class
empty”. These two propositions are the variables X and Y respectively.

40
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

“Windows opened” – X

“Class empty” – Y

X (Windows opened) Y (Class empty) Z (Sweep)


False false False
False true False
True false False
True true True

Fundamental importance of Boolean algebra

1. Boolean logic forms the basis for computation in modern binary computer systems.
2. They are used in the development of software, in selective control structures (if and
if...else statements).
3. They are used in the building electronic circuits. For any Boolean function you can
design an electronic circuit and vice versa.
4. A computer’s CPU is built up from various combinatorial circuits. A combinatorial circuit
is a system containing basic Boolean operations (AND, OR, NOT), some inputs, and a set
of outputs.

We consider the Boolean function in two variables A and B.

Z = f(A,B) = B+A

A B B A B+A
0 0 1 1 0 0 0
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 1 0 0 0 0 0

Another example involving three variables A, B and C

J= f(A,B,C) = A +

A B C A A +
0 0 0 1 1 1 0 1 1
0 0 1 1 1 0 0 0 0

41
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

0 1 0 1 0 1 0 0 0
0 1 1 1 0 0 0 0 0
1 0 0 0 1 1 1 0 1
1 0 1 0 1 0 0 0 0
1 1 0 0 0 1 0 0 0
1 1 1 0 0 0 0 0 0

Much more complex Boolean functions can be further developed. We can have functions
having four variables as well. This same principle is used in the development of circuitry for
computer functions and operations.

Question

1. Solve the following Boolean functions

a. J= f(A,B,C) = B + B + BC + A b. Z = f(A,B,C) = B + B + BC + A

More examples of Truth Table

42
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

• Draw a truth table for A(B+D).

A B D B+D A(B+D)

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 1 0

1 0 0 0 0

1 0 1 1 1

1 1 0 1 1

1 1 1 1 1

• Draw a truth table for (A+B)(A+C).

A B C A+B A+C (A+B)(A+C)

0 0 0 0 0 0

0 0 1 0 1 0

0 1 0 1 0 0

0 1 1 1 1 1

1 0 0 1 1 1

1 0 1 1 1 1

1 1 0 1 1 1

1 1 1 1 1 1

43
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

• Draw a truth table for W(X+Y)Z.

W X Y Z W X+Y W(X+Y) W(X+Y)Z

0 0 0 0 1 0 0 0

0 0 0 1 1 0 0 0

0 0 1 0 1 1 0 0

0 0 1 1 1 1 0 0

0 1 0 0 1 1 0 0

0 1 0 1 1 1 0 0

0 1 1 0 1 1 0 0

0 1 1 1 1 1 0 0

1 0 0 0 0 0 0 0

1 0 0 1 0 0 0 0

1 0 1 0 0 1 1 0

1 0 1 1 0 1 1 1

1 1 0 0 0 1 1 0

1 1 0 1 0 1 1 1

1 1 1 0 0 1 1 0

1 1 1 1 0 1 1 1

44
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

MODULE 5
TRUTH TABLE AND KARNAUGH MAP
5.0 TRUTH TABLES

A truth table is a mathematical table used in logic—specifically in connection with Boolean


algebra, Boolean functions, and propositional calculus—to compute the functional values of
logical expressions on each of their functional arguments, that is, on each combination of values taken
by their logical variables. In particular, truth tables can be used to tell whether a propositional expression
is true for all legitimate input values, that is, logically valid.
Practically, a truth table is composed of one column for each input variable (for example, A and
B), and one final column for all of the possible results of the logical operation that the table is meant to
represent (e.g. X AND Y). Each row of the truth table therefore contains one possible configuration of
the input variables (for instance, X=true Y=false), and the result of the operation for those values.
Uses of the truth table

1. The truth table can be used in analyzing arguments.


2. It is used to reduce basic Boolean operations in computing.

It is used to test the validity of statements. In validating statements, the following three steps can be
followed:

1. Represent each premise (represented as inputs) with a symbol (a variable).


2. Represent the conclusion (represented as the final result) with a symbol (a variable).
3. Draw a truth table with columns for each premise (input) and a column for the conclusion
(result).

Reducing complex Boolean functions

Very complex Boolean functions may result and this can be simplified in two ways:

1. The Boolean algebra method


2. Karnaugh map

45
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Boolean algebra method

There are some basic rules of Boolean algebra. They are logical in nature. These rules should be
followed in simplifying any Boolean function.

1. A+0=A
2. A+1=1
3. A.0=0
4. A.1=A
5. A+A=A
6. A+ =1
7. A.A=A
8. A. =0
=
9. A=A
10. A+AB= A(1+B)=A(1)=A
11. A (B + C) = A B + A C
12. A + (B C) = (A + B) (A + C)

De-Morgan’s theorem

1. The complement of the OR of terms in a function is equivalent to the AND of the complement
of the individual terms in the function.

2. The complement of the AND of terms in a function is equivalent to the OR of the complement
of the individual terms in the function.

1. Using the above laws, simplify the following expression:


Q = (A + B)(A + C)
Solution
AA + AC + AB + BC (law 11)
A + AC + AB + BC (law 7)
A(1 + C) + AB + BC (law 10)- (1 + C = 1)
A.1 + AB + BC
46
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

A(1 + B) + BC (1 + B = 1)
A.1 + BC (A.1 = A)
Q =A + BC

So, the expression: (A + B)(A + C) can be simplified to A + BC

2. Another example can be considered:


Simplify Z=(A+ + )(A+ C)
Solution
Z=AA+A C+A + C+A + C
Z=A+A C+A +A + C +0
Z=A(1+ C+ + )+ C
Z=A(1+ (C+1)+ )+ C
Z=A(1+ + )+ C
Z=A(1)+ C
Z=A+ C

3. Another example is:


Using Boolean algebra techniques, simplify this expression:
AB + A(B + C) + B(B + C)

Solution
AB + AB + AC + BB + BC Expand the function
AB + AC + B + BC (AB + AB = AB) and (BB=B)
AB + AC + B (B + BC = B)
AB + B+AC
B+AC (AB + B = B)

The Karnaugh map


A Karnaugh map is a graphical method of Boolean logic expression reduction. A Boolean expression can
be reduced to its simplest form through some steps involved in Karnaugh mapping.

Questions
1. Simplify the following Boolean functions:
a. ABC + ABC + ABC + ABC + ABC
b. A + B+

47
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

At this point you have the capability to apply the theorems and laws of Boolean algebra to simplify logic
expressions to produce simpler Boolean functions. Simplifying a logic expression using Boolean algebra,
though not terribly complicated, is not always the most straightforward process. There isn’t always a
clear starting point for applying the various theorems and laws, nor is there a definitive end in the
process. The Karnaugh map is also known as Veitch diagram (KV-map or K-map for short). It is a tool to
facilitate the simplification of Boolean algebra integrated circuit expressions. The Karnaugh map reduces
the need for extensive calculations by taking advantage of human pattern-recognition.
The Karnaugh map was originally invented in 1952 by Edward W. Veitch. It was further developed in
1953 by Maurice Karnaugh, a physicist at Bell Labs, to help simplify digital electronic circuits. In a
Karnaugh map the Boolean variables are transferred (generally from a truth table) and ordered according
to the principles of Gray code in which only one variable changes in between squares. Once the table is
generated and the output possibilities are transcribed, the data is arranged into the largest even group
possible and the minterm is generated. The K-map is a more straight-forward process of reduction. In

the reduction process using a k-map, 0 represents the complement of the variable (e.g. B ) and 1
represents the variable itself (e.g. B).

Grouping in K-Map
The truth table for the Boolean function should be drawn with the result or output and the karnaugh
map drawn with the number of boxes being equal to the number of outputs =number of input
combinations=
Where n is the number of variables in the function.
In grouping in the K-map, we get the simplified sum-of-products logic expression.

The rules to be followed are:

1. Consider boxes with ones only. Boxes containing zeros would not be considered.
2. Group 1s in powers of 2. That is 2, 4, 8... ones.
3. Grouping can only be done side to side or top to bottom, not diagonally.
4. Using the same one in more than one group is permissible.
5. The target is to find the fewest number of groups.
6. The top row may wrap around to the bottom row to form a group.

48
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

0 1 1 0

1 0 0 1

1 0 0 1
0 1 1 0

Labelling a K-map

In labelling the karnaugh map, we make use of the principle of the “gray code”.

Labelling a 2-input k-map

A B 0 1

0 (00) B (01)
1 A (10) AB (11)

For the 2-input k-map, the values change from 0 to 1 along both axes.

Labelling a 3-input k-map

AB C 0 1

00 (000) C (001)
01 B (010) BC (011)

11 AB (110) ABC(111)

10 A (100) A C(101)

49
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

In the case of the 3-input k-map, we have A and B on one side if the map and C on the other side of the
map. Using gray code, we start with (00), keeping A constant and changing B, we have B (01).
Now, if we still keep A constant and change B, we will have (00) which already exists in the map,
so, the next thing to do is to keep B constant and then change A. With this, we will have AB (11) next
and then, A (10).

For minimization using the kmap, the value 0 in the truth table, corresponding to a variable is taken as
it’s complement. For instance, if the variable A has the value 0 in the truth table, it is taken as to fill
in the kmap.

50
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Consider the k-map:

0 1

1 0

The diagonal 1s cannot be grouped together.

B 1

1 1

A 1 0

There are two possible groupings here.

Example 1: Given Z=AB+A


A B AB A Z= AB+A

0 0 1 1 0 0 0

0 1 1 0 0 0 0

1 0 0 1 0 1 1

51
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1 1 0 0 1 0 1

B B

A 0 0

A 1 1

Since the variable B varies in value and A remains constant, the constant value across the group is A.

=A

Example 2

J= f(A,B,C) = A +

A B C A A +

0 0 0 1 1 1 0 1 1

0 0 1 1 1 0 0 0 0

0 1 0 1 0 1 0 0 0

0 1 1 1 0 0 0 0 0

1 0 0 0 1 1 1 0 1

1 0 1 0 1 0 0 0 0

52
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1 1 0 0 0 1 0 0 0

1 1 1 0 0 0 0 0 0

B B C BC B

A 0
1 0 0

A 0 0
1 0

From the diagram, the value of A changes across the group and the value of B remains the same.

=B

An advantage of the k-map over the Boolean algebra method of function reduction is that the k-map
has a definite process which is followed unlike the boolean algebra method which may not have a
particular starting and ending point.

Question

1. Reduce J= f(A,B,C) = B + B + BC + A using a k-map.

Consider the already filled k-map below,

CD

AB C̅D̅ C̅D CD CD̅

0 0 0 1

B 1 1 0 1

53
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

AB 1 1 0 1

A 0 0 0 1

1 2

The final answer here after the grouping is derived by looking across the group and eliminating the
variable that changes in value.

For group 1, looking horizontally, D changes in value while C has a constant value of . So, D is
eliminated and retained. Looking vertically, A changes across the group while B remains constant. So,
A is eliminated and B retained.

For the group1, the answer is the AND of the retained variables after elimination and this is B .

We do the same for group 2. Our answer there is CD̅ since vertically across the group, both and A and B
change values.

After doing this for all the groups in the kmap, we then OR the individual results of each group.

So, for this k-map, we have B + CD̅ as the minimum expression.

Examples

1. Consider a Boolean function represented by the truth table below

A B C F
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 0

54
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

AB C

1 1 Group 2

B 1 0

AB 0 0

A 0 1

Group1

For group 1, and for group 2, C. So, the final answer is + C

2. Consider the truth table given below and simplify the expression using k-map

A B C F
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0

55
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

1 1 1 0

AB C

1 1

B 0 0

AB 0 0

A 1 1

The 1s appear at the corners of the map and can be mapped together as though the map were bent.

The answer is therefore since it remains the same across the group.

MODULE 6
COMPUTER PROGRAMMING LANGUAGES
6.0 INTRODUCTION
A program is a list of instructions in a logical sequence which are needed to be performed
in order to accomplish a given task or solve a given problem on a computer. The process by which

56
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

a user specifies to the computer in a particular programming language what he wants the computer
to do is referred to as programming. Since the computer cannot think on its own, it is the
programmer that will give the detailed steps, as well as the sequence in which the steps are to be
taken, in solving the problem.
Programming Language
Programming Language is a set of specialized notation for communicating with the computer
system.
6.1 EVOLUTION OF PROGRAMMING LANGUAGES
Hundreds of programming languages have been developed in the last fifty years. Many of
them remained in the labs and the ones, which have good features, got recognition. Every language
that is introduced comes with features upon which its success is judged. In the initial years,
languages were developed for specific purposes, which limited their scope. However, as the
computer revolution spread affecting common man, the language needed to be moulded to suit all
kinds of applications. Every new language inherited certain features from existing languages and
added its own features. The chronology of developments in programming languages is given
below:-
 The first computer program was made by Lady Lovelace Ada Augusta in 1843 for an
analytical engine application.

 Konrad Zuse, a German, started a language design project in 1943. He finally developed
plankalkul, programming calculus, in 1945. The language supported bit, integer, floating-
point scalar data, arrays, and record data structures.

 In early 1950s, Grace Hopper and his team developed A-O Language. During this period,
assembly language was introduces.

 The major milestone was achieved when John Backus developed FORTRAN (Formula
Translator) in 1957. The FORTRAN data is oriented around numerical calculations. It
was a major step towards development of full-fledged programming language including
control structures, conditional loops, and input and output statements

 ALGOL was develop by GAMM (German Society of Applied mathematics) and ACM
(Association of Computing Machinery) in 1960
57
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

 COBOL (Common business oriented Languages) was developed for business purpose by
US department of defense in 1960.

 BASIC (beginner’s All- purpose symbolic instruction code) was developed by John
Kemeny and Thomas Kurtz in 1960’s

 PASCAL was developed by Niklaws around 1970’s. PASCAL was named after French
philosopher, Blaise pascal.

 In early 70’s Dennis Ritchie developed C at Bell laboratories using some of the B
languages. Features.

 C++ was developed by Bjarne Stroustrup in early 1980s extending features of C and
introducing object –oriented features

 Java, originally called Oaks, was developed by Sun Microsystems of USA in 1991 as
general purpose language. Java was designed for the development of software for
consumer electronic devices. It was a simple, reliable, portable and powerful language.
A language may be extremely useful for one type of applications. For example, a
language such as cobol, is useful for business application but not for embedded software.
On the basis of application, programming languages can be broadly classified as =
BUSINESS = COBOL
SCIENTIFY = FORTRAN
INTERNET = JAVA
SYSTEM = C, C++
Artificial intelligence (AI): LISP and PROLOG

6.2 FEATURES OF A GOOD PROGRAMMING LANGUAGE


The features of one programming language may differ from the other. One can be easier
and simple while others can be difficult and complex. The program written for a specific task may
have few lines in one language while many lines in the other. The success and strength of a
programming language is judge with respect to standard features. To begin the language selection
process, it is important to establish some criteria for what makes a language good. A good
language choice should provide a path into the future in a number of important ways.

58
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

(a) Ease of use: - this is the most important factor in choosing a language. The language should
be easy in writing codes for the programs and executing them. The ease and clarity of a language
depends upon its syntax. It should be capable enough to provide clear, simple, and unified set of
concepts. The vocabulary of the language should resemble English (or some other natural
language). Any concept that cannot easily be explained to amateurs should not be included in the
language. Part-time programmers do not want to struggle with difficult concepts, they just want
to get a job done quickly and easily.
(b) Portability: - the language should support the construction of code in a way that it could be
distributed across multiple platforms (operating systems). Computer languages should be
independent of any particular hardware or operating systems, that is, programs written on one
platform should be able to be tested or transferred to any other computer or platform and there it
should perform accurately.
(c) Reliability: - the language should support construction of components that can be expected to
perform their intended functions in a satisfactory manner throughout its lifetime. Reliability is
concerned with making a system failure free, and thus is concerned with all possible errors. The
language should have the support of error detection as well as prevention. It should make some
kinds of errors impossible for example, some errors can be prevented by a strict syntax checking.
Apart from prevention, the language should also be able to detect and report errors in the program.
For example errors such as arithmetic overflow and assertions should be detected properly and
reported to the programmers immediately so that the error can be rectified. The language should
provide reliability by supporting explicit mechanism for dealing with problems that are detected
when the system is in operation.
(d) Safety: - safety is concerned with the extent to which the language supports the construction
of safety critical systems, yielding systems that are fault tolerant, fail-safe or robust in the face of
systemic failures. The system must always do what is expected and be able to recover from any
situation that might lead to a mishap or actual system hazard. Thus, safety tries to ensure that any
failures that do occur result in minor consequences, and even potentially dangerous failures are

59
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

handled in a fail-safe fashion. Language can facilitate this through such features as built-in
consistency checking and exceptional handling.
(e) Performance: In some applications, performance is a big issue. By performance, we
mean that the language should not only be capable of interacting with the end users, but also with
the hardware. The language should also support software engineering mechanism, discouraging
or prohibiting poor practices and supporting maintenance activities. This is the main reason why
C language is used for developing operating systems.
(f) Cost: Cost component is a primary concern before deploying a language at a commercial
level. It includes several costs such as; program execution and translation cost, program creation,
testing and use, program maintenance
(g) Compact Code: A good language should also promote compact coding, that is, the
intended operations should be coded in a minimum number of lines. Even if the language is
powerful, and is not able to perform the task in small amount of codes, then it is bound to be
unpopular. This is the main reason of C language’s popularity over other languages in developing
complex applications. Larger codes require more testing and developing time, thereby increasing
the cost of developing an application.
(h) Maintainability: creating an application is not the end of the system development. It
should be maintained regularly so that it can be modified to satisfy new requirement or to correct
deficiencies. Maintainability is actually facilitated by most of the languages, which makes it easier
to understand and then change the software. Maintainability is closely linked with the structure of
the code. If the original code were written in an organized way (Structural Programming) then it
would be easy to modify or add new changes.
(i) Provides Interface to Other Language: - From the perspective of the language, interface to
other language refers to the extent to which the selected language supports interfacing feature to
other languages. This type of support can have a significant impact on the reliability of the data,
which is exchanged between applications, developed with different languages. In case of data
exchange between units of different languages, without specific language support, no checking
may be done on the data or even on their existence. Hence, the potential for unreliability becomes
60
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

high-modern day languages have come a long way and most of the languages provide interface
support for other languages.
(j) Concurrency Support: Concurrency support refers to the extent to which inherent
language supports the construction of code with multiple threads of control (also known as parallel
processing). For some applications, multiple threads of control are very useful or even necessary.
This is particularly true for real time systems and those running on architecture with multiple
processors. It can also provide the programmer with more control over its implementation. Other
features include Reusability and Standardization.

6.3 CLASSIFICATION OF PROGRAMMING LANGUAGES


Computers understand only one language and that is binary language or the language of
0’s and 1’s also known as machine language. In the initial years of computer programming, all
the instructions were given in binary form only. Although these programs were easily understood
the computer, it proved too difficult for a normal human being to remember all the instructions in
the form of 0’s and 1’s therefore, the computer remained a mystery to a common man until other
languages such as assembly and high –level languages were developed which were easier to learn
and understand. These languages use commands that have some degree of similarity with English
(such as if else, exit)
Programming languages can be grouped into three major categories: machine language, assembly
(low-level) language and high –level languages.

1. Machine language: Machine language is the native language of computers. It uses only 0’s
and 1’s to represent data and the instructions written in this language, consists of series of 0’s and
1’s. Machine language is the only language understood by the computer. The machine language
is peculiar to each type of computer.
2. Assembly (low-level) language: Assembly language correspondences symbolic instructions
and executable machine codes and was created to use letters instead of 0’s and 1’s to run a
machine. It is called low-level because of its closeness to the machine language.

61
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

3. High-level language: these languages are written using a set of words and symbols following
some rules similar to a natural language such as English. The programs written in high –level
languages are known as source programs and these programs are converted into machine- readable
from by using compilers or interpreters

6.4 GENERATIONS OF PROGRAMMING LANGUAGE


Since early 1950s, programming languages have evolved tremendously. This evolution has
resulted in the development of hundreds of different languages. With each passing year, the
languages become user-friendly and more powerful than their predecessors. We can illustrate the
development of all the language in five generations.

FIRST GENERATION: - MACHINE LANGUAGE


The first language was binary, also known as machine language, which was used in the
earliest computers and machines. We know that computers are digital devices, which have only
two states, ON and OFF (1 and 0). Hence, computers can understand only two binary codes that
is 1 and 0. Therefore, every instruction and data should be written using 0’s and 1’s. Machine
language is also known as the computer’s ‘native’ language because this system of codes is
directly understood by the computer.

Advantages of machine language: Even though machine language is not a human friendly
language, it offers certain advantages, as listed below:

i. Translation free: Machine language is the only language that computer can directly executes
without the need for conversion. In fact, it is the only language that computer is able to understand.
Even an application using high level language, has to be converted into machine- readable form
so that the computer can understand the instruction.
ii. High speed: Since no conversion is needed, the application developed using machine languages
are extremely fast. It is usually used for complex application such as space control system, nuclear
reactors, and chemical processing.
62
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Disadvantages of Machines Languages: There are many disadvantages in using machines


languages to develop program.
i. machine dependent: Every computer type differs from the other, based on its architecture.
Hence, an application developed for a particular type of computer may not run on the other type
of the computer. This may prove to be both costly as well as difficult for the organization. E.g.
program written for one machine, say IBM 370 cannot be executed by another machine say HP
530.
ii. Complex languages: Machine language is very difficult to read and write. Since all the data
and instruction must be converted to binary code, it is almost impossible to remember the
instruction. A programmer must specify each operation, and the specific location for each piece
of data and instruction to be stored. It means that a programmer partially needs to be a hardware
expert to have proper control over the machines languages.
iii. Error prone: Since the programmer has to remember all the opcodes (Operation Codes) and
the memory location, it is bound to be error prone. It takes a super human effort to keep track of
the logic of the problems and, therefore, result in frequent programming errors.
iv. Tedious:-Machine languages poses real problems while modifying and correcting a program.
Sometimes the programming becomes too complex to modify and the programmer has to re-
program the entire logic again. Therefore, it is very tedious and time consuming, and since time
is a precious commodity, programming using the machine languages tends to be costly.
Due to its overwhelming limitations, machine languages is rarely used nowadays

SECOND GENERATION: Assembly (low-level) languages,


The complexities of machines languages led to the search of another language and the assembly
language was developed. It was developed in the early 1950s and its main developer was IBM.
Assembly language allows the programmers to interact directly with the hardware. This language
assigns mnemonic codes to each machine language instruction to make it easier to remember or
write. It allows better human- readable method of writing program as compared to writing in
binary bit patterns.
63
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Unlike other programming languages, assembly language is not a single language but a group of
languages. Each processor family (and sometimes individual processors within a processor
family) has its own assembly languages.
An assembly language provides mnemonic instructions, usually three letters long, corresponding
to each machine instruction. The letters are usually abbreviated indicating what the instruction
does: For example, ADD is used to perform an addition operation, MUL for multiplication, etc.
Assembly languages make it easier for humans to remember how to write instruction to the
computer, but an assembly language is still a representation of the computer’s native instruction
set. Since each type of computer uses a different native instruction set, assembly languages cannot
be standardized from one machine to another, and instructions from one computer cannot be
expected to work on another.

Assembler:
Assembly language is nothing more than a symbolic representation of machine code, which also
allows symbolic designation of memory location. However, no matter how close assembly
language is to machines codes, the computer still cannot understand it. The assembly language
programs must be translated into machine codes by a separate program called Assemblers. The
assembler program recognizes the character strings that make up the symbolic names of the
various machine operations, and substitute the required machine code for each instruction. At the
same time, it also calculates the required address in memory for each symbolic name of a memory
location, and substitutes those addresses for the names resulting in a machine language program
that can run on its own at any time. In short, an assembler converts the assembly codes into binary
codes and then it assembles the machine understandable code into the main memory of the
computer, making it ready for execution.

Machine Language program (object code)


Assembly program Assembler
Error messages, listing, etc.

Figure: The working of an Assembler.


64
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The original assembly language program is also known as the source code, while the final
machine language program is designated the object code. If an assembly language program needs
to be changed or corrected, it is necessary to make the changes to the source code and then re-
assemble it to create a new object program. The functions of an assembler are given below:
1. It allows the programmer to the use mnemonics while writing source code programs, which
are easier to read and follow.
2. It allows the variable to be represented by symbolic names, not as memory locations.
3. It translates mnemonic operations codes to machine code and corresponding register
addresses to system addresses.
4. It checks the syntax of the assembly program and generates diagnostic messages on syntax
errors.
5. It assembles all the instructions in the main memory for execution.
6. In case of large assembly programs, it also provides linking facility among the subroutines.
7. It facilitates the generations of output on required output medium.
Advantages of Assembly Language: the advantages of using assembly language to develop a
program are:
i. Easy to Understand and Use: Assembly language uses mnemonics instead of using numerical
opcodes and memory locations used in machine language. Hence, the programs written in
assembly language are much easier to understand and use when compared with machine language.
Being a more user-friendly language as compared to machine language, assembly programs are
easier to modify.
ii. Less Error Prone: Since mnemonic codes and symbolic addresses are used, the programmer
did not have to keep track of the storage locations of the information and instruction. Hence, there
are bounds to be less errors while writing an assembly language program. Even in case of errors,
assembly programs provide better facility to locate and correct them as compared to machine
language programs. Moreover, assemblers also provide various mechanisms to locate the errors.

65
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

iii. Efficiency: Assembly programs can run much faster and use less memory and other resources
than a similar, program written in a high-level language. Speed increment of 2 to 20 times faster
is common, and occasionally, an increase of hundreds of times faster is also possible. Apart from
speed, assembly programs are also memory efficient, that is, the memory requirement of a
program (size of code) is usually smaller than a similar program written in high-level language.
iv. More Control on Hardware: Assembly language also gives direct access to key machine
features essential for implementing certain kinds of low-level routines such as an operating system
kernel or micro-kernel, device drivers, and machine control.

Disadvantages of Assembly Language:


The disadvantages in using assembly to develop a program are:-
i. Machine dependent: Different computer architectures have their own machine and assembly
languages, which means that programs written in these languages are not portable to other
(incompatible systems). If an assembly program is to be shifted to a different type of computer, it
has to be modified to suit the new environment.
ii. Harder to Learn: The source code for an assembly language is cryptic (has hidden meaning)
and in a very low machine specific form. Being a machine-dependent language, every type of
computer architecture requires different assembly languages, making it nearly impossible for a
programmer to remember and understand every dialect of assembly. More skilled and highly
trained programmers, who know all about the logical structure of the computer, can only create
applications using assembly language.
iii. Slow Development Time: Even with highly skilled programmers, assembly generated
application are slower to develop as compared to high-level language based applications. In case
of assembly language, several lines of assembly code are required for a line of high-level code the
development time can be 10 to 100 times as compared to high-level language generated
application.
iv. Less Efficient: A program written in assembly language is less efficient as compared to an
equivalent machine language program because every assembly instruction has to be converted in
66
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

to machine. Therefore, the execution of assembly language program takes more time than it
equivalent machine language program. Moreover, before executing an assembly program, the
assembler has to be loaded in the computer’s memory for translation and it occupies a sizeable
memory of computer.
v. No Standardization: Assembly language cannot be standardized because each type of
computer has a different instruction set and, therefore, a different assembly language.
vi. No Support for Modern Software Engineering Technology:-Assembly languages provide
no inherent support for software engineering technology. They work with just machine-level
specifics, not with abstractions. Assembly language does not provide inherent support for safety-
critical systems. It provides very little opportunity for reuse and there is no object-oriented
programming support. There is also no specific support for distributed systems. The tools
available for working with assembly language are typically very low-level tools.

THIRD GENERATION: HIGH-LEVEL LANGUAGE


During 1960s, computers started to gain popularity and it became necessary to develop languages
that were more like natural languages such as English so that a common user could use the
computer sufficiently. Since assembly language required deep knowledge of computer
architecture, it demanded programming as well as hardware skills to use computers. Due to
computer’s widespread usage, early 1960s saw the emergency of the third programming languages
(3GL) languages such as COBOL, FORTRAN, BASIC, and C are examples of 3GLs and are
considered high-level languages.
Using a high-level language, programs are written in a sequence of statements that impersonates
human thinking to solve a problem. For example, the following BASIC code snippet will calculate
the sum of two numbers.
LET X = 10
LET Y = 20
LET sum = X + Y
PRINT SUM
67
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The first two statement store 10 in variable X ( memory location name) and 20 in variable Y,
respectively the third statement again creates a variable named sum, which will store the
summation of X and Y value.
Finally, the output is printed, that is the value store in sum is printed on the screen. From this
simple example, it is evident that even a novice user can follow the logic of the program.

TRANSLATING HIGH-LEVEL LANGUAGE TO MACHINE LANGUAGE


Since computers understand only machine language, it is necessary to convert the high-level
programs into machine language codes. This is achieved by using language translators or language
processors, generally known as compilers, interpreters or other routines that accepts statements in
one language and produces equivalent statements in another language.
A. COMPILER: A compiler is a kind of translator that translates a program into another program,
known as target language. Usually, the term complier is used for language translator of high level
languages into machine language. The compiler replaces single high level statement with a series
of machine language instruction. When a program is to be compiled, its compiler is loaded into
main memory. The compiler stores the entire high level program, scans it and translates the whole
program into an equivalent machine language program. During the translation process, the
computer reads the stored program and checks the syntax (grammatically) errors. If there is any
error, the compiler generates an error message, which is usually displayed on the screen. In case
of errors, the compiler will not create the object code until all the errors are rectified.
Once the program, has been compiled, the resulting machine code is saved separately, and can be
run on its own at any time, that is, once the object code is generated, there is no need for the actual
source code. However, if the source code is modified then it is necessary to recompile the program
again to effect the changes.
Target language program
High-level language (machine object code)
Program Compiler
(Source Code) Error Messages

68
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

Fig 3 Working of a Compiler


NOTE: for each high-level language a separate compiler is required. For example, a compiler for
C language cannot translate a program written in FORTRAN. Hence, to execute both language
programs, the host computer must have the compilers of both language.

B. INTERPRETER: An interpreter is also a language translator and translates high-level


language into machine language. However, unlike compilers, it translates a statement in a program
and executes the statement immediately, that is, before translating the next source language
statement. When an error is encountered in the program, the execution of the program is halted
and an error message is displayed. Similar to compilers, every interpreted language such as
BASIC and LISP has its own interpreters.

Result of the Executed


High-level language Translate and Statement
Program Executes Statement
(Source Code) by Statement Error Messages

Figure: Working of an Interpreter


There are fundamental similarities in the functioning of interpreter and compiler. However, there
are certain dissimilarities also, as given in the Table below
Bases Complier Interpreter
Object Code A compiler provides a separate object An interpreter does not generate a
program permanent saved object code file
Translation A compiler converts the entire An interpreter translate the source code
Process program into machine code at once line-wise, that is it would execute the
current statement before translating the
next statement
Debugging Ease Removal of errors (debugging is Debugging becomes easier because the
slow.) errors are pointed out immediately
Implementation By nature, compilers are complex Interpreters are easier to write because
programs. Hence, they require hard- they are less complex programs. They
core coding. They also require more also require less memory for program
memory to execute a program execution.
Execution time Compilers are faster as compared to Interpreters are slower as compared to
interpreters because all statements are compilers because each statement is
69
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

translated only once and saved in translated every time it is executed from
object files which can be executed the source program.
anytime without translating again

Nowadays, many languages use a hybrid translator having the characteristics of compiler as well
as interpreter. In such a case, the program is developed and debugged with the help of interpreters
and when the program becomes bug free, the compiler is used to compile it.

Advantages of High-Level Languages: High-level languages (HLL) are useful in developing


complex software, as they support complex data structures. It increases the programmer’s
productivity (the number of lines of code generated per hour), unlike assembly language, the
programmer does not need to learn the instruction set of each computer being worked with. The
various advantages of using high-level languages are discussed below:-
(a) Readability: Since high-level languages are closer to natural languages, they are easier to
learn and understand. In addition, a programmer does not need to be aware of computer
architecture even a common man can use it without much difficulty. This is the main reason of
HLL’s popularity.
(b) Machine Independent: High-level language are machine independent in the sense that a
program created using HLL can be used on different platforms with very little or no change at all.
(c) Easy Debugging: High-level languages includes the support for ideas of abstraction so that
programmers can concentrate on finding the solution to the problem rapidly, rather than on low-
level details of data representation, which results in fewer errors. Moreover, the compilers and
interpreters are designed in such a way that they detect and point out the errors instantaneously.
Hence, the programs are free from all syntax errors.
(d) Easier to Maintain: As compared to machine and low-level language, the program written in
HLL are easily modified because HLL programs are easier to understand.
(e) Low Development Cost: High-level language permit faster development of programs
although a high-level program may not be as efficient as an equivalent machine and low-level

70
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

programs, but the savings in programmer time generally outweighs the inefficiencies of the
application.
(f) Easy Documentation: Since the statements written in HLL are similar to natural languages,
they can be easily understood by human beings. As a result, the code is obvious, that is, there is
few or no need for comments to be inserted in programs.

Disadvantages of High-Level Languages: There are two main disadvantage of high-level


language
i. Poor Control on Hardware: High-level language are developed to ease the pressure on
programmers so that they do not have to know the intricacies (complexity) of hardware. As a
result, sometimes the applications written in high-level languages cannot completely harness the
total power available at hardware level.
ii. Less Efficient: The HLL programs are less efficient as far as computation time is concerned.
This is because, unlike machine language, high-level languages must be created and sent through
another processing program known as a compiler. This process of translation increases the
execution time of an application programs written in high-level language, take more time to
execute, and require more memory space.
SOME POPULAR HIGH-LEVEL LANGUAGE
Although a number of languages evolved in the last five decades, only few language were
considered worthwhile to be marketed as commercial products. Some of the commonly used high-
level languages were discussed as follows:-

(a). FORTRAN: FORTRAN, or FORMULA TRANSLATOR, was developed by John Backus


for IBM 704 mainframes in 1957. The IBM 704 machines were considered as inseparable with
FORTRAN: They were the first machines to provide indexing and floating-point instruction in
hardware. FORTRAN gained immense popularity as compared to any of its counterpart and is
still extensively used to solve scientific and engineering problems.
The main feature of FORTRAN is that it can handle complex numbers very easily.
However, the syntax of FORTRAN is very rigid. A FORTRAN program is divided into sub-
71
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

programs, each sub-program is treated as a separate unit, and they are compiled separately. The
compiled programs are linked together at load time to make a complete application. It is not
suitable for a large amount of data as well and, hence, it is not often used for business applications.
(b) COBOL: COBOL, or common Business Oriented Language, has evolved after many design
revisions. Grace Murray Hopper, on behalf of US Defense was involved in the development of
COBOL as a language. She showed for the first time that a system could use an English Language
like syntax, suiting to the business notations rather than scientific notations. The first version was
released in 1960 and later revised in 1974 and 1984. COBOL was standardized with revisions by
ANSI in 1968.
COBOL is considered a robust language for the description of Input/ Output formats. It could
cope with large volumes of data. Due to its similarity with English, COBOL programs are easy to
read and write. Since, it uses English words rather than short abbreviations, the instructions are
self-documentary and self-explanatory. However, due to its large vocabulary, the programs
created using COBOL are difficult to translate. COBOL helped companies to perform accounting
work more effectively and efficiently.

(c). BASIC: Beginner’s All –Purpose Symbolic Instruction code, was developed by John Kemeny
and Thomas Kurtz at Darmouth College in the year 1960. It was the first interpreted language
made available for general use. It is now in such widespread use that most people see and use this
language before they deal with others. Presently many advanced versions of BASIC are available
and used in a variety of fields as business, science and engineering.
Basic program were traditionally interpreted. This meant that each line of code had to be translated
as the program was running. BASIC programs, therefore, ran slower than FORTRAN programs.
However, if a BASIC program crashed because of a programming error, it was much easier to
identify the source of the problem and in some cases the program could even be restarted at the
point where it broken down. In BASIC program, each statement is prefixed by a line number,
which serves a dual purpose to provide a table for every statement and to identify the sequence in

72
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

which the statement will be executed. BASIC is easy to learn as it uses common English words.
Therefore, it is a good language for beginners to learn their initial programming skills.

(d). PASCAL: Named after Blaise Pascal, a French philosopher, mathematician, and physicist,
PASCAL was specifically designed as a teaching language. The language was developed by
Niklaus Wirth at the Federal Institute of Technology of Zurich in early 1970s.
PASCAL is a highly structured language, which forces programmers to design programs very
carefully. Its object was to force the student to correctly learn the techniques and requirement of
structured programming. PASCAL was designed to be platform—independent, that is a PASCAL
program could run correctly on any other computer, even with a different and incompatible type
of processor. The result was relatively slow operation, but it did work in its own fashion.

(e). C: C was initially developed as an experimental language called A. Later on it was improved,
corrected and expanded until it was called B. This language in turn was improved, upgraded, and
debugged and was finally called C. C was developed by Dennis Ritchie at Bell Labs in the
mid1970s. It was originally designed for systems programming. The Unix operating system, for
example, was written in C. However, it can also be used for applications programming. The
compact nature of compiled code, plus its speed, made it useful for early PC application.
C consists of rich collection of standard functions useful for managing system resources. It is
flexible, efficient, and easily available. Having syntax close to English words, it is an easy
language to learn and use. The applications generated using C language programs are portable,
that is, the programs written in C can be executed on multiple platforms. C works on a data
structure, which allows a simple data storage. It has the concept of pointers, the memory addresses
of variable and files.

(f). C++: this language was developed by Bjarne Stroustrup in early 1980s. It is the superset of C
and supports object oriented features. This language is used effectively in developing system
software as well as application software. As it was an extension of C, C++ maintained the

73
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

efficiency of C and added the power of inheritance. C++ works on classes and objects as a
backbone of object oriented programming. Being a superset of C, it is an extremely powerful and
efficient language. However, C++ is much harder to learn and understand than its predecessor C.
The salient feature of C++ are:-
 Strongly typed
 Case-sensitive
 Compiled and faster to execute
 Platform in dependent

(g). JAVA: This language was developed by Sun Microsystems of USA in 1991. It was originally
called ‘Oaks’. Java was designed for the development of software for consumer electronic devices.
As a result, Java came out to be a simple, reliable, portable, and powerful language. This language
truly implements all the object-oriented features. Java was developed for internet and contributes
a lot to its development. It handled certain issues like portability, security, networking, and
compatibility with various operating systems. It is immensely powered on web and is used for
creating scientific and business applications:-
The features of Java includes;
 Simple and robust language.
 Secured and safe.
 Truly object-oriented language.
 Portable and platform independent
 Multithreaded, distributed, and dynamic.

FOURTH GENERATION: 4 G L
Fourth generation language (4GLs) have simple, English-like syntax rules, commonly used
to access data bases. The third generation programming language are considered as procedural
languages because the programmer must list each step and must use logical control structures to
indicate the order in which instruction are to be executed 4GLs, on the other hand, are non-

74
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

procedural languages. The non-procedural method is simply to state the needed output instead of
specifying each step one after another to perform a task. In other words, the computer is instructed
WHAT it must do rather than HOW a computer must perform a task.
The non-procedural method is easier to write, but has less control over how each task is
actually performed. When using non-procedural languages, the methods used and the order in
which each task is carried out is left to the language itself; the user does not have any control over
it. In addition, 4GLs sacrifice computer efficiently in order to make programs easier to write.
Hence, they require more computer power and processing time, however, with the increase in
power and speed of hardware and with diminishing costs, the use of 4GLs have spread.
Fourth generation languages have a minimum number of syntax rules. Hence, people who
have not been trained as programmers can also use such languages to write applications programs.
This saves time and allows professional programmers for more complex tasks. The 4GLs are
divided into three categories:
1. Query Languages: they allow the user to retrieve information from databases by following
simple syntax rules. For example, the database may be requested to locate details of all employees
drawing a salary of more than $10000. Examples of query language are IBMs structured Query
Language (SQL) and Query-By-Example (QBE).
2. Report Generations: They produce customized reports using data stored in a data base. The
user specifies the data to be in the reports format, and whether any subtotals and totals are needed.
Often report specifications are selected from pull-down menus, making report generations very
easy to use. Examples of report generators are Easytrieve plus by Pansophic and R&R Relational
Report Writer by Concentric Data systems.
3. Application Generations: with application generations, the user writes programs to allow data
to be entered into the database. The program prompts the user to enter the needed data. It also
checks the data for validity. Cincom Systems MANTIS and ADS by cullinet are example of
application generation.

Advantages of 4GLS
75
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY

The main advantage of 4GLs is that a user can create an application in a such shorter time for
development and debugging than with other programming languages. The programmer is only
interested in what has to be done and that too at a very high level. Being non-procedural in nature,
it does not require the programmers to provide the logic to perform a task. Therefore, a lot of
programming effort is saved as compared to 3GLS. Use of procedural templates and data
dictionaries allow automatic type checking (for the programmer and for user input) and this results
in fewer errors. Using application generations, the routine tasks are automated.

Disadvantages of 4GLs
Since programs written in 4GL are quite lengthy, they need more disk space and a large memory
capacity as compared to 3GLs. These languages are inflexible also because the programmers
control over language and resources is limited as compared to other languages. These languages
cannot directly utilize the computer power available at hardware level as compared to other levels
of language.
FIFTH GENERATION: VERY HIGH-LEVEL LANGUAGE.
Fifth generation languages actually is a future concept. They are just like conceptual view of what
might be the future of programming languages. These languages will be able to process natural
languages. The computers would be able to accept, interpret, and execute instructions in the
nature or natural language of the end users. The user will be freed from learning any programming
language to communicate with the computers. The programmers may simply type the instruction
or simply tell the computer via microphones what it needs to do. Since these languages are still in
their infancy, only a few are currently commercially available. They are closely linked to artificial
intelligence and expert systems.

76

You might also like