CSC 111 Complete
CSC 111 Complete
MODULE ONE
DEFINITION, CHARACTERISTICS, CLASSIFICATIONS AND
HISTORICAL DEVELOPMENT OF COMPUTER SYSTEM
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
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY
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.
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.
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).
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.
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.
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
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
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.
11
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY
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.
13
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY
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.
15
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY
MODULE 2
COMPONENTS OF A COMPUTER SYSTEM
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
Peripherals
Input
Unit Auxiliary Output
Storage Unit
Unit
Main Memory
Central
Processing Arithmetic
Unit and Logic
Unit
Control Unit
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
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.
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.
The following diagram shows the organizational structure of a typical computer installation
DPM
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 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
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.
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
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
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).
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.
Other gates- NAND, NOR, XOR and XNOR are based on the 3 basic gates.
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."
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 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 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 (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 (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
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 .
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.
for a, b, c B
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
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
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)
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.
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.
“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
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.
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
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
a. J= f(A,B,C) = B + B + BC + A b. Z = f(A,B,C) = B + B + BC + A
42
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY
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
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
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
It is used to test the validity of statements. In validating statements, the following three steps can be
followed:
Very complex Boolean functions may result and this can be simplified in two ways:
45
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED BY TRINITY
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.
A(1 + B) + BC (1 + B = 1)
A.1 + BC (A.1 = A)
Q =A + BC
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)
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.
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”.
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.
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
0 1
1 0
B 1
1 1
A 1 0
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
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.
Examples
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
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
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.
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
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
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.
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.
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.
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.
68
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.
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.
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