CSC 111 NOTE Complete
CSC 111 NOTE Complete
CSC 111 NOTE Complete
MODULE ONE
DEFINITION, CHARACTERISTICS, CLASSIFICATIONSAND
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),
logicalcomparison 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 SK FROM CIS
These characteristics have made computer to be very versatile in all human endeavours such as
scientific researches, weather forecasting, medicine, security systems, library system,
languagetranslations, 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 SK FROM CIS
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. 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
3
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
4
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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. 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).
5
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
6
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
7
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
A Pascaline opened up so you can observe the gears and cylinders which rotated to display
the numerical result
8
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 SK FROM CIS
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 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.
10
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
11
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
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.
12
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
13
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 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.
14
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
15
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 SK FROM CIS
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 SK FROM CIS
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.
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.
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
18
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 SK FROM CIS
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
20
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 SK FROM CIS
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
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.
22
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
23
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
207 16 12 15 = F
12 16 0 12 = C
Therefore, 5324110 = CFF916
24
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
1101 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 13 = D
Therefore 110010111012 = 65D16
25
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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).
26
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
27
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 digitalcircuit. 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 SK FROM CIS
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 SK FROM CIS
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 SK FROM CIS
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
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.
31
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
00 1
0 1 0
1 0 0
1 1 1
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).
32
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 SK FROM CIS
34
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
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 SK FROM CIS
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 .
For instance, a function involving two variables has an input combination of =4. One
involving three variables has =8 input combinations.
36
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 1 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 B C 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
1 1 0 0 1
1 1 1 1 1
37
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 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
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
38
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
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.
39
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
“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.
40
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
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
41
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
42
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
43
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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:
44
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
45
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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+
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
46
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 theminterm 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.
0 1 1 0
1 0 0 1
47
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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”.
AB0 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 C0 1
00 (000) C (001)
01 B (010) BC (011)
11 AB (110) ABC(111)
10 A (100) A C(101)
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
48
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
49
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
1 1 0 0 1 0 1
B B
A 0 0
A 1 1
50
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
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
0 0
A 1 0
51
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
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 .
52
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
AB C
1 1 Group 2
B 1 0
AB 0 0
A 0 1
53
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
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.
54
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 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.
In early 1950s, Grace Hopper and his team developed A-O Language. During
this period, assembly language was introduces.
55
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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
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.
56
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
(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.
57
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
(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 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
58
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 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.
59
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
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
60
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
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.
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 it’s
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.
61
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 it’s overwhelming limitations, machine languages is rarely used nowadays
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
62
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
63
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
64
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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 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 itoccupies 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
65
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
distributed systems. The tools available for working with assembly language are typically
very low-level tools.
66
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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. Incase 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
67
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
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.
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 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.
69
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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. Someof the commonly
used high-level languages were discussed as follows:-
70
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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. Itwas 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 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
71
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
(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 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:-
72
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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. Itwas
originally called ‘Dak’. 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-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.
73
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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:
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.
74
AS RECEIVED FROM THE LECTURER IN CHARGE, COMPILED SK FROM CIS
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.
75