0% found this document useful (0 votes)
3 views110 pages

Introduction To Computer

The document is an introductory course on computer science from Dan Bible College, covering fundamental concepts such as the definition of computer science, characteristics of computers, and their applications. It discusses various sub-disciplines of computer science, data representation methods, computer arithmetic, and the architecture of computer systems. Additionally, it highlights the historical development of computers and their roles in various fields, including education, business, and healthcare.

Uploaded by

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

Introduction To Computer

The document is an introductory course on computer science from Dan Bible College, covering fundamental concepts such as the definition of computer science, characteristics of computers, and their applications. It discusses various sub-disciplines of computer science, data representation methods, computer arithmetic, and the architecture of computer systems. Additionally, it highlights the historical development of computers and their roles in various fields, including education, business, and healthcare.

Uploaded by

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

ዳን የመጽሐፍ ቅዱስ ኮሌጅ(Dan Bible

College)

መሰረታዊ ኮምፒተር ትምህርት


(Introduction To Computer)

Introduction to computer Science 1


1 Chapter One ................................................................................................................ 4
1 Introduction ................................................................................................................. 4
1.1 What is Computer Science? ................................................................................ 4
1.2 What is Computer? ............................................................................................. 5
1.3 Characteristics of computers ............................................................................... 5
1.4 Application of Computers ................................................................................... 6
2 Data representation method ...................................................................................... 52
2.1 Number System.................................................................................................. 52
2.1.1 The Decimal Number System ................................................................... 52
2.1.2 The Binary number system ....................................................................... 53
2.2 CODING METHODS........................................................................................ 54
3 Some Coding Examples ............................................................................................ 55
4......................................................................................................................................... 55
5 ASCII-7 ..................................................................................................................... 55
6 Coding Examples ...................................................................................................... 56
7 UNITS OF DATA REPRESENTATION ................................................................. 57
8 BIT ............................................................................................................................ 57
9 BYTE ........................................................................................................................ 57
10 WORD .................................................................................................................. 58
11 Computer Arithmetic ............................................................................................ 59
11.1 . Number systems .............................................................................................. 59
11.1.1 Octal number System (base 8) (Oct) ......................................................... 59
11.1.2 Hexadecimal number system (16) (hex) ................................................... 59
11.2 Conversion from one Base to Another .............................................................. 60
11.2.1 Conversion from decimal (base 10) to other base (base M) ..................... 61
11.2.2 Conversion from base M to base 10 (decimal) ......................................... 61
11.2.3 .Conversion from binary (base2) to Octal (base 8) or hexadecimal
(base16) and vice versa ............................................................................................. 61
11.2.4 Conversion from Octal to hexadecimal and Vise versa ............................ 62
11.2.5 Summary of conversion from One base to another base .......................... 63
11.2.6 Converting decimal number with fractions to Binary............................... 63
11.2.7 Converting Binary with fraction to decimal. ............................................ 64
11.2.8 Conversion from Binary with fraction to Octal/hexadecimal ................... 65
11.2.9 Conversion from Octal or hexadecimal with fraction to binary. .............. 65
11.2.10 Conversion from Octal with fraction to hexadecimal ........................... 65
11.2.11 Conversion from Hexadecimal with fraction to octal ........................... 65
11.2.12 Conversion from octal/hexadecimal with fraction to decimal. ............ 65
11.3 Binary Arithmetic ............................................................................................. 66
11.3.1 Binary addition.......................................................................................... 66
11.3.2 Binary Subtraction .................................................................................... 67
11.3.3 Binary Multiplication:............................................................................... 67
11.3.4 Binary division .......................................................................................... 67
11.4 Representation of Negative numbers ................................................................ 68
11.4.1 One‟s complement. ................................................................................... 69
11.4.2 Two‟s Complement Representation .......................................................... 70
11.5 Subtraction by use of complements. .................................................................. 72

Introduction to computer Science 2


11.6 Floating-Point Representation......................................................................... 73
11.6.1 Floating-point Arithmetic ......................................................................... 75
Chapter 6 .......................................................................................................................... 77
12 Computer System Architecture ............................................................................. 77
12.1 Hierarchical structuring of a computer system Architecture ............................ 77
12.2 Logic gates(elements) ....................................................................................... 78
12.3 Boolean Algebra ............................................................................................... 79
12.4 Construction of logical circuit from logical function and truth table ............... 81
12.4.1 Construction Boolean function/logic circuit from truth table .................. 81
12.5 Types of circuit ................................................................................................. 84
12.5.1 Adders (Half Adder and Full Adder) ........................................................ 84
12.5.2 Flip Flops .................................................................................................. 86
13 Data: Communications and Networks .................................................................. 88
13.1 Data Transmission ............................................................................................ 88
13.1.1 Mode of transmission................................................................................ 88
13.1.2 Data Transmission Channels..................................................................... 89
13.2 Network and distributed systems. ..................................................................... 89
13.2.1 Distributed System .................................................................................... 90
13.3 Internet and Electronic communication ........................................................... 91
14 Problem Solving Using Computers ...................................................................... 93
14.1 Steps Program development ............................................................................. 93
Chapter 9 ....................................................................................................................... 102
System Development Life Cycle (SDLC) .................................................................... 102
The System Life Cycle phases ........................................................................................ 102
1

Introduction to computer Science 3


Chapter One
1 Introduction
Objective:
 Define the discipline computer science
 Define the term computer
 Identify the several characteristics of computer that made them useful and popular
 Application of Computers
1.1 What is Computer Science?
Computer Science is a science concerned with information i.e. representation, storage,
manipulation or processing and presentation of information. Like any other science,
which uses some devices for the practical aspect, computer Science uses a special device
called COMPUTER.
Computer science has different fields of specialization or sub-disciplines like other
sciences.
There are seven sub-disciplines of computer science.
 Software engineering: Soft ware engineering – It is concerned about the
development of a better quality software by applying scientific &basic
engineering principles.
 Computer engineering (Architecture): deals with studying, analyzing and
designing of computer hardware (organization and interconnection of
computer system components) and its working principle.
 Automata theory: Automata Theory Is The study of machines or devices
which accept a certain inputs such that the out put or at least the probabilities
of output s are determined by the input.
 Formal Language Theory: Embraces the study of programs of programming
languages, which is important for the understanding, and construction of
compilers.
 Complexity theory: concerned with the study and analysis of algorithms,
which helps in measuring the efficiency of the algorithms.

Introduction to computer Science 4


 Data base Architecture: involves the study and design of efficient methods
for information storage, process & retrieval.
 Artificial intelligence: Is concerned with means by which Computers may
perform tasks that would be characterized as intelligent if performed by
human beings.
1.2 What is Computer?
A computer is an electronic device that accepts data, performs computations, and makes
logical decisions according to instructions that have been given to it; then produces
meaningful information in a form that is useful to humans.
. The name computer comes from a Latin word Computer, meaning, “to compute”
1.3 Characteristics of computers
The characteristics of a computer show the capability and the potential of the computer
for processing data. This saves time, space, money, labors etc. And they answer the
questions why computers are used? Why have they become so popular?
1. Speed
The ability of the computers to carry out their instructions in a very short period of
time is one of the main reasons for their popularity. Computers can perform within a
matter of seconds or minutes tasks that would be impossible for a person to complete
by hand in lifetime.
Its speed is measured by the amount of time it took to perform or carry out a basic
operation. And its speed measured in terms of micro second (10 -6 one millionths),
nano second (10-9 one billionths), and Pico second (10-12 one trillionths). Hence a
computer with speed 1 microsecond can perform 1 million instructions in just 1
second. ( For example in one second this computer can perform the following tasks:
 Computer the grade point average for 3000 students
 Calculate the total value of all books used by students in a university

Accuracy
Now a days computers are being used life-and-death situations (For example, jet pilots
rely on computer computations for guidance, Hospitals rely on patient-monitoring
systems in critical –care units) which needs almost hundred percent accuracy. From this

Introduction to computer Science 5


we can understand that computer is accurate and consistent. Unless there is an error in the
input data or unreliable program the computer processes with a very accurate.
Capacity
The ability of computers to store and process vast amounts of data continues to grow. A
computer operating at 200 MHz can move data from one location to another at a rate
excess of 1.2 billions characters (symbols) per second.
Durability and reliability
Computers are durable and extremely reliable devices. They can operate error-free over
long periods of time.
Versatility
Because of technological advancements in the computer industry, most computers today
are considered to be general-purpose computers That is both their computation and
input/output processing capabilities are such that they can be used for almost any type of
application. For example, the same computer that is used to handle engineering
company‟s mathematics, and design computations can also be efficiently used by the
company to track inventory, process payroll, project earnings, and fulfill all its reporting
needs.
Today‟s computers are versatile in what they can do; computers and their components
part being used in application never before envisioned. For example; in home appliances
(washing machines, ovens) home entertainment centers, traffic lights, automobiles,
banking, assembly plants, space probes, art, music, education, hospitals, and agriculture,
to name few. The versatility of the computers and its use in a wide array of application
are limited only by the imagination of the human mind.

Note: Even if the above main characteristics of computers are increasing with time, the
cost and size of computers are decreasing.

1.4 Application of Computers


Why we use Computers?
The following are some of the capability of Computers, which are reasons to use
Computers.

Introduction to computer Science 6


 Store and process large amount of information with high speed and accuracy;
 Transmit information across continents via communication channels;
 Simulate events;
 Perform complex mathematical computations and make comparisons;
 Monitor ongoing industrial operations;
 Perform repetitive processes with great ease, speed, and reliability;

Therefore, computers are applicable for any functions or process that requires these
abilities.

The main areas of computer applications can be listed as follows:


Learning Aids:
Example: learning toys, programs range from simple arithmetic to calculus, from English
grammar to creative writing and foreign language, and from basic graphics to engineering
design models,)
Entertainment:
Examples : Games
Commercial or business applications
Computers are needed to perform business operations that require handling large amounts
of data. Several computer applications are available to assist business in working with
large volumes of data.
Examples are:
 Text processing
 Accounting and Finance management
 Inventory control
 Database management
 Statistical analysis
Scientific – engineering and research applications
 Using computers for scientific research, complex mathematical calculations,
design work, and analysis and control of physical systems.

Introduction to computer Science 7


Examples are:
 Space technology
 Meteorological observatory systems
 Astronomical investigations
 Design of machines and
 Control of manufacturing process
Information Utilities
Information utilities companies use large computers that store huge amount of
information about many different subjects. These computer systems and their vast
amount of data are available for personal use. For example: information utilities can
allow a computer user to read the daily news , research published works, send a letter to
a friend, play games, make airline reservations, obtain the latest stock market quotations,
and perform many other activities.
Example: Internet.
Ethiopian airline is a member of World-Wide reservation system called Gabriel
system.
 The main database is located at Atlanta, Georgia
 More than 48 airlines including EAL share /extract/transmit information using
Gabriel
Facilities included:
 Booking of passengers on Domestic and International flight on EAL or Other
carrier ( EX. Lufthansa).
 Making hotel reservation for the travelers (i.e. the system is connected with
major hotels & travel agents)
 Massage correspondence with all stations which are members of Gabriel (i.e.
reconfirmation space availability, etc)
Elements involved in the reservation system are:
 Computer Network;
 Computer terminal;
 Communication Channels ( telephone lines, satellite, etc)
 Modems

Introduction to computer Science 8


Electronic Banking and Service:
Example: Teller Machine (customers are issued cards that permit them to use other banks
teller machine‟s)
Online banking (A bank customer can use his/ her computer to check account
balances, transfer funds, pay bills)
Shopping from Home
Individual may now shop by computer in the comfort of their home.
Household Control
A growing number of the newer houses hold devices are computers controlled. For
example: Security systems, refrigerators, microwave ovens, washers, stereos, and
televisions. This computer controlled home security system monitors movements, broken
glass, unlawful entry without a security code, and so on, and alerts the local police
department.
Weather and Environment
Computer equipment may show temperature ranges, precipitation levels and wind flow
and can used in weather forecasting. Computer can also help in overcoming
environmental hazards.
Transportation
Computers have affected almost every kind of transportation. Many aircraft can fly under
the control of the computer; in this situation, the captain simply serves as a manger by
telling the computer what to do. In Cars, computers have provided functional controls
such as spark and fuel control.
Medical and Health Care
Computers have long been used by hospitals for routine record keeping. Today, however,
many people owe their lives to the computer. Computers are used in hospitals as sensors
(device that detect changes in blood pressure, heart rate, temperature), testing (scan the
body and provide 3-D figure), patient treatment.
Routine and Dangerous Tasks
Computers are used in routine tasks. And they can perform task in environments to
dangerous for human workers.
Consultant (Expert system)

Introduction to computer Science 9


An Expert system is a computer program, which can solve problems from a specific
knowledge base. These systems don't replace expert humans because the knowledge base
of expert system is given from the skilled specialist.
Example: Mycin (a medical diagnostic program by using sophisticated decision
making process).

Introduction to computer Science 10


Chapter 2

2. The development of Computers

[Link] of Computers
We have all heard stories of primitive peoples counting their sheep by moving sticks or
stones. Our base ten number system undoubtedly grew from the use of 10 fingers as
counting objects. Together with the development of people, the need to calculate and
keep track of information had become popular issue. So they soon develop a simple
computing device and had a power of storing small information. However, many
thousands of years elapsed before developing mechanical calculator.
Some of the calculating devises are mentioned bellow:
a) The Abacus
It is one of the earliest mechanical computational devices. It was in use in the Middle
East as early as 2500 BC The familiar Chinese abacus ( dating approximately 1200 AD )
is composed of a frame and a number of wires. The wires correspond to position of digits
in a decimal number-units, tens, hundreds, and so on-and the beads represent digits.
Beads above the cross bar represent 5 and those bellow ,1.

Above (five each)

Below (one each)

The abacus shows zero, if all the bead bellow the cross bar are at the lower frame and
above are at the upper frame.

Introduction to computer Science 11


Addition of two numbers on the abacus can be performed by representing the first
number and the second number without resetting the first. On any wire showing 10 or
more, the two beads above the cross bar are moved back, and an extra 1 (the Cary) is
added two the wire on the left. This process can be easily generalized to addition and
subtraction of more than two numbers.

B) Pascal‟s calculator
It is the first true mechanical calculator.
In 1642, at the age of 19, the French philosopher and mathematician Blaise Pascal
developed a rotating wheel calculator, the predecessor of the latter popular desktop
calculator. He built largely to assist his father, who was a tax collector in the town of
Rouen, Pascal‟s calculator has one wheel corresponding to each power of 10; each wheel
has 10 position, one for each of the digits (0,..9). Although Pascal‟s calculator could only
add and subtract, it could be used indirectly for multiplication (by successive addition)
and division( by successive subtraction) as well.

C) the difference engine


It is the forerunner of the modern computer.
Charles Babbage (1792-1871), a British mathematician and engineer, is considered by
many to be the real father of today‟s computer was the developer of the difference engine
and designer of the analytical engine. The difference engine also based on the rotating
wheels principle, was operated by means of a single crank. This devise has a power of
calculation and print the out put with out human intervention. He finally designed
significantly improved version of the difference engine (but not built) called Analytic
engine. It has different key components
- The store: A memory wheel consisting of set of counter wheels
- The mill: An arithmetic unit capable of performing the four basic arithmetic
operations. It operated on pairs of mechanical registers and produced a result
stored in another register, all of which were located in the store.
- Operation cards: These card selected one of the four arithmetic operations by
activating the mill to perform the selected function.

Introduction to computer Science 12


- Variable cards: These cards selected the memory locations to be used by the
mill for a particular operation ( a source of operand and the destination of the
result ).
- Out put: was to print or a card punch device.
But finally the design halt largely due to the technology of the day is not far enough too
supply the required raw materials.

D) Herman Hollerith‟s tabulating machine


Herman Hollerith was a statistician that in 1880 and develop his machine commissioned
by the U.S. Census Bureau to develop a technique for speeding up the processing of
census data that took at least 8 years before. He develops his machine that uses the
punched card to punch the census the data and tabulated by using his machine. This
machine processes the 1890 American census data with in 3 years. It was really a great
development. He finally began the tabulating Machine Company, which later becomes
the International Business Machine Corporation (IBM)

E)Mark I: Developed by Howard Aiken at Harvard university (1944) which were the one
first electromechanical computer. Instruction were provided by means of punched paper
tape, which combined the functions of Babbage‟s operation cards and variable cards.
Each instruction had the format
A1 A2 OP where
A1 and A2 are registers storing the operands
OP is the operation to be performed( e.g. +,-,x,)
Mark I could do asingle addition in 6 seconds and division in 12 seconds

F) ENIAC( Electronic Numerical Integrator And Computer): Developed by Eckert and


Mauchly at the university of Pennsylvania. This was the first electronic calculator and
first general purpose digital computer. This machine was enormous, weighing 30 tones.
occupying 15,000 square feet of floor space and containing over 18,000 vacuum tubes.
When operating, it consumed over 140 kWh of power. It had a capability of performing
5,000 addition per second. Its memory consisted of 20 “accumulators” each capable of

Introduction to computer Science 13


holding a 10 digit decimal number. Each digit was represented by a ring of 10 vacuum
tubes. At any time, only one of the 10 tubes was in ON state, representing one of the 10
digits.

 ENIAC did not use internally stored programs. Programs were wired on
boards similar to a telephone switch board.
 One of the major drawbacks of ENIAC was that it had to be programmed
manually by setting switches and plugging and unplugging cables.

G)The Von Neumann Machine


The task of entering and altering programs for the ENIAC was extremely tedious. Von
Neumann was the consultant on the ENIAC project and forward the stored program
concept, i.e designing the computer to get its instruction by reading them from memory
alongside the data and a program could be set or altered by setting the values of a portion
of a memory. Based on this concept, the first true electronic computers were developed
by the name EDVAC( electronic Discrete Variable Computer) and EDSAC( Electronic
Delay Storage Automatic Computer).

G) Commercial Computers
The 1950s saw the birth of computers industry with two companies, Spery and IBM,
dominating the market place. In 1947, Eckert and Mauchly develop their successful
commercial computer called UNIVAC I (Universal Automatic Computer ) .
UNIVAC was division of Remington Rand (later Sperry_Rand Corporation).
IBM also the majior manufacturer of punched card processing equipment ,delivered its
first electronic stored program computer, the IBM 701, in 1953.

2.2. Generation of Computers

Introduction to computer Science 14


Although computer professionals do not agree on exact dates or specifics,
computer developments are often categorized by generations. Actually there
are four generations and major characteristics that distinguish these
generations are the following;
 Dominant type of electronic circuit elements used.
 Major secondary storage media used.
 Computer language used.
 Types or characteristic of operating system used.
 Memory access time (time to store or retrieve a word or data

from memory).

Computer generations are usually categorized by dramatic improvement in


the hardware, typically refold or better increases in speed and reliability.

First generation (1950s)

 Used vacuum tubes as components for the electronic circuit.


 Punched cards were the main source of inputs, and magnetic grams
were used for internal storage.
 Operate in a speed of milliseconds (thousands of a second) and could
handle more than 10,000 additions each second.
 Most applications were scientific calculations.

Second generations (early 1960s)

 Transistors were the main circuit components. (Transistors are a solid

Introduction to computer Science 15


state device made from silicon which is smaller, cheaper, faster,
dissipate less energy and more reliable than vacuum tube but work in
the same way with the vacuum tube.)
 Invented by Bell Labs.
 Magnetic tapes (similar with home tape caste), used for main
storage,
 Operate in microseconds (millionths of a second) with more than
200,000 additions possible each second.
 Business applications become more commonplace, with large data
files stored on magnetic tape and disk. (Magnetic disk: is a circular
platter constructed of metal or plastic materials coated with
magnetizable substance.)
 High-level languages COBOL and FORTRAN were introduced
during this period. Batch operating systems are used that permitted
rapid processing of magnetic tape files.

Third generation (late 1960s, early 1970s)


Characterized by solid-state logic and integrated circuit (IC). (A single, self-
contained transistor is called discrete component. In early 1960 electronic
equipment composed of discrete components transistors, capacitors,
resistors, …. They are
* manufactured separately
* Packed in their own containers and soldered (wired together) on a circuit
board. So the entire manufacturing process was cumbersome and expensive.
Do to these and other problems in 1958 the achievement that revolutionized
electronics started the era of microelectronics: the invention of integrated
circuit.

Introduction to computer Science 16


 Computer storage switched from magnetic cores to integrated circuit
boards that provide modularity (expandable storage) and compatibility
(interchangeable equipment
 New input/output methods such as optical scanning and plotters.
 Software become more important with sophisticated operating
systems, improved programming languages,

Fourth generation (late 1970s,early 1989s,)


 Greatly expanded storage capabilities and improved circuitry.
 Has a large-scale integrated circuits (LSI) which has several hundred
thousands transistors placed on one tiny silicon chip.
 Computer memory operates at speeds of nano seconds (billionths of a
second) with large computers capable of adding 15 million numbers
per second.

The fifth generation computer is in progress. An architecture, which makes


use of the changes in technology and allows a simple and natural
methodology for solving problems, is being sought. These computers will
have intelligent processors i.e., processors which can draw inferences. Users
will also be able to interact with them in natural languages such as English,
German etc. Japans are working intensively on the project for developing
the 5th generation.

Introduction to computer Science 17


Summary of generation of computers
Generation 1st 2nd 3rd 4th 5th
Circuit element Vacuum tube Transistor IC LSI VLSI
SSD Punched card Magnetic Magnetic Mass storage
Tape disk device
Language Machine & Fortran, Structured Application
assembly COBOL language oriented
etc
Operating system Operator Batch Application Time sharing
control system oriented
Mem. Access time 1ms 10µs 10ns 1ns
Approx. date 1946-57 1958-64 1965-71 From 1971
above
examples ENIAC, IBM7090, IBM Late IBM
UNIVAC, 7094 system product
UDVAC

[Link] of computers
There are different types of Computers. Their difference is depending on
different categories of characteristics.

Classification by the method of operation (processing)

They are classified into three:


1. Analog
Analog computers operate by measuring. They deal with continues

Introduction to computer Science 18


variables; they don‟t compute directly with numbers, rather, they operate by
measuring physical magnitude such as pressure, temperature, voltage,
current etc.
Examples
 Thermometer
 Voltmeter
 Speedometer
 Gasoline pomp – Contains an analog Computer that converts the
flow of pumped fuel into two measurements the price of the
delivered gas and the quantity of pumped fuel.
They are special purpose computers.
Analog computers have limited accuracy

2. Digital Computers
Digital computers deal with discrete variables; they operate by counting
rather than measuring. They operate directly up on numbers (or digits) that
represent numbers, letters, or other special symbols.
Examples:
 Abacus
 Desk & pocket computers
 The general purpose computers
Digital computers have higher accuracy and speed than the analog ones.

3. Hybrid computers

The best features of analog and digital computers can be combined into a

Introduction to computer Science 19


single device to form a hybrid computer. A hybrid computer processes the
information by collecting input data with analog method, convert it into
digital quantities, processes the digital values and convert the output from
digital to analog form.

Example:
In hospital insensitive-care unit analog devices may measure a
patient‟s heart function, temperature and other vital signs. These
measurements may then be converted into numbers and supplied to a
digital component in the system. This component is used to monitor
the patient‟s vital signs and to send an immediate signal to the nurse‟s
station. If any abnormal readings are detected.

Classification by purpose of application

Computers can be applied or used for different purposes. Based upon their
application, they are classified as special purpose or general-purpose
computers

1. Special purpose computers

They are designed to solve a single type of problem, that is their components
and function are uniquely adapted to a specific situation involving specific
application.
Example:
 The public telephone box
 Traffic control system

Introduction to computer Science 20


 Ticket machines (used in grocery, super market etc.)
 Pocket calculators etc.
 Counters
Most analog computers are special purpose computers.

2. General-purpose computers

They are designed to solve variety of problems through the use of “store
program concept”. A program or set of instructions designed to solve a
problem is read and stored into the memory and then executed by the
computer one by one. The same computer can be applied to solve another set
of problem using different program. General purpose computers are more
flexible and versatile.

Examples
 Micro computers
 Mini computers
 Super computers etc.
Classification by physical size, price, capacity and performance

At this stage, by a computer, we mean a general-purpose digital computer.


There is a wide variety of general purpose digital computers on the market
place today, in terms of physical size, price, capacity, and performance.
They are then classified as follows by their capacity and size:

Super computers: - are the fastest, largest and most potential types of
computer.

Introduction to computer Science 21


They have speed of hundreds of millions of operation per second, a primary
memory capacity of about 80 million characters, a secondary memory of
capacity of about 20 times its primary memory.
They are multi-user systems in intercontinental range.
They can carry out enormously complex scientific calculations.
They are used to process huge amount of data and are commonly used in
space technology centers, meteorology stations,astronomical observatories,
inter continental communications, airline organizations.

Mainframe computers:- Smaller than in size and capacity, lower in speed


& memory capacity than the super computers. However they are multi-user
systems and handle hundreds of users, usually used in large organizations.

Mini computers: - have relatively lower speed, can handle multi-users, are
smaller in size than the mainframe computers. They use terminals for inputs
and output. Mini computers are used in small organizations.

Micro computers:-Micro computer (personal or desktop computer) is a computer


whose CPU is microprocessor. Microprocessor is a processor all of whose components
are on a single integrated-circuit chip. Since its CPU is integrated in a single circuit, it
can serve only a single user at a time. Most of home and personal office computers are

100
performance
Relative

10

Introduction to computer Science 22


0.1
1965 '75 '85
microcomputers. The relative performance and usage of personal computer is relatively
increased with a very high rate.

Introduction to computer Science 23


Chapter 3

Data representation method


Objectives:
 To understand how really data represented, flow, stored and processed inside
the computer.
 To know the different coding systems & unit of data representation.

We enter data into a computer or review (see) output data from a computer using the
letter of alphabet, various special symbols, and the numerals in the decimal number
system. But since computer is an electronic device which understands electrical flow
(signal) there is no letter, symbol or number inside the computer. Computer works with
binary numbers. As a semiconductor is conducting or isn‟t conducting; a switch is closed
or opened.

So data are represented in the form of a code which can have a corresponding electrical
signal.

Number System

 A number system is a set of symbols used for counting


 There are various number systems
Ex. Decimal, Binary, octal-decimal, hexadecimal etc.

 For the purpose of understanding how data are represented, stored and
processed in computer, we will discuss only two of them, the Decimal and the
binary number system.

The Decimal Number System

 The Decimal number system is based on the ten different digits (or symbols)

Introduction to computer Science 24


0,1,2,3,4,5,6,7,8,9.
 We say it is a base ten number system
 Though it is widely used, it is inconvenient for computer to represent data. So we
need another number system.

The Binary number system


 Binary number system is based on the two different digits; 0 and 1;
 It is important to note that every decimal number system has its equivalent binary
number;
 Conversion from binary to its equivalent decimal and from decimal to its equivalent
binary is possible;
 Operation on binary number system is also possible
Binary Decimal
0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8
1001 9 etc.
 The most elementary form to organize data within a computer (an electronic device)
is in the form of a code which utilizes the “ON” and “OFF” states of electric switches
or there is “current” and “no current” condition of the electronic components;
 We see that the nature of the electronic devices has similarity with the binary number
system in that both represent only two elementary states;
 It is therefore convenient to use binary number system to represent data in a
computer;
 An “ON” corresponds to a 1;

Introduction to computer Science 25


 An “OFF” corresponds to a 0;
 In the computer “ON” is represented by the existence of a current and “OFF” is
represented by non existence of current
 On a magnetic disk, the same information is stored by changing the polarity of
magnetized particles on the disk‟s surface.

CODING METHODS

 It is possible to represent any of the character in our language in a way as a series of


electrical switches in arranged manner;
 These switch arrangements can therefore be coded as a series of an equivalent
arrangements of bits

There are different coding systems, that convert one or more character sets into computer
codes. Some are: EBCDIC, BCD, ASCII-7 & ASCII-8.
In all cases, binary coding schemes separate the characters, known as character set, in to
zones. A zone groups charactes together so as to make the coding scheme to decipher and
the data easier to process. With in each zone , the individual chatacters are indentified by
digit code.
EBCDIC: Pronounced as “Eb-see-dick” and stands for Extendede Binary Coded Decimal
Interchange Code.

 It is an 8-bit coding scheme; (00000000 – 11111111)


 It accommodates to code 28 or 256 different characters
 It is a standard coding scheme for the large computers.

Coding Examples

Introduction to computer Science 26


EBCDIC
Character zone (4BIT) digit(4 BIT)
0-9 15 0-9
a-i 8 1-9
j-r 9 1-9
s-z 10 2-9
A-I 12 1-9
Character Zone Digit
a 1000 0001
b 1000 0010
A 1100 0001
B 1100 0010
0 1111 0000
9 1111 1001

BCD (6-bits)
 Stands for Binary Coded Decimal
 It uses 6-bits to code a Character

Coding Examples
Character zone (2 BIT) digit(4 BIT)
0-9 0 0-9
A-I 3 1-9
BCD
Character Zone digits
A 11 0001
Q 10 1000
8 00 1000
9 00 1001

Introduction to computer Science 27


ASCII-7

 ASCII stands for American Standard Code for Information Interchange


 Used widely before the introduction of ASCII-8 (the Extended ASCII)
 Uses 7 bits to represent a character;
 With the seven bits, 27( or 128) different characters can be coded (0000000-1111111)
 It has a zone and digit bits positions

Coding examples:

Character zone (3 BIT) digit(4 BIT)


0-9 3 0-9
A-O 4 1-15
P-Z 5 1-10

ASCII-7
Character Zone digit
$ 010 0100
% 010 0101
A 100 0001
a 110 0001
b 110 0010

The ASCII System

 Also referred as ASCII-8 or Extended ASCII


 It is the most widely used type of coding scheme for Micro Computer system
 ASCII uses 8-bits to represent alphanumeric characters(letters, digits and special
symbols).
 With the 8-bits, ASCII can represent 28 or 256 different characters(00000000-

Introduction to computer Science 28


11111111).

Coding Examples

Character Binary representation in ASCII


a 01100001
b 01100010
A 01000001
B 01000010
? 00111111
+ 00101011
1 00110001
2 00110010
3 00110011

UNITS OF DATA REPRESENTATION

 When data is stored, processed or communicated within the computer system, it is


packed in units;
 Arranged from the smallest to the largest, the units are called bit, byte and word;
 These units are based on the binary number system;

BIT

 Bits are the smallest units and can convey only two possible states 0 or 1;
 bit stands for binary digits;
 A bit is a single element in the computer, on a disk that stands for either “ON”
indicating 1 or “OFF” indicating 0;
 In the computer “ON” is represented by the existence of current and “OFF” is
represented by the non existence of current
 On a magnetic disk, the same information is stored by changing the polarity or

Introduction to computer Science 29


magnetized particles on the disk‟s surface;

BYTE

 Bits can be organized into large units to make them represent more and meaningful
information;
 This large unit is called a byte and is the basic “unit of data representation” in a
computer system;
 The commonly used byte contains 8 bits;
 Since each bit has two states and there are 8 bits in a byte, the total amount of data
that can be represented is 28 or 256 possible combinations;
 Each byte can represent a character(a character is either a letter, a number or a special
symbol such as +,-,?,*, $, etc
 A byte is then used as a unit of measurement in the computer memory, processing
unit, external storage and during communication;
 If the computer memory is 524288 byte, this is expressed in short by saying 512KB,
where KB stands for kilobyte.
 1 Kilobyte(1KB) is 210 or 1024 bytes
 1 Megabyte(MB) is 220 bytes or 210 kilobytes
 1 Gigabyte(GB) is 230 bytes or 220 kilobytes or 210 megabytes

WORD

 Word refers the number of bits that a computer process at a time or a transmission
media transmits at a time
 Although bytes can store or transmit information, the process can even be faster if
more than one byte is processed at a once;
 A combination of bytes, then form a “word”
 A word can contain one, two, three or four bytes based on the capacity of the
computer;
 Word length is usually given in bits

Introduction to computer Science 30


 We say that a computer is an 8-bits, a 16 bit, a 32 bit or a 64 bit computer to indicate
that the amount of data it can process at a time;
 The large the word length a computer has the more powerful and faster it is.

Data processing
Data processing is the activity of converting row facts ( data) in to information. Data
processing may involve any number of the following steps:
 Data collection: means gathering original data to be entered in to the information
ststem. Examples: - filling out evaluation paper of instructors
Gathering the # of hours each week that hourly employee worked is
essential to calculating the weekly payroll.
 Data entry( recording) : it is the processof expressing data in a form that is
recognizable by either person or machine. This is accomplished by input device of
the computer.

 Data manipulation: This includes classifying, sorting , verifying the data.


- classifying: grouping the recorded data in to different category based on some
logical relation ship. Example Putting students and instructors information at different
pages of the document.
- sorting: putting data in ascending or descending order.
- Verifying: involves checking the data for validity before being used for
proccessing.
- Calculating : The process of performing mathematiocal or other operation on data.
It is the only data processing functions that produces new data.
- storing and retrieving : storing data means recording them on storage media from
which they may be retrieved when needed.
Retrieving is the process of locating the stored data and making the a vailable for
other processing activity.

Introduction to computer Science 31


Chapter 4

4. THE BASIC UNITS OF A COMPUTER SYSTEM

Objectives:
 What a computer system is and how it works to process data

System is a group of components, consisting of subsystems or procedures that work in a


coordination fashion to achieve some objective.

A computer system composed of components that are classified either as Computer


hardware or Computer software.
[Link] Hardware

Computer hardware is the physical part of the computer that you see, you use to and the
parts you can touch.

The hardware part of a computer system is composed of a number of interacting physical


parts based on the need of the information flow.
Information flow in the computer hardware

The Central Processing


Unit

Control Unit Arithmetic/Logic


Unit
Input
hardware
Registers
Registers

OUTPUT
Hardware
Programs
Input data Out put
Buffer Buffer

Primary
Memory

SECONDARY
Introduction to computer Science STORAGE DEVICE ROM 32
4.1.1. The Central Processing Unit (CPU)

 Is the most costly and main component of the computer system;


 Consists of the Control Unit & the Arithmetic Logic Unit and main memory;
 The three parts work together to electronically control the function of the computer;
 The different parts are inter connected by a cable like device called BUS, which is
used to facilitate communications between the parts. Buses are used to transfer data,
address and control code (signal).
Purpose of CPU
 fetch instruction: The CPU read instruction from the memory
 Interpret instruction: the instruction must be decoded to determine what action is
required
 Fetch data: the execution of an instruction may require reading of data from memory
or an I/O module.
 Process data: the execution of an instruction may require performing some arithmetic
or logical operation on data.
 Write data: The result of an execution may require writing data to memory or an I/O
module.
In order to able to do these the CPU needs
- to temporarily store some data
- to remember the location of the last instruction
- to store instruction and data temporarily while execution
in other words, the CPU needs a small internal memory called registers.

The Control Unit

Instruction
register

flags Control
unit

Introduction to computer Science 33


registers

 As the name implies, it performs all the control functions of the computer.
 It retrieves the instruction from memory.
 Translates those instructions into computer functions and sends signals to other
computer hardware units to carry out those functions.
 It is also responsible for determining the next instruction to be executed by the
computer.
 In general it serves as the computer traffic cope.

The Arithmetic Logical Unit (ALU)


Register register
ALU
Control unit flags

 It is referred as the computers "number crunchier".


 It performs the arithmetic calculations of addition, subtraction, multiplication and
division and comparisons and it is used to keep track of and execute instruction.
 All modern digital computers can do is addition; multiplication is merely a continuos
addition; subtraction is the addition of the complements of the number to be
subtracted; division is the addition of complements.

 Registers are paths or conduits that connect the Arithmetic Logical Unit to the main
memory.
 When an instruction loaded from main memory, it is placed first in the register to wait
instructions from the control unit.
 Data are also stored in registers prior to execution in the ALU.

Main Memory or Primary Memory or RAM

Introduction to computer Science 34


 Is that the memory which is directly accessible by the control unit and ALU;
 Usually referred as Random Access Memory (RAM), because each memory location
can be accessed without having to work sequentially through hundreds or even
thousands of memory locations called addresses;
 Each memory location can be referred by its memory location (address);
 Holds instructions and data elements which are currently being used by the computer;
 The data in the main memory while be lost when the power is off;
 Parts of the CPU may also contain Read Only Memory (ROM).
 This type of memory is integrated into the circuitry of the computer and can
not be altered without altering the computer circuitry;
 Used to store programs and data that are used frequently and permanently;
Due to high price of a primary storage memory of a computer system, the need to have
other type of storage to hold large amount of data in a less expensive and yet accessible
manner is evident. Hence secondary storage device were created with this need in mind.

Input Unit

 Is the unit used to enter data into the computer so that it can be processed.
 It converts information from a form suitable to human beings to one understandable
by the computer.
Examples of input devices;

 Keyboard (which is the most widely used input devices)


 Disk derives (floppy and hard-disk derives)
 Mouse
 Scanner
 Light pen(a photo cell to choose a displayed response to request
further information).
 Voice synthesizer;
 CD-ROM Drive, etc.

Introduction to computer Science 35


Special Input Units

1. Magnetic Ink Character Recognition Systems

 It is intensively used by U.S. banking industry to input information on checking


account transactions. It has been in use since the 1950s, allows checks and deposit
slips to be read both by people and by machines. The machines, called magnetic ink
character readers, read and convert the characters into machine code by detecting the
presence of magnetized particles in the ink on the checks or deposit slips. As many as
1500 checks per minute can be read and stored.

2. Optical Recognition Systems

Optical Recognition Systems fall into two categories. The first and most advanced are the
Optical Character Recognition (OCR) systems, which are able to recognize hand-printed
and typewritten characters. The second type of optical character recognition is referred to
as Optical Mark recognition (OMR). OMR doesn‟t utilize letters of the alphabet. Instead,
with the use of electronic scanners, marks and symbols are converted into appropriate
electronic signals. A typical example of an OMR application would be computerized test
forms. OMR systems are also used to read bar codes such as the Universal Product Code
(UPC).

OUT PUT UNIT

 Used to get data out of a computer so that it can be examined, analyzed or distributed
to others.
 Convert the result of the only-machine understandable form to a form understandable
by human beings.

Examples

Introduction to computer Science 36


 The Visual Display Unit (VDU) or monitor or screen
 Printers (dot matrix, desy wheel, laser printers)
 Plotters
 Voice (audio) response unit
 Disk drives

Interconnecting Components in a Macro Computer


and Information Movement in a Computer System.

We have seen that there are different components of a computer and each performs a
specific function. But to perform a given task in synchronized form there should be some
mechanism of communication. For this reason there is an electronic circuit which
produces communication path between the different components of a computer system
along which data are transferred, that is Bus. The bus, which communicates the different
parts of the CPU is called Internal Bus. And the bus, which communicates the CPU with
memory and peripheral devices is called External Bus. The size of the bus determines the
speed of efficiency of the computer.

Address Bus

ROM ROM Input Input


ports Ports
Micro
Processors
RD
WR RD control
WR bus

Data Bus

Introduction to computer Science 37


Address Bus: - is a unidirectional bus over which digital information is transferred to
identify either a particular memory location or particular I/O address.
Data Bus: - a bus system which interconnects the CPU, memory and all the peripheral
Input / Output devices of a computer system for the purpose of exchanging data.

Control Bus: - a bus used to select and enable an area of main storage and transmit
signals required to regulate the computer operation.

Secondary Storage:- secondary storage or auxiliary storage, can take many forms, which
have traditionally included punched cards, papers tape, magnetic tape, magnetic disk and
magnetic drum.

Sequential Access Medias

Punched Cards

Punched cards are one of the oldest and most familear forms of data storage. There are
two types of punched cards, 80 – columns and 96 – columns and the first one is a
standard punched card. Using one card we can represent 80 characters.

Introduction to computer Science 38


 If only a numeric punch is in any column, it represents whatever number is punched
out.

12 punch and 11 punch and 0 punch and


1 …….. A 1 ……….J 1 …….. S
2 …….. B 2 ……….K 2 …….. T
. . .
. . .
. . .
9 ………I 9 ………..R 9 ……… Z

Punched Paper Tape

Punched paper tape is a continuos strip of paper used to store data in much the same
manner as punched cards. The paper tape is approximately one inch wide & can have
either six or eight channels. Eight channels paper tape is based on the ASCII code. This
storage media is less expensive and more compact than punched cards.

Introduction to computer Science 39


Magnetic Tapes

Magnetic tapes are a particularly popular form of secondary storage because of their high
data density (the number of bytes of instruction per inch of tape) and their convenience in
handling. Magnetic tapes are approximately one - half inch wide are made of Mylar –
based plastic film which can be magnetized. Data are stored on a magnetic tape by
running the tape over the electromagnetic called read/write head which magnetizes small
spots on the tape. Seven-track tapes store information as bytes of information, where each
byte consists of a six-bit code and a one-bit parity bit. Nine-track tape use an eight-bit
and a parity bit.

An 800 bytes per inch density of magnetic tape and has a length of 100 inch can store
80,000 bytes of information.

Random Processing Medias

Magnetic disks
Magnetic disks are metals or plastic platters coated with ferrous oxide, an easily
magnetizable material. Magnetic disks allow for random access of information and
overcome the slow access time commonly found in tape files.

Introduction to computer Science 40


Floppy disks

 Also called flexible or diskette.


 Used to store programs and data for a longer period outside the computer system.
 Often used with mini and micro computers.
 Data is stored in concentric circles called tracks.
 Each track is further divided into sectors
 A sector stores the amount of information that can be read or written in single
operation.

Track

Storage Capacity of floppy Disks.

The most widely used type of floppy disks are the 5.25 inch and the 3.5 inch floppy disks.
Each have two standard sizes.

DS/DD (360 KB) DS/DD (720 KB)

5.25 inch 3.5 inch

Introduction to computer Science 41


DS/HD (1.2 MB) DS/HD (1.44 MB)

5
2

1. Disk Hub:- is the portion of the1disk that the disk drive used to rotate the disk
2. Write protect Notch (opening):- for the 5.25 inch floppy disk when the
6
notch is
4
uncovered, the disk‟s data can be modified. When the notch is covered with a write
3
protect tab (provided with the disk) the contents of the disk can‟t be modified, which
prevents accidental file deletion (although can still be read and copied). For the 3,5 inch
floppy disk, when the opening is open (uncovered0, the contents of the disk can not be
modified, which prevents accidental file deletion( although the disk can still be read
and copied). When the opening is closed the disk‟s data can be modified and data can
be written on the disk
3. Disk jacket:- the jacket surrounding the disk protects the storage media from dust,
finger prints and scratches from other sources.
4. Read/ Write opening:- allows the read/write head inside the disk drive access to the
storage media. As the disk rotates in the disk drive, the read/write head within the drive
accesses the information contained on the disk via this opening.
5. Disk label:- is used to label the disk so as to identify the data stored on it.
6. Shutter:- a moveable metal or plastic plate that protects the disk media from dust

Rules for handling Floppy Disks

Floppy disks are magnetic devices which stores data on them. Improper handing of
floppy disks may result in loosing the data stored on the disk. It is therefore necessary to
know the following rules to protect your disks and/or your data on it from damage.

Introduction to computer Science 42


 Never place the disk near magnetic devices, keep the disk away from your
telephone since telephone boxes contain magnetic units.
 Always place disks back into their envelope when you are not using them.
 Never touch your floppy disk media.
 Never smoke near floppy disks.
 Store your floppies in a safe location.
 Keep at room temperature in the range of 10 oc to 50 oc.
 Always make a backup copy of your floppy disk.

Disk drive:- is part of a computer system which reads from and writes data on a disk.

Hard Disk

 A high capacity magnetic disk made up of metal which can be fixed in the system
unit of the computer.
 Serves as a secondary storage.
 Enables very fast accessibility of data.
 Accessing data from hard disk is faster than from floppy disks.
 The disks, which are usually grouped together into a disk pack are separated by small
air spaces to allow access for read/write head.
 Each disk has approximately 200 tracks on which information is stored. Tracks of the
small number on all adjacent disks are referred to as a cylinder of that disk.
 The disk pack is mounted on a magnetic disk drive which rotates the disk at speed up
to 1,000 revolutions per second.
Cross section of a disk pack
 The total collection of tracks available on one movement of the access mechanism is
known as cylinder.
 The amount of time it takes to retrieve (or store) data from (or to) disk is called the
disk access time.

Introduction to computer Science 43


4.2. Computer Software

The computer hardware is an electronic device which has the potential of performing the
task of solving a problem. However one has to give precise instructions to the hardware
in order to solve problem.

The finite set of instructions (steps) that the computer follow to perform a given job is
called a program.

Any program to be executed first it should reside / loaded/ in the memory.

Software:- is a collection of programs and routines that support the operations of


performing a task using a computer. Software also includes documentations, rules and
operational procedures. Software makes the interface between the user and the electronic
components of the computer.

USER
Software
Hardware

Computer software is classified into two


1. System software
2. Application software
4.2.1. System software

 Constitutes those programs which facilitates the work of the computer hardware.
 It organizes and manages the machine‟s resources, handles the input/output devices.
 It controls the hardware by performing functions that users shouldn‟t have to or are
unable to handle.
 System programs make complex hardware more user friendly.

Introduction to computer Science 44


 It acts as intermediate between the user and the hardware.
 It enables the computer understand programming languages i.e. it serves as means of
communication between user and a computer.

The important categories of system software are:


a). Operating system
b). Language software

a). Operating system

Operating system coordinates the activity between the user and the computer. An
operating system has three major functions.

i. Controlling operations (control program )

 Coordinates, or supervises the activity of the computer system.


 Decides where programs and data should be stored in the computer memory.
 Handles communications among the computer components, applications software and
the user.
 Controls the saving and retrieving of files to and from disks in the disk drive.
 It performs all its controlling tasks with out the involvement or awareness of the user.

ii. Input/output Management

 The I/O manager coordinates the computers communication with outside world, flow
of data to the display screen and other output devices (printers/ plotters) and from the key
board or other input devices.
 Handles the flow of data to and from the disk drives (file management).
 Handles the process of preparing a disk for use, the copying, renaming, erasing task
of a file.

Introduction to computer Science 45


iii. Command Processing ( command Interpreter)

 It interprets the commands or what you enter using the keyboard or other input
devices.
 If you write an internal command it carries out the function of that command if it is
external command or other executable file it searches for the corresponding file in the
default (current disk) or the user specified disk, loads the file into memory and transfers
control to that program. Once this program is terminated, control returns to
[Link] and the program for that command or file is discarded from memory.

Types of Operating Systems

Operating systems can be classified by:

 The number of programs they can handle at a time and


 The number of users they serve at once at one or different stations (i.e. terminals or
micro-computers connected to a central computer).

i. Single tasking operating systems

 With single tasking operating systems only one program can be run on a computer at
a time.
 In order to run another program, one must remove the first program loaded in the
computers main memory and load the other one(i.e. it can‟t handle two or more
programs at a time)
 These types of operating systems are single user or can serve only one user at a time.

ii. Multi user operating system

 It supports a number of work stations connected to a central system.


 A number of users can use the resources of one high capacity computer by the help of

Introduction to computer Science 46


terminals.
iii. Real Time Operating System

 A real time is a system that is capable of processing data so quickly that the results
are available to influence the activity currently taking place.

Example: - Air plane seat reservations and computer controlled plant.


- Its primary characteristics is that it responds to an event within a well
defined time.

B). Language Software.

- Are software which are used by programmers to develop application


softwares and translate programs to machine code.
- Language software is a generic name consisting of various programs that
serve as editors & translators to develop programs in a number of
programming languages.
- Includes:- Translators, general purpose routines and utilities & high level
languages
 Translator:- is a program that converts one or more languages to another
language. Three types of translators are assemblers, Compilers &
interpreters.
 Assemblers:- is a program that translates assembly languages into
machine code.
 Compiler:- is a program that translates a high level language into
machine code. (Pascal, Fortran Cobol)
 Interpreter:- is a program that translates each instruction of high level
language & executes the instruction before translating the next
instruction.
 The general-purpose routine and utilities include programs which are
used to handle file processing, editing and debugging.

Introduction to computer Science 47


 High level language software are software which have their own
compilers to detect syntax errors of the users program code.
Example Cobol, Fortran, Pascal. Etc.

4.2.2 Application Software

 Is a software that is designed to perform tasks for the specific area or areas. But for
use in more than one installation.
 Are usually called application packages as they may include a number of programs
along with operating instruction, documentation and so forth.
 Depending on their function or task they are categorized in to the following.

1. Word Processors/ Word processing


- is a computerized typewriter which permits the electronic creation, editing,
formatting, filing and printing text.
- Is the most common application of microcomputers.
- Until recently, word processing could be done only dedicated word
processors. A dedicated word processor is a computer that denies its users
the opportunity to execute any other program.

Example: WordStar, WordPerfect, Microsoft word


2. Spreadsheet
- is an electronic worksheet display on the VDU.
- Until recently, financial analysis and other mathematical calculation were
done by entering numbers on pages of an accountants ruled ledger pad.
- You can quickly create a model of a situation on a spreadsheet by entering
labels, numbers & formulas.
- Using the programs built-in function you can perform complicated
calculations such as net percent value, internal rates of return, and monthly
payments on a loan.

Introduction to computer Science 48


Example: Lotus 1-2-3, Microsoft Excel, Quatropro

3. Database management system.

- Allow you to store information on a computer, retrieve it when you need it


and update it when necessary.
- You can do this with index cards, but database management programs do
them more quickly and easily.
- Example: You can store large mailing list, inventory record or billing
and collect information in lists stored in files and manipulate this
information, one file at a time with database management program.
- You can record or create a database about employee information as

Name sex Marital status salary Date of Birth


Date of employment Post Department Level of education
Field of study etc.

Then you can ask the computer the following question


- How many female workers are there?
- List employees with a salary of birr 500 and above
- List those employees who are department head and have Bachelor
degree or higher and so on.
Example: Dbase IV, FoxPro, Microsoft Access.

Processing Power of Computers

The potential and capacity of a computer is measured by different parameters. Some of


these parameters are:

a. Capacity of the computer

Introduction to computer Science 49


 Processing speed of the processors:- Processing speed is measured in Hertz, a unit
used in the definition of frequency.

20 Hz = 2o cycles per second


1 KHz = 1000 cycles per second
1 MHz = 1 million cycles per second
1 GHz = 1 billion cycles per second
b. Primary memory storage capacity and its speed or access time (the time it took to
read a data or write a data
c. Secondary storage devices capacity and their access time
d. The efficiency and capability of the programs used.

The processors
 In large computers like mainframe and mini computers, the processor is often called a
Central Processing Unit (CPU).
 In mini computer or personal computer the processor is sometimes called
Microprocessor or just processor
 A microprocessor is a semiconductor device consisting mostly one software
controlled LSI chip which performs the functions of automatic data processing.
 Processors are not optimized to perform complex numerical calculations and other
special tasks (graphics manipulations). For this purpose specialized coprocessors which
are also called math-coprocessors have been developed to increase the processing
capability of a computer and speed up complex mathematical floating-point calculations
 The coprocessors operate in parallel with CPUs.
Examples are: 8087, 80287, 80387 and 80487

Family of processors
 The first processor, Intel 4004, a 4-bit microprocessor, was introduced in 1971 by
Intel Company.
 An 8-bit microprocessors were introduced by a number of companies:
- The Motorola‟s Mc 6809 Microprocessors

Introduction to computer Science 50


- The Zilog‟s Z80 and Z800 Microprocessors
- The Mos Technology‟s 6500 series Microprocessors
- The National Semiconductor‟s NSC 800 Microprocessors etc.

Processors of the Intel 86 family


 The ancestors of the 86 family are: the 4000, 8008, 8080A and 8085 A
microprocessors.
 Computers store and manipulate information as bits.
 We can characterize a processor by saying how many bits it can work with at a time
and how many bits it can send or receive at a time.
Intel Microprocessors
Microprocessor Word length Clock frequency
8086 16-bit 5-10 MHz
8088 8/16-bit 5-8 MHz
80186/186 16-bit 6-8 MHz
80188 8/16-bit 6-8 MHz
80286/286 16-bit 6-12.5 MHz
80386dx/386dx 32-bit 20-33 MHz
80386sx/386sx 16/32-bit 20 MHz
80486/486 32-bit 25-66 MHz
(80486Dx, 80486SX)
Pentium 64-bit 180 MHz

Motorola Microprocessors
Microprocessor Word length Clock frequency
6800 8-bit 1 MHz
6809 8-bit 4-8 MHz
68000 16/32 bit 10-25 MHz
68020 32-bit 12.5-33 MHz
68030 32-bit 20-33 MHz

Introduction to computer Science 51


Chapter Four

2 Data representation method


Objectives:
 To understand how really data represented, flow, stored and processed
inside the computer.
 To know the different coding systems & unit of data representation.

We enter data into a computer or review (see) output data from a computer using the
letter of alphabet, various special symbols, and the numerals in the decimal number
system. But since computer is an electronic device, which understands electrical flow
(signal) there is no letter, symbol or number inside the computer. Computer works with
binary numbers. As a semiconductor is conducting or isn‟t conducting; a switch is closed
or opened.
So data are represented in the form of a code that can have a corresponding electrical
signal.
2.1 Number System

A number system is a set of symbols used for counting


There are various number systems
Ex. Decimal, Binary, octal-decimal, hexadecimal etc.

For the purpose of understanding how data are represented, stored and processed in
computer, we will discuss only two of them, the Decimal and the binary number system.

2.1.1 The Decimal Number System

The Decimal number system is based on the ten different digits (or symbols)
0,1,2,3,4,5,6,7,8,9.
We say it is a base ten number system

Introduction to computer Science 52


Though it is widely used, it is inconvenient for computer to represent data. So we need
another number system.

2.1.2 The Binary number system

Binary number system is based on the two different digits; 0 and 1;


It is important to note that every decimal number system has its equivalent binary
number;
Conversion from binary to its equivalent decimal and from decimal to its equivalent
binary is possible;
Operation on binary number system is also possible

[Link] Binary Decimal [Link] Binary Decimal


0 0 101 5
1 1 110 6
10 2 111 7
11 3 1000 8
100 4 1001 9 etc.

The most elementary form to organize data within a computer (an electronic device) is in
the form of a code which utilizes the “ON” and “OFF” states of electric switches or there
is “current” and “no current” condition of the electronic components;
We see that the nature of the electronic devices has similarity with the binary number
system in that both represent only two elementary states;
It is therefore convenient to use binary number system to represent data in a computer;
An “ON” corresponds to a 1; An “OFF” corresponds to a 0;
In the computer “ON” is represented by the existence of a current and “OFF” is
represented by non existence of current
On a magnetic disk, the same information is stored by changing the polarity of
magnetized particles on the disk‟s surface.

Introduction to computer Science 53


2.2 CODING METHODS

It is possible to represent any of the character in our language in a way as a series of


electrical switches in arranged manner;
These switch arrangements can therefore be coded as a series of equivalent arrangements
of bits

There are different coding systems, that convert one or more character sets into computer
codes. Some are: EBCDIC, BCD, ASCII-7 & ASCII-8.

In all cases, binary coding schemes separate the characters, known as character set, in to
zones. Zone groups characters together so as to make the coding scheme to decipher and
the data easier to process. With in each zone, the individual characters are identified by
digit code.

EBCDIC: Pronounced as “Eb-see-dick” and stands for Extended Binary Coded Decimal
Interchange Code.
Used usually for IBM Main frame model and in similar machines produced by other
manufacturer.

It is an 8-bit coding scheme: (00000000 – 11111111)


It accommodates to code 28 or 256 different characters
It is a standard coding scheme for the large computers.

Coding Examples A-I 12 1-9


J-R 13 1-9
S-Z 14 2-9
[Link] EBCDIC
[Link] CharacterZone Digit
Character zone (4 Bit) digit (4 Bit)
0-9 15 0-9 a 1000 0001
a-i 8 1-9 b 1000 0010
j-r 9 1-9 A 1100 0001
s-z 10 2-9 B 1100 0010

Introduction to computer Science 54


0 1111 0000
9 1111 1001

BCD (Binary Coded Decimal)


There was two types of BCD coding techniques used before. The 4 bit BCD, which
represent any digit of decimal number by four bits of binary numbers.
If you want to represent 219 using 4 bit BCD you have to say 0010 0001 1001
 4 bits BCD numbers are useful whenever decimal information is transferred into or
out of a digital system. Examples of BCD systems are electronic ousters, digital
voltmeter, and digital clocks; their circuits can work with BCD numbers.
 BCD‟s are easy for conversion but slower for processing than binary. And they have
limited numbers because with BCD we can represent only numbers 0000 for 0 and
100 for 9 and ,1010,1011,1100,1101,1110, 1111 can‟t be used because 1010 represent
10 in decimal at 10 in decimal is 1010 0000 in BCD.

BCD (6-bits)

It uses 6-bits to code a Character (2 for zone bit and 4 for digit bit) it can represent 2 6 =
64 characters (10 digits, 26 capital characters and some other special characters).

3 Some Coding Examples A 11 0001


Character zone (2 Bit) digit(4 Bit) Q 10 1000
0-9 0 0-9 8 00 1000
A-I 3 1-9 9 00 1001
4
Character Zone digits

5 ASCII-7

ASCII stands for American Standard Code for Information Interchange.


Used widely before the introduction of ASCII-8 (the Extended ASCII)
Uses 7 bits to represent a character;

Introduction to computer Science 55


With the seven bits, 27( or 128) different characters can be coded (0000000-1111111)
It has 3 zone and 4 digit bits positions
Coding examples: $ 010 0100
Characterzone (3 bit) digit(4 bit) % 010 0101
0-9 3 0-9 A 100 0001
A-O 4 1-15 a 110 0001
P-Z 5 1-10 b 110 0010

[Link].1 The ASCII System

Also referred as ASCII-8 or Extended ASCII


It is the most widely used type of coding scheme for Micro Computer system
ASCII uses 8-bits to represent alphanumeric characters(letters, digits and special
symbols).
With the 8-bits, ASCII can represent 28 or 256 different characters(00000000-11111111).

6 Coding Examples 1 0011 0001


Character zone (3 BIT) digit (4 BIT)
0-9 3 0-9
A-O 4 1-15
P-Z 5 0-10
a-o 6 1-15
p-z 7 0-10

a 0110 0001
b 0110 0010
A 0100 0001
B 0100 0010
? 0011 1111
+ 0010 1011

Introduction to computer Science 56


7 UNITS OF DATA REPRESENTATION
When data is stored, processed or communicated within the computer system, it is packed
in units;
Arranged from the smallest to the largest, the units are called bit, byte and word;
These units are based on the binary number system;

8 BIT
 Bits are the smallest units and can convey only two possible states 0 or 1;
 Bit stands for binary digits;
 A bit is a single element in the computer, on a disk that stands for either “ON”
indicating 1 or “OFF” indicating 0;
In the computer “ON” is represented by the existence of current and “OFF” is represented
by the non-existence of current
On a magnetic disk, the same information is stored by changing the polarity or
magnetized particles on the disk‟s surface;

9 BYTE
Bits can be organized into large units to make them represent more and meaningful
information;
This large unit is called a byte and is the basic “unit of data representation” in a computer
system;
The commonly used byte contains 8 bits;
Since each bit has two states and there are 8 bits in a byte, the total amount of data that
can be represented is 28 or 256 possible combinations;
Each byte can represent a character (a character is either a letter, a number or a special
symbol such as +,-,?,*, $, etc
A byte is then used as a unit of measurement in the computer memory, processing unit,
external storage and during communication;
If the computer memory is 524288 byte, this is expressed in short by saying 512KB,
where KB stands for kilobyte.
1 Kilobyte (1KB) is 210 or 1024 bytes

Introduction to computer Science 57


1 Megabyte (MB) is 220 bytes or 210 kilobytes
1 Gigabyte (GB) is 230 bytes or 220 kilobytes or 210 megabytes

10 WORD
Word refers the number of bits that a computer process at a time or a transmission media
transmits at a time
Although bytes can store or transmit information, the process can even be faster if more
than one byte is processed at a once;
A combination of bytes, then form a “word”
A word can contain one, two, three or four bytes based on the capacity of the computer;
Word length is usually given in bits
We say that a computer is an 8-bits, a 16 bit, a 32 bit or a 64 bit computer to indicate that
the amount of data it can process at a time;
The large the word length a computer has the more powerful and faster it is.

Introduction to computer Science 58


Chapter Five
11 Computer Arithmetic

Objective:- To know different number systems


To know how to convert from one base to another
To know how to apply arithmetic operators on binary number system
11.1 . Number systems
There are different number systems. Some of are:
 Decimal number systems  Octal number systems
 Binary number systems  Hexadecimal number systems

We have seen the binary and decimal number system in the previous chapter, so we will
discuss the next two in this chapter.

11.1.1 Octal number System (base 8) (Oct)


 It uses 8 symbols 0-7 to represent numbers;
 Like binary number system it is complete number system.

Example 77 in octal equals 49 in decimal and 111111 in binary.

When we compare the octal with the decimal, 0-7 in octal is the same as 0-7 in decimal
but 10 in octal is not the same as 10 in decimal because 10 in octal holds the position of
8 in decimal, off course 10 in octal is the same as 8 in decimal.

11.1.2 Hexadecimal number system (16) (hex)


 It uses 16 symbols to represent numbers. But for the numbers greater than 15
they represented in terms of the 16 symbols. for example the decimal number 16
represented as 10, 20 as 14, 30 as 1E and so on. These symbols are
0,1,…9,A,B,C,D,E,F

Introduction to computer Science 59


 When we compare the hexadecimal with decimal, 0-9 in hexadecimal is the same as
0-9 in decimal but 10 in hexadecimal is not the same as 10 in decimal, off course 10
in hexadecimal is equal to 16 in decimal because it holds the position of 16 in
decimal.

Example
DECIMAL OCTAL BINARY HEXADECIMAL
0 0 0 0
3 3 11 3
8 10 1000 8
10 12 1010 A
16 20 10000 10

11.2 Conversion from one Base to Another


The values that numbers have with a given number systems are largely determined by
their positional notation. Positional notation means that the position of one symbol
relative to other symbols in a given number system determines the value of that symbol.
For example, the symbols 1 & 7 can represent either 17 or 71 depending upon their
relative position to one another.
The decimal number 135 may be expanded as:
(135) 10 = 1*102+3*101+5*100
 The subscript 10 is used to indicate 135 is in base 10 number system.
 The number 10 in binary is not the same as 10 in decimal because the value of 1 in
the binary is not the same as the value of the 1 in the decimal.
 The binary number 1101 may be expanded as
(1101)2 =1*23+1*22+0*21+1*20 = 8+4+0+1
= (1*8)+(1*4)+(0*2)+(1*1) = 1310
*A number X1 X2 X3 …Xn in base M can be expanded as
(X0 X1 X2 X3 …..Xn)M=X0*mn-1+X1*mn-2X2*mn-3+ …Xd-1*m1+Xnm0 in base
10

Introduction to computer Science 60


11.2.1 Conversion from decimal (base 10) to other base (base M)
(Base 10……….Base M)
To convert a decimal number X to a number in base m, divide X by m, store the
remainder, again divide the quotient by M, store the remainder, and continue until the
quotient is 0. And concatenate (collect) the remainders starting from the last up to the
first.
Ex.1 Convert 5610 to base two (binary) EX. 3. Convert 3010 to base sixteen
X=56 M=2 (hexadecimal)
5610 =1110002 3010=1E16
EX.2 Convert 7810 to base eight (Octal) Convert 1610 to base sixteen
7810=1168 (hexadecimal)
1610=A016

11.2.2 Conversion from base M to base 10 (decimal)


To convert a number X consists of digits X1 X2 X3 …Xn in base m to decimal; simply
expand the number with base M. That is
(X1X2X3…Xn) m =X1*mn-1+X2*mn-2 +X3*mn-3+...+ Xi*mn-i+… Xn-1m1+Xn*m0
=Y10
Example 1. Convert (1001001)2 to 3. convert (101)8 to decimal
decimal =65
=73 4. convert (A1B) 16 to decimal
2. convert (234)8 to decimal = 2587
=156 5. covert (101)16 to decimal
=257

11.2.3 .Conversion from binary (base2) to Octal (base 8) or


hexadecimal (base16) and vice versa
To convert a number in binary to octal group three binary digits together starting from
the last digit (right) and if there are no enough digits add zeros to the front end (left)
and find the corresponding Octal of each group.

Introduction to computer Science 61


Example. Convert 1001001 to octal Convert 101101001 to octal
1001001=001,001,001 101101001 =101,101,001
= 1118 =5518

To convert binary to hexadecimal group four binary digits together starting from right
and if there are no enough digits add zeros at the left.
EX. Convert 111100100 to hexadecimal Convert 111001111 to Hexadecimal
111100100 =0001 1110 0100 111001111 =0001 1100 1111
=1 14 4 =1 12 15
=1 E 4 =1 B F
= 1E416 =(1BF)16
To convert from Octal to binary, convert each octal digit to its equivalent 3 bit binary
starting from right.
EX. Convert (675) eight to binary Convert 231eight to binary

675eight =110 111 101 231eight = 010 011 001

=110111101two =10011001two

To convert from Hexadecimal to binary convert each hex. Digit to its equivalent 4-bit
binary starting from right.
Ex. Convert 23416 to binary Convert 2AC to binary
23416 =0010 0011 0100 2AC16 =0010 1010 1100
= 10001101002 =10101011002

11.2.4 Conversion from Octal to hexadecimal and Vise versa


To convert from Octal to hexadecimal, first we have to convert to binary and the binary
to hexadecimal. To convert from hexadecimal to Octal, first we have to convert to binary
and then the binary to Octal.

EX.1. Convert 2358 to hexadecimal = 0 9 13


2388=010 011 101 =9D16
=0000 1001 1101 Convert 1A to Octal

Introduction to computer Science 62


1A=0001 1010 =0 3 2
=000 011 010 =328

11.2.5 Summary of conversion from One base to another base


From base To base Method
2 10 Expand binary number in powers of 2
10 2 Factor the decimal number by 2
2 8 Group 3 binary digits together
8 2 Each Octal digit is converted to 3 binary digits
2 16 Group 4 binary digits together
16 2 Each hexadecimal digit is converted to 4 binary digits
8 10 Go from 8…….2…….10
10 8 Go from 10 … ..2……..8
16 10 Go from 16 …….2…….10
10 16 Go from 10 …….2…….16
8 16 Go from 8 …….2…….16
16 8 Go from 16 …….2…….8

11.2.6 Converting decimal number with fractions to Binary.

 First change the integer part to its equivalent binary.


 Multiply the fractional part by 2 and take out the integer value, and again multiply the
fractional part of the result by 2 and take out the integer part, continue this until the
product is 0.
 Collect the integer values from top to bottom & concatenate with the integer part.

Ex. A) Convert 12.2510 to binary 1100.01


B) Convert3.1875 to binary 11.0011

Introduction to computer Science 63


11.2.7 Converting Binary with fraction to decimal.
To convert a binary number Y1Y2Y3Y4Yn.d1d2d3..dm to decimal first convert the integer
part to decimal by using
y1 y2 y3 y4…yn=y1*2n-1+y2*2n-2+….yj*2n-j+….+yn-1*21+yn*20=Q and convert the
fractional part to decimal by using
d1d2d3…dm=d1*2-1+d2*2-2+d3*2-3+…+dj*2-j+..+dm*2-m=R
then decimal equivalence of y1 y2 y3 y4…..yn.d1d2…dm will be Q+R where Q is the
integer part and R is the fractional part.

Ex1 : Convert 11001-0101 to decimal Ex 2: Convert 1000.1 to decimal


11001 = 1x24 + 1x23 1000 = 1+23 +0+0+0=8
+0x22+0x21+1x20= 16+8+1= 25= Q 1= 1x2-1=½ = 0.5
0101 =0x2-1+1x2-2+0x2-3+1x2-4 1000.1 = 8.510
= 0+¼+0+1/16 = 0.3125 = R
=>11001.0101 = 25.3125.

Introduction to computer Science 64


11.2.8 Conversion from Binary with fraction to
Octal/hexadecimal

 Group three/four digits together starting from the last digit of the integer part, and if
there is less number of digits add some zeros in the beginning.
 Group three/ four digits together starting from the first digit of the fractional part, and
if there is less number of digits add some zeros to the end.
 Covert each group of the integer and the fractional part to their equivalent
Octal/hexadecimal and collect the results by adding point (.) to separate the integer part
from the fractional part.
Ex 1:- Covert 1010.01112 to octal
Ex2:- Covert 1110101.101112 to hexadecimal

11.2.9 Conversion from Octal or hexadecimal with fraction to


binary.
 Convert each Octal/hexadecimal digit to its equivalent 3/4-bit binary digit.
 Collect the binary sequences by separating the integer part binaries from the
fractional part binaries with point (.)

11.2.10 Conversion from Octal with fraction to hexadecimal


 To convert from Octal to hexadecimal, first convert the Octal to binary and then the
binary to hexadecimal

11.2.11 Conversion from Hexadecimal with fraction to octal


 To convert from hexadecimal to Octal, first convert the hexadecimal to binary and
then the binary to Octal.

11.2.12 Conversion from octal/hexadecimal with fraction to


decimal.

65
 To convert from Octal/hexadecimal to decimal, first convert to binary and –then the
binary to decimal.
Remark: -
 BCD numbers are useful whenever decimal information is transferred into or out of a
digital system. Examples of BCD systems are electronic ousters, digital voltmeter, and
digital clocks; their circuits can work with BCD numbers.

 BCD‟s are easy for conversion but slower for processing than binary. And they have
limited numbers because with BCD we can represent only numbers 0000 for 0 and 100
for 9 and ,1010,1011,1100,1101,1110, 1111 can‟t be used because 1010 represent 10 in
decimal at 10 in decimal is 1010 0000 in BCD.
 Hexadecimals are used for computation and memory addressing.
11.3 Binary Arithmetic
Computer understands only the language of binary numbers. Therefore, the machine
performs what is called binary arithmetic (binary computation).

11.3.1 Binary addition

Binary addition operates by the same rule as decimal addition, except that it is simpler. A
carry to the next higher order (or more significant) position occurs when the sum is
decimal 2, that is, binary 10. Therefore, the binary addition rules may be written as
follows:
0+0=0
0+1=1
1+0=1
1+1=0 plus a carry of 1 into the next position
1+1+1=1 plus a carry of 1 into the next position.

The last case occurs when the two binary digits in a certain position are 1s and there is a
carry from the previous position.
Example1:
6+7 =13

66
110+111=1101
Example2
19+31+10=60
10011 +11111+1010=111100

11.3.2 Binary Subtraction


It operates by the same rule as decimal subtraction. The rule is as follows;
0-0=0
1-0=1
1-1=0
10-1=1
Example:
11100 28 101101 45 11001.011
- 11010 -26 - 111 -7 - 111.110
00010 =2 101100 =38 10001.101

11.3.3 Binary Multiplication:


- It is a very simple process that operates by the following obvious rulers:
(a) Multiplying any number by 1 rules the multiplicand unchanged
0x1=0
1x1=1

(b) Multiplying any number by 0 produces 0


0x0=0
1x0=0
Ex1

11.3.4 Binary division

That is, the process for dividing one binary number (the dividend) by another (the
divisor) is based on the rules for binary subtraction and multiplication and Similar to
decimal division

67
Ex 1111101 11001
11001 101
11001
11001
00000
1111101 ÷ 11001 = 101
11.4 Representation of Negative numbers

There are different ways of representing negative numbers in a computer.

I. Sign- magnitude representation.

In signed binary representation, the left-most bit is used to indicate the sign of the
number. Traditionally, 0 is used to denote a positive number and 1 is used to denote a
negative number. But the magnitude part will be the same for the negative and positive
values. For example 11111111 represents-127 while, 01111111 represents + 127. We
can now represent positive and negative numbers, but we have reduced the maximum
magnitude of these numbers to 127.

In a 5- bit representation we use the first bit for sign and the remaining 4- bits for the
magnitude. So using this 5 bit representation the range of number that can be represented
is from -15 (11111) to 15(01111)

Ex1 represent-12 using 5-bi sign magnitude representation


- first we convert 12 to binary i. e 1100
Now -12 = 11100
Ex2 Represent –24 using 8-bits
24=00011000
-24 = 1001100
In general for n-bit sign –magnitude representation the range of values that can be
represented are –(2 n-1-1 ) to (2 n-1-1).

68
i.e. 2 n-1 + 1 to 2 n-1 –1

Note:
In sign magnitude representation zero can be represented as 0 or -0

This representation has two problems one is it reduces the maximum size of magnitude,
and the second one is speed efficiency to perform arithmetic and other operations.
For sign magnitude representation, correct addition and subtraction are relatively
complex, involving the comparison of signs and relative magnitude of the two numbers.

The solution to this problem is called the two‟s complement representation.

11.4.1 One’s complement.


In one‟s complement representation, all positive integers are represented in their correct
binary format. For example +3 is represented as usual by 00000011. However, its
complement, -3, is obtained by complementing every bit in the original representation.
Each 0 is transformed into a1 and each 1 into a0. In our example, the one‟s complement
representation of -3 is 11111100.

Ex: +2 is 00000010
-2 is 11111101

Note that in this representation positive numbers start with a 0 on the left, and negative
numbers start with a 1 on the left most bit.
Ex1. add –3 and 3 with word size 4
3 = 0011
-3=1100
sum =1111 (=0)
Ex2. Add -4 and +6
- 4 is 11111011
+ 6 is 00000110
the sum is (1) 00000001 the one in the parenthesis is the external carry.

Where 1 indicates a carry. The correct result should be 2 or 00000010.

69
In one‟s complement addition and subtraction, if there is an external carry it should be
added to get the correct result. This indicates it requires additional circuitry for
implementing this operation.

11.4.2 Two’s Complement Representation

In two‟s complement representation, positive numbers are represented, as usual, in singed


binary, just like in one‟s complement. The difference lies in the representation of
negative numbers. A negative number represented in two‟s complement is obtained by
first computing the one‟s complement and then add one.

Ex: +3 is represented in signed binary as 00000011


Its one‟s complement representation is 11111100.
The two‟s complement is obtained by adding one.
It is 11111101.
Ex let‟s try addition.
(3) 00000011
+ (5) +00000101
(8) 0001000
The result is correct
Ex2. Let‟s try subtraction
(3) 00000011
(-5) + 111111011
11111110
Ex2 add +4 and -3(the subtraction is performed by adding the two‟s complement).
+4 is 00000100
-3 is 111111101
The result is [1] 000000001

If we ignore the external carry the result is 00000001 ( i. e 1 In decimal). This is the
correct result. In two‟s complement, it is possible to add or subtract signed numbers,
regardless of the sign. Using the usual rules of binary addition, the result comes out
correct, including the sign. The carry is ignored. One‟s complement may be used, but if

70
one‟s complement is used, special circuitry is required to “ correct the result”.

Carry and overflow


Ex (128) 10000000
+(129) 10000001
[257] =(1) 00000001

Where 1 indicates a carry. The result requires a ninth bit (bit 8, since the right- most bit
is 0). It is the carry bit.

The two‟s complement representation has one anomaly not found with sign magnitude or
one‟s complement. The bit pattern 1 followed by N-1 zeros is its own 2‟s complement.
N
To maintain sign bit consistency, this bit pattern is assigned the value –2 for example,
for 8-bit word,
-128 = 10000000
its 1‟s complement =01111111
+1
=100000000 = -128

Overflow will occur in four situations, including: -


1/ The addition of large positive numbers.
2/ The addition of large negative numbers.
3/ The subtraction of a large positive number from a large negative numbers.
4/ The subtraction of a large negative number from a large positive number.

Overflow indicates that the result of an addition or subtraction requires more bits than are
available in the standard 8-bit register used to contain the result.

Fixed format representation: We now know how to represent signed integers: however,
we have not yet resolved the problem of magnitude. If we want to represent large
integers, we will need several bytes. In order to perform arithmetic operations efficiently,
it is necessary to use a fixed number of bytes, rather than a variable number. Therefore,
once the number of bytes is chosen, the maximum magnitude of the number that can be
represented is fixed.

71
11.5 Subtraction by use of complements.

 Complements are mainly used for representing negative numbers and subtraction.
 In performing binary subtraction or addition of negative number by use of binary
complements only one procedure, addition, is needed as one can subtract by adding its
complements.
 To subtract any number, positive or negative, substitute the required complement for
the numbers to be subtracted and then add.
If the result is
An ( n+1)-bit number, and the arithmetic is in
Ones complement the (n+1) th bit, a carry, is added to the right most bit of the result.
This process is called an end-around carry.
Two‟s complement discard the (n+1) th bit.

An n-bit number and the arithmetic is in


Ones complement, to read the binary value calculate the ones complement of the
magnitude bits and place a minus sign front of it.
Two‟s complement, to read the binary value calculate the two‟s complement of the
magnitude bits and place a minus sign in front of it.
Example:
Perform the following in ones and two‟s complements in 5-bits.
A. 12-6
B. 6-12
C. -12-6
A= 12 B=6, A=01100 B=00110
Ones complement of -A=10011 & -B=11001
Two‟s complement of - A= 10100 & -B= 11010
Example C:
Is wrong this is because the occurrence of overflow. Arithmetic overflow is
that part of the result of an operation which is lost because of the resulting value
exceeds the capacity of the intended storage location.

* Arithmetic overflow occurs when the sign bits of A and B are the same but the sign

bit of the result is different.

72
11.6 Floating-Point Representation

In this representation decimal numbers are represented with a fixed length format. In
order not to waste bits, the representation will normalize all the numbers. For example,
0.000123 wastes three zeroes on the left before non -zero digits. These zeroes have no
meaning except to indicate the position of the Decimal point. Normalizing this number
-3
result in .123x10 .123 is the normalized mantissa; -3 is the exponent. We have

normalized this by eliminating all the meaningless zeroes to the left of the first non-zero
digit and by adjusting the exponent.

Ex1: 22.1 is normalized as .221x102.

E
The general form of floating point representation is Mx10 where M is the mantissa,
and E is the exponent. It can be seen that a normalized number is characterized by a
mantissa less than 1 and greater than or equal to.1 all cases when the number is not zero.

To represent floating numbers in the computer system it should be normalized after


converting to binary number representation system.

Ex2 111.01 is normalized as .11101x23.

The mantissa is 11101. The exponent is 3.


The general structure of floating point is

Sign Exponent Mantissa (significand)

In representing a number in floating point we use 1 bit for sing, some bits for exponent
and the remaining bit for mantissa.

73
In floating point representation the exponent is represented by a biased exponent
(Characteristics).

n-1
Biased exponent = true exponent + excess 2 , where n is the number of bits reserved for

the exponent.

Ex1.
Represent –236.375 in floating point using 7 bit for exponent and 16 bit for mantissa.
First we have to change to normalized binary
i. e 234 = 11100010
0.375= 0.011
234.375 = 11100010.011 = 0.11100010011x28
true exponent = 8
excess 2 n-1 = 2 7-1= 26= 64
Biased exponent = 8+26 8+64 = 72
= 100 1000 2
Therefore –234.375 is represented as
1 1001000 1110001001100000

Sign 7-bits 16 bits

Ex2. Represent 34.25 in floating point using 7 bit for exponent and 24 bits
for mantissa.
34.25 = 1000 10.0 12
The normalized form of 34.25 = .10001001x 26
n-1 7-1 6
True exponent = 62 =2 = 6+2

=6+64=70

70 = 10001102

Therefore, 34.25 is represented as

74
0 1000110 100010010000…..
0

Floating point overflows


If there are 1 bit for the sign, N bit for the exponent and M bit for the mantissa
(significand) we can represent numbers as shown bellow.
N-1
Let n=2

-M
-(1-2 )x2n-1 -0.5x2
-n
0.5x2
-n
(1-2
-M
) x2n-1

To represent a number in floating point:


 Represent the number in normalized binary form.
 Find the biased exponent
 Change the biased exponent to binary
 Write the sing, the exponent in the exponent part and the mantissa in the mantissa part
 If there are fewer digits in the exponent add zeros to the left and for mantissa add
zeros to the right.

11.6.1 Floating-point Arithmetic


To perform floating-point arithmetic:
 First correct the numbers to binary with the same exponent (the highest)
 Apply the operator on the mantissa and take one of the exponent
 Normalize the result

Ex1. Find 23.375+ 41.25 using 7-bit for exponent and 10 bit for mantissa.

5 6
23.375 = 10111.011 = 0.1011101x2 = 0.010111011x2

75
41.25 = 111001.01 = 0.11100101x26

23.37+41.25 = 0.01011101x26+0.1110010x26
= (0.010111011+0.11100101)x26
= 0.1010000101x26

76
Chapter 6
12 Computer System Architecture
Objective:-
 To know the different layers of a computer system
 To know the basic building blocks of computer and how they work.

12.1 Hierarchical structuring of a computer system Architecture

Actually a computer system composed of many layers of software and hardware. But
for simplicity we see the computer in Abstract way. This avoids details and makes the
user to concern about the outer layer that is easy for the user to communicate with the
computer.
Generally modern computers consist of multi-layers or levels. The following figure
shows the different levels.

Language depends on application program


7 Application level
Hide operational details of lower levels
Machine-independent programming language
6 High-order languages level Program can transfer from one to another comp. easily
Software
level 5 Assembly language
Assembly level

4 Operating system level


Masks details of hardware from programmer and
responsible for program creation, execution,
access to I/O and access to a file
Machine level
3 Machine language

Micro programming level Basic hardware component


2 construction and their interaction
Hardware
part Logic gate level
1 Basic component for microprogramming

0 Device level Transistors, capacitors & resistors

[Link] level structure of a typical computer system.

77
12.2 Logic gates(elements)

In the hierarchical structuring of a computer the logic gate level is above the device level.
These logical elements are primary components of the computer hardware. Given a
desired function, Boolean algebra can be applied to develop a simplified implementation
of that function using interconnection of logical gates.
A gate is an electronic circuit that produces an output signal that is a simple Boolean
operation on its input signals. The basic gates used in digital logic are AND, OR, NOT,
NAND, and NOR. We ha also XOR gate for defining Boolean algebra with other gates.
Each gate is defined in three ways: graphical symbols, algebraic notation, and truth table.
A truth table is a table that shows the output of a logical function for all possible
combinations of input values.
Each gates has one/two or more inputs and only one-output signals. The signals are either
0 or 1. When the values at the input are changed, the correct output signal appear almost
instantaneously, delayed by the propagation time of signals through the gate (known as
gate delay)
It is a mathematical abstraction of a physical device that we can boiled to perform the
function of a truth table
Gate Name Graphical symbol Algebraic notation Truth table
NOT (inverter)
X X
X 1 0
0 1
OR X+Y

AND
X.Y or XY
NAND
X.Y
=NOT(AND)

NOR
X+Y
=NOT(OR)
XOR (Exclusive OR)
X +Y

78
Typically, not all gate are used in implementation. Design and fabrication are simpler if
only one or two types of gates are used. Thus it is important to identify functionally
complete set of gates. This means that Boolean function can be implemented using only
the gates in the set. AND OR and NOT gates constitute functionally complete set because
they represent the three operation of Boolean algebra. If there are any functionally
complete sets of gates, they should synthesize these sets of Boolean operators.
List of functionally complete set of gates:
 AND, OR, NOT
 AND, NOT
 OR, NOT
 NAND
 NOR
It is preferable to construct circuitry system using only NAND or NOR gates.
EXERCISES:
1. Show that, all these are functionally complete set of gates.
2. Construct XOR gate using only NAND gate.
3. Construct XOR gate using only NOR gate.

12.3 Boolean Algebra


The digital circuitry in digital computers and other digital systems is designed, and its
behavior is analyzed, with the use of mathematical discipline known as Boolean algebra.
The name is in honor of an English mathematician George Boole, who proposed the basic
principles of this algebra in 1854.
This Boolean algebra becomes very convenient in two areas:
 Analysis: It is an economical way of describing the function of digital circuitry.
 Design: given a desired function, Boolean algebra can be applied to develop a
simplified implementation that function.
As any algebra it make use of logical variables, which will have a value true or false (1 or
0), and logical operations.

A boolean function is described as follows:


F: X Y where X and Y are set of 0‟s and 1‟s
79
n
A Boolean function with n input variables could operate on 2 possible combinations.
For example:
F(X,Y)=XY+X
G(X,Y,Z)=XY+XYZ+YZ
H(x,y)=x + y = x.y + x.y
There are 3 basic Boolean operators NOT, AND, OR (-,. ,+)
Complex logic circuits can be constructed using the basic logic circuits. Any logic circuit
can be represented by a Boolean function and vice versa. Generally before constructing
any logical circuit it has to be simplified based on the rules of Boolean equations in order
to minimize the number of required logical gates.
Rules of the Boolean ( equation) operators.
x. 0 =0 x+1=1 Null
x. x =x x+x=1 Idempotent
x. x =0 x+x=1 Inverse
x. 1 =x x +o =x Identity
x(x +y)=x x+ x . y =x Absorption
x .y =y .x x +y = y +x Commutative
(x .y) .z =x.(y. z) (x +y) +z+ x+(y +z) Associative
A(Ã +B) = AB A + Ã‟B = A + B Absorbition
x.(y +z) = x. y + x. (x +y) (x +z) =x +y distributive
z z
x.y= x+y x +y = x.y DeMorgan‟s

X=x
x =x Double Negative
A +AB =A A(A +B)= A

To construct the logic circuit of a Boolean equation first we have to simplify the Boolean
function using the rules of the operators ( theorems)

80
12.4 Construction of logical circuit from logical function and truth table
Any Boolean function can be implemented in electronic form as a network of gates. If
you have the truth table you can generate the Boolean function and you can also use the
Boolean function to construct the logical circuit. The reverse is also possible.

12.4.1 Construction Boolean function/logic circuit from truth table


I. SOP (Sum of Product method)
It expresses that the output is 1 if any of the input combinations that produce 1 is
true. i.e.
 Insert a column for the inverse of all the variables
 Find the rows with functional value 1 and variable value one then use
them as an input for an AND operator
 Connect each of them using the OR gate.
II. POS (Product of Sum)
It expresses that the output is 1 if none of the input combinations that produce 0 is
1. i.e.
 Insert a column for the inverse of all the variables
 Find the rows with functional value 0 and variable value 0 then use them
as an input for an OR operator
 Connect each of them using the AND gate.
Example
Construct the Boolean function for the following truth table:
A B C F
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0

SOP considers row 4,5,and 8 with out put equals 1

F (A, B, C)=ABC + ABC +ABC


Pos considers row 2,3,6,7,8
F (A, B, C)=(A+B+C) (A+B+C) (A+B+C) (A+B+C) (A+ B+C)
To construct the logic circuit first simplify the given Boolean function and construct the
network as required using the Boolean function.
Exercise: which method SOP or POS require less number of logical gate to construct
logic circuit?

81
Construct a logical circuit and logical functions using the following truth table
A B A‟ B‟ F
0 0 1 1 1
0 1 1 0 0
1 0 0 1 1
1 1 0 0 0

A‟B‟+AB‟
(A+B‟)(A‟+B‟)
Ex. Construct the logic circuit of

F(x,y) =x +y + x y + ( x+ y) x y

Now the circuit of the above equation becomes:

Factoring to simplify

Ex1;- F(A,b)= AB +AB draw the circuit for both


Y = A(B + B) = A
Ex2:- F(A,B,C,D) = AB + AC + BD + CD

Ex 2: Draw the logic circuit for this boolean equation

Y = AB C D + AB CD + AB C D + ABCD
= BCD ( A + A) + ABCD + ABCD
82
= BCD + ABCD + ABCD
= CDC (B + AB) + ABCD

Now the logic circuit is

Exercise 1. Draw the circuit for

Y = ABCD + ABCD + ABCD

Draw the circuit for


L = CBA + CBA + CBA + CBA + CBA

83
12.5 Types of circuit
There are two types of circuits in designing logical circuits: Combinational circuits and
sequential circuits.
Combinational circuits are circuits that constitute interconnection of sets of gates whose
output at any time is a function of only the function of only the input at that time. In
general terms, a combinational circuit consists of n binary inputs and m binary outputs.
Combinational circuits implement the essential functions of a digital computer. However,
except for the special case ROM, they provide no memory or state information.
Examples: ADDER, ROM, PLA (Programmable Logic Array), Decoder, Multiplexers,
etc.
Sequential circuits are circuits which are designed to have a memory or state information
(i.e. the current out put of sequential circuit depends on the current input and the current
state of that circuit).
Examples: Flip-Flop, Registers, Counters, etc.

12.5.1 Adders (Half Adder and Full Adder)

I. Half adders
The simplest form of electronic binary arithmetic is performed in a half adder circuit. A
half adder circuit adds 2 bits and generates sum and carry output bits. Binary addition
differs from Boolean algebra in that the result includes a carry term.

A B S Co
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

84
S= A + B – sum output
Co = AB – carry output

The digital circuit of a half adder is shown bellow:

[Link]

[Link]
II. Full-Adders

We are not interested in performing addition on just a single pair of bits. Rather we wish
to add two n bit numbers. This can be done, by putting together a set of adders so that the
carry from one adder is provided as input to the next. The circuitry that can perform
complete binary addition is called full adder.
It accepts three separate inputs bits, the two bits to be added and a carry in.

Sum = A + B + C
Carry = AB + AC + BC
Construct the logic circuit for Sum and Carry of full adder

Truth table
A B Ci Carry Sum
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1

85
Exercise Construct a binary adder of 4-bits

Ex 1 1001 A3A2A1AD
1011 B3B2B1A0
10100 C4S3S2S1S0

A3 A2 A1 A0
B3 B2 B1 B0

C4 FA C3 FA C2 FA C1 HA

S3 S2 S1 S0

12.5.2 Flip Flops

Combinational circuits are circuits whose output is determined by the current input
(signal) where as sequential circuits are circuits whose output is determined by the
current input (signal) and the previous state of the circuits so sequential circuits have
memory to store their previous state.

A flip fop is the simplest form of sequential circuits. There are variety of flip-flops, all of
which share two properties:
 Flip flops are bitable devices. It exists in one of two states and, in the absence of
inputs, remain in that state. There fore a flip flop can function as a 1 bit memory.
 The flip flop has two outputs, which are always the complements of each other.
These are generally labeled Q and Q.
The different types of flip flops are S-R latch, Clocked S-R Flip flop, D flip flop, and J-K
flip flop. In this course we will see only the S-R latch (flip flops).

S-R latch (flip flop)

The circuit show that it has two inputs S (set) and R(reset) and two outputs Q and not(Q)
and consists of two nor gates hooked together in a feedback arrangement.
Set-sets to one

86
The SR-latch can be defined with a table similar to truth table, called characteristics table,
which shows the next state or states of a sequential circuit as a function of current state
and inputs. In the case of S-R latch, the state can be defined by the value of Q. The value
for the inputs S=1 and R=1 are not allowed, since these would produce an inconsistent
output (Both Q and not (Q) equal 0).

Truth table
R S Q
0 0 NC
0 1 1
1 0 0
1 1 *

A) Characteristics table B) Simplified characteristics table


Current input Current state (Q) Next state (Qn+1) S R Qn+1
(SR)
00 0 0 0 0 Qn
00 1 1 0 1 0
01 0 0 1 0 1
01 1 0 1 1 -
10 0 1
10 1 1
11 0 -
11 1 -

87
Chapter 7
13 Data: Communications and Networks
Objective:
To know basic component used in data transmission
To know, what a computer network is and different protocols of networks
To know what is Internet and what service Internet has.

13.1 Data Transmission

The need of information has increased from time to time. This leads to the need of
sharing of information among different agents (individual). Which may be at different
places or locations Date communication is the exchange of information between tow
agents. For exchange of information the information should be transmitted from one
point to another through a transmission media called Channel. The following figure
shows the different components of data communication.

Agent Input Transmi Output agent


device tter Transmiss Receiver device
ion
medium
1 2 3 4 5 6

Source System Destination system


1/ Input information (m)
2/ Input data q or signal q(t)
3/ Transmitted signal s(t)
4/ Received signal r(t)
5/ Output data q or signal q(t)
6/ Out put information m

An information is transmitted in a form of packets the information is divided into packets


and one packet is transmitted at a time. When a packet of information is transmitted the
sender must be sure that the receiver receives the information and the receiver must check
that it receives a correct information. The information is transmitted successfully the
receiver must send an acknowledgment to the sender.

13.1.1 Mode of transmission

88
The transmission medium may be physical (it connects the transmitter and receivers
through wire) or logical ( The are different mode of transmission)

Simplex transmission:- In this transmission signals are transmitted in only one


direction: One station is transmitter and the other is receiver
Half-duplex transmission:- In this transmission signals are transmitted in both direction,
both stations may transmit, but only one at a time.
Full-duplex transmission:- In this transmission signals transmitted in both direction,
both stations may transmit simultaneously. The medium carries signals in both directions
at the same time.

13.1.2 Data Transmission Channels

A channel is a medium that carries a signal from the transmitter to the receiver. The range
of frequencies that can be transmitted over a transmission medium is called band Width
of a channel width. The rate of data transmission is directly proportional to the
bandwidth.

There are three types of data transmission channels:

A/Narrowband: It is the smaller band and has slow data transmission rate Ex Telegraph
line.
B/Voice band: It is the wider band and has better data transmission rate than the narrow
band. Ex telephone lines are used for voice band channel
C/Broadband: It is the widest band has used to transmit large volume of data with high
speed, Ex. (Oxide cable such as TV aerial lead), circuits, communications sate bites and
optical fibers are used for broadband channels.

Information is transmitted in the form of analog or digital signals. Most communication


lines are designed to carry analog signals. Digital transmission rarely used for
telecommunications. Therefore, technique must be used to represent a digital signal in
analog carrier. The process of modifying the carrier signal to transmit digital information
is called “ Modulation.” When the transmitted signal is received, the information must
be reconverted into digital data. This process is called “Demodulation.” The conversion
between digital and analog data is handled using the device called modem.

13.2 Network and distributed systems.

Computer Network is a collection of computers and terminal devices connected by a


communication system. The use of computer network is to share resources like file,
device, printer, scanner, and program. Topology refers to the way in which multiple
devices are interconnected via communication links. There are two types of network:-
Local area Network ( LAN) and wide Area Network ( WAN).

89
A local area network is a network confined to a small area like a building. Most LAN
have communication stations that are physically linked by a cable. WAN are used to
connect computers not located in the same building ( or even in the same city. High-
speed dedicated data lines or satellite connections may be used to link computers
separated by great distance.

There are three main network topologies; bus, ring and star. [ figure]

Bus topology:- In bus topology, all stations attach through appropriate interfacing
hardware, directly to a line as transmission medium, or bus. A transmission from any
station propagates the length of the medium in both directions and can be received by all
other stations. The message that is transmitted contains the address of the station and the
data and each station monitors the medium and copies packets addressed to itself.
Because all stations share a common transmission link, only one station can successfully
transmit at a time, duo some form of medium access control technique is needed to
regulate access.

Ring topology:- In the ring topology the network consists of a set repeaters joined by
point –to point links in a closed loop. The links are unidirectional, that is, data are
transmitted in one direction only, and all oriented in the same way. The data circulates
around the ring in one direction ( clockwise or counter clockwise). Data are transmitted
in packets inserted into the ring by the stations. The packet contains source and
destination address as well as other control information and user data. As a packet
circulates, the destination station copies the data. Typically, the packet continues to
circulate until it returns to the source station, where it is absorbed, removing it from the
ring. Since the medium is shared it needed to control the order and timing of packet
transmission.

Star topology: In star topology, each station is directly connected to a common Central
Switch ( host). Each station transmits its message to the host and the host delivered the
message to the correct distribution by identifying the address. The problem with star is if
the host fails there will not be any communication.

The transmission medium can be twisted pair coaxial cable, optical fiber. The main
difference among the transmission medium is cost, speed and technology.

Distributed system is a system by which physically separated computers share resources


in their respective in their respective information processing functions. This means the
number of users can use the same disk drives, printers, and other peripherals, rather, than
giving each computer these peripherals. This becomes an important advantage when a
large database I required by two or more different computers.

13.2.1 Distributed System

Centralized information system

90
Decentralized information system
Each independent decision making unit can control its own data and information
processing activities.
Distributed information system is a management of information system that take both of
these factors into account.

In a network, computer systems that have several interconnected processors which are
physically dispersed can operate together. Each processor can have its own local
peripherals ( disks, printers, terminals) in addition to any peripherals attached to some
centered processor. Such a system which looks a single complete to its users is more
accurately described as a distributed system.

A distributed processing system is a set of independent but interacting computer systems


or data bases situated in different locations. The function of a distributed processing
system is to process some jobs at the point of user activity, while transmitting other jobs
to a centralized facility.

Distributed processing is not restricted to systems having a large centralized computer


system.

A network of inter connected micro computer systems is also a distributed system.


Micro computer system

Large-scale
Computer system

Computer system

13.3 Internet and Electronic communication

Internet is a wide area network, which is the network of networks. Internet has a lot of
services.

Electronic- Mail (E-mail)

E-mail is one of the most widely used services on the internet, E-mail is easy to send,
read, reply to and manage, and it is fast and convenient. E-mail is also global, allowing
menages to pass from Japan to the U.S in minutes, regardless or the time they were sent.
It is much cheaper to send an e-mail menage then a letter, or to make a long distance
telephone call. Another advantage of e-mail is, it is possible to send the same message to
any number of individuals as long as you know their e-mail address.

91
World Wide Web ( WWW):- Is one of the newest Internet services. The WWW allows
you to combine text, a video, graphics, and even animation to make a document a
viewed easy. Links within WWW documents can take you quickly to other related
documents. WWW is a set of sites that you can go o for information.

To access the WWW, it is necessary that you run a WWW browser on your computer.

Use Net:- It is one of the Internet services which allows users from any where on the
Internet to participate a discussion groups ( News groups). It is an organized electronic
mail ( e-mail) system, except there is no single user that mail is sent to. Instead, the
menages you and every one else using Use Net write are sent to a newsgroup section,
available for anyone who accesses that news group.

Telnet:- It is a program that lets you log into a remote computer directly through the
Internet and you can work on that computer.

File Transfer Protocol ( FTP)

This enables you to examine the files of remote hosts on the Internet and to transfer files
b/n your hosts and the others. Using FTP programs we can upload or download files. But
to do this there should be an admission from the remote computer.

Video Conferencing:- The internet is, in its raw form, communication. Video
conferencing means making a conference on the Internet by individuals who live in
different locations. The individuals speak and see each other.

92
Chapter 8
14 Problem Solving Using Computers

14.1 Steps Program development

Computer programming is the art of conceiving a problem in terms of the steps to its
solution and expressing those steps as instructions for a computer system to follow. We
stress the two parts to this definition.
 The first part focuses on defining the problem and logical procedures to follow in
solving it. (Task of system analyst)
 The second introduces the means by which programmers communicate those
procedures to the computer system so that it can be executed. (Work of
programmers).
System analyst use system analysis and design tools, particularly flowchart and
structure chart, to define the problem in terms of the steps to its solution. The
programmer use programming language to communicate the logic of the solution to
the computer. Programming language is a collection of commands that direct the
control of the computer system. Like a human-to-human language, programming
languages contains a number of rules of expression called syntax.
Program is a logical set of instructions that tells the computer what steps to take to solve
a problem.
Computer solves varieties of problems that can be expressed in a finite number of steps
leading to a precisely defined goal by writing different programs. A program is not
needed only to solve a problem but also it should be reliable, (main trainable) portable
and efficient. This is met by program design using techniques of software engineering.

There are five stages of program development:

a) Analysis:
This stage concerns with a deep understanding of the problems,
 Which part of the problem is going to be solved?

93
 What input data are needed to the problem?
 What procedures needed to achieve the result?
 What outputs data are expected?

b) Algorithm design and flow chart


An algorithm is a finite set of well defined rules for the solution of a
problem in a finite number of steps. To design an algorithm for a specific
problem first we break down the problem into simpler and manageable
tasks. For one problem there may be a lot of algorithms that help to solve
the problem, but the algorithm that we select must be powerful, easy to
maintain, and efficient ( it doesn‟t take too much space and time)

There are different ways of describing the algorithm but the most common ones are
verbal form, using any of existing human languages and flow chart. A flow chart
consists of an ordered set of standard symbols (mostly, geometrical shapes) which
represent operations, data flow or equipment. There are two types of flow charts.
System flowcharts the overall logic of data processing system. A program flow chart
shows the operations and logical decisions of a computer program.

The standard flowchart symbols and their meaning is given below.


Symbol Name Function

Terminal Used to represent the start of the end of a program

Input/ output Used to represent data input or data output from a computer

Processing Usually encloses operations or (command black) a group of


operations( a process)

Decision block it usually contains a question within it there are typically


two output paths: one if the answer to the question is yes
(true) , and the other if the answer is no ( false)
Flow line is used to indicate the direction of logical flow ( a path from

94
one operation to another
On-page is used for connecting two points in connector a flow chart
without drawing flow lines In one page.
Off page It is used an exit to or any entry from another part of the
connector flowchart on another page

The advantage of flowchart is it doesn‟t depend on any particular programming


language, so that it can used, to translate an algorithm to more than one programming
language.

Example 1:- Draw flow chart of an algorithm to add two numbers and display their
result.
Algorithm description
 Read the rules of the two numbers (a and b)
 Assign the sum of A and B to C
 Display the result ( c)
Now the flow chart is [Link].1 S
t
a
Read a, b r
t

[Link].3 C
=

[Link].4.1 aP
r
+i
n
[Link].5 S bt
t C
Ex 2:- Write an algorithm description and draw a flow
o chart to find the following sum.
Sum = 1+2+3+4 p

95
Ex2:- Write an algorithm description and draw a flow chart to check a number is
negative or not algorithm description.
1/ Read a number x
2/ If x is less than zero write a message negative
else write a message not negative

[Link].6.1 S
t
Read x a
r
t Print message
Write not X<0 write negative
negative
No Yes

[Link].6.3 S
t
Some times there are conditions inowhich it is necessary to execute a group of statements
p satisfied. This condition is called a loop. Loop is a
repeatedly. Until some condition is
sequence of instructions which is repeated until some specific condition occurs.
A loop normally consists of four part. There are:-
Initialization:- Setting of variables of the computation to their initial valves and setting
the counter for determining to exit from the loop.
Computation:- Processing
Test:- Every loop must have some way of exiting from it or else the program would
endlessly remain in a loop.
Incrementation:- Re initialization of the loop for the next loop.
[Link].6.5 Initializatio
n

Test Stop
Finished

[Link].6.7 Computatio
n

[Link].6.9 Incre 96
menta
tion
Ex:- Write the algorithmic description and draw a flow chart to find the following sum.
Sum = 1+2+3+…. + 50
1. Initialize sum too and counter to 1
2. If the counter is less than or equal to 50
 Add counter to sum
 Increase counter by 1
 Repeat step 2
 Else
 Exit [Link].6.12 S
3. Write sum t
a
r
Sum = 0
t
Counter =1

Yes Write sum


Counter>50

No
Sum = Sum + counter Stop

Counter Counter + 1

Ex2: Write a flow chart to find sum of the first N positive numbers.
Ex 3 Write a flow chart to find n!
Exercise Find the following sum
Sum = 1: +2! +3! +…+n!
Ex4 . Draw a flow chart that accepts a salary of an individual and calculate pension,
income tax and net salary and display the results.

Pension = 10%

97
I.T equals 0% for salary between 0-119
10% 120-599
20 % 600-1200
30 % above 1200

c) Coding
The flow chart is independent of programming language. Now at this stage we translate
each steps described in the flow chart ( algorithm description) to an equivalent instruction
of target programming language, that means, for example if we want to write in Pascal
program language, each step will be described by an equivalent Pascal instruction (
Statement).
d) Implementation
This is the final stage where the program is debugged for error, tested and documented
then placed for actual work.
e) Maintenance
Some time it may be needed to modify the program so that it accommodates new things
and it becomes efficient, and this can be done through maintaining the program.
8.2 Types of instruction
A program is a set of instructions (steps) that a computer should follow to perform a
given task. The instructions should be written in a language (or can be translated to a
language) that can be understood by the computer. The language that is used to write
instructions is called a programming language. Depending on the function the instruction
performed, instructions are categorized as follows:
1/ Input/ output Instructions: These instructions perform interfacing ( communication)
b/n the user and the computer through the I/O peripherals Transfer data b/n peripherals
and memory, or between peripherals and accumulators.
2/ Arithmetic and Logic Instructions:- These instructions perform arithmetic operations
( addition, subtraction, multiplication and division) and logical comparison.
3/ Branch ( or control transfer) Instructions:- A branch instruction (also called a jump
instruction) alters the normal sequence of program execution and is used to create loops
that allow the same sequence of instructions to be executed many times. There are two

98
types of branch instructions, unconditional and conditional. An Unconditional branch
always causes the program to jump to the branch address. A conditional branch only if a
specified condition is met.
4/ Information Monument Instruction ( storage/ retrieval/:- This group of instructions
take on the task of moving information from one register ( or storage location) to another.
Every programming language has its own sets of instruction and it has its own way of
writing the instructions.
8.3. Types of programming languages
We have seen that a computer system consists of different layers. It is possible to
communicate with the computer by writing a program at the different layers but basically
there are three types of programming languages:- Machine, low-level and high- level.
Machine language:- There is the only language that the computer understands directly
zero. A machine language is a set of machine instructions which consists of zeros and
one‟s. a machine instruction contains two parts an operation code ( op code) and an
address. The OP code tells the microprocessor system what operation it should perform,
add, transfer, compare, or move data to output device, etc. the address identifies the
location ( memory, register) holding the required operands that is, the data to be operated
upon. The address part may contain one, two or more addresses that is , there may be one
( or single address, two( double) address, and three ( or triple) address instructions.
Low-level Languages:- In machine language we have seen that the OP code and the
address are represented as a binary sequence but it is difficult for the programmer to write
a big program using binary sequence and it is difficult to debug an error from such
program so instead of representing the OP code and the adders as a binary sequence we
can represent them in mnemonics ( terms). A low-level language is a programming
language which uses mnemonics to write in program Low-level languages are machine
dependent.
Ex: Assembly language
High-level language: We have seen that writing a program in low-level languages is
easier and simple compare to machine languages. But still low-level languages have their
own draw bakes, that is they are machine dependent. So we need another type of

99
languages which are not machine dependent and more flexible there languages are called
high-level languages third generation languages.
Advantages of high-level languages:-
 Easier to learn and understand ( Look like English)
 Require less time to write and easier to debugge errors.
 Can be used on different machines with little modifications.
Ex:- Fortran, COBL, ALGOG 80, Basic, Scientific & engineering applications.
 Fortran:- Formula in Business data processing application
 COBL-:-Common business Oriented Language
 ALGOL 80:- ( Algorithmic Oriented Language)
 BASIC:- ( Beginners All-purpose symbolic Instruction code) simplest language
developed for solving numerical problem
 Pascal, L, Ada, Modula-2:- Used in teaching programming language.
There are also other languages which are still simplest and easier then high-level
languages which we called then fourth generation languages. These languages are
application oriented languages.
Ex:- Visual basic,
8.4. Translation and Execution
The only language that the computer understands is the machine language. Therefore any
program that is written in either low-level or high level language must be translated to
machine code so that it could be processed by the computer.
A program written in high-level or low-level language is called source code program and,
the translated machine code is called the object code program. Programs that translate a
program written in high level language and low-level language to machine code program
are called translators.
There are three types of translators; assembler, interpreter, and compiler.
Assembler:- A program that translate in source program written in a how-level language
( assembly) to machine- code .
Interpreter:- A translator that accepts one line of a source program at a time, produces
the corresponding machine code instructions and execute them.

100
Compiler:-A program designed to translate a high-level language source program into a
machine code program. It translates the whole source program at once.
The translator not only translate the instructions into machine code but also it detects
whether the program fulfills the syntax of the programming language. A program passes
through different stages before it carries out its function. First the program will be
translate to object code( compilation time) , then it will be loaded to the memory and
finally it will be executed (run time) or carries out its function.

Source Assembler Object


program Or program
compiler

101
Chapter 9
System Development Life Cycle (SDLC)

A system is a group of related components that serve a common purpose. In a


computerized information system these related components are: Hardware, Software,
Data, Procedures, Personnel (human being).

A system is a group of integrated parts that have a common purpose of achieving some
objective(s).

- group of parts
- integrated parts
- common purpose of achieving some objective(s).

9.1. Phases of SDLC

A computer based information system has a life cycle, just like a living organism or a
new product.

The System Life Cycle phases

1. Inception:- the idea for a new information system is stimulated by a need to


improve information processing procedures. This need leads to the preliminary
survey.
2. Feasibility study:- if the result of the survey are positive, it is required to produce
a more detailed feasibility study.
- Existing procedures
- Alternative systems
- Cost estimates

102
3. System analysis:
In system analysis, the existing information processing procedures are documented in
detail.

- Interviews
- document observation and
- physical work observation
- identifying strengths and drawbacks of the existing system
- producing a draft report

4. Design:- the analysis phase is concerned with what must be done, and the design
phase is concerned with how it will be done. The most challenging and creative
part of the life cycle is the design of a new system. One approach to this task is to
develop an ideal system relatively unconstrained by cost or technology; this ideal
system is then refined until it becomes feasible.

- General design specification(how must the problem be solved)


- Detailed specifications must be prepared for the system just designed
- The exact logic to be followed in processing and the contents and
structure of the files must be specified.
- Programming requirements
- Testing
- Unit tests
- Combined module tests
- Acceptance tests – the users verify that the system works satisfactorily.

5. Implementation: since the purpose of the new information processing system is


to change existing procedures training is crucial. All the individuals have to
understand what is required by the new system. When training has been
completed, it is possible to undertake conversion; it may be necessary to write

103
special programs to convert existing files into new ones or to create files from
manual records
6. Post–implementation and maintenance:
- Evaluation – is the system running
- Maintenance & enhancement – errors should be corrected and certain
aspects must be modified as operational experience is gained with it.

104
Chapter 10
Computer Virus
Parts of a Disk

[Link] Boot sector


Hard disk drives, floppy diskettes, and logical drives (partitions) all have boot sectors
where critical drive information is stored.

Master Boot Record

On all PC fixed disks, the first physical sector is reserved for a short bootstrap program.
This sector is the master Boot (MBR). It also includes the partition table.
Partition Table

PC disks are often split in logical blocks known as partition. Information required to
access these partitions ,as well as a flag which indicates which partition should be used to
boot the system(the active partition) is stored in the Master Boot Record.
What is computer virus?
Virus
A virus is an independent program which reproduces itself. It may attach to other
programs; it may create copies of itself (see companion viruses). It may attach itself to
any executable code, including but not limited to boot sectors and /or partition sectors of
hard and/or floppy disks. It may damage, corrupt or destroy data, or degrade system
performance.

Types of viruses

Multi-Partite

105
A virus which able to infect both files and boot sectors is said to be multi-partite. Such
viruses are highly infectious.

Boot sector or MBR virus

A virus which infects the boot sector of a fixed or floppy disk. Any formatted disk (even
one that is blank, or only contains text data, for example ) may contain a boot sector
virus. An attempt to boot from a diskette infected with a boot sector virus will cause the
virus to become active in memory. This type of virus will place a copy of itself on the
Master Boot Record(MBR) or the boot sector of the hard drive. Every time you boot
your system from that point on , you will have the virus active in memory. These are the
most common viruses. Any attempt to disinfect these viruses while a virus is active in
memory will be defeated since it will re- write itself to the disk as soon as you remove it.
Additionally, many of these are stealth viruses. For safety‟s sake, you should always
attempt to disinfect these viruses after a cold boot to a write –protected diskette.

Circular infection

A type of infection that occurs when 2 viruses infect the boot sector of a disk, rendering
the disk unbootable. Removing one virus will generally causes a re-infection with the
other virus.

Companion Virus

A virus which infects executable files by creating a „companion‟ file with the same name
but an .COM extension. Since DOS executes .COM files, followed by .EXE files, and
finally .BAT files, the virus loads before the executable file.

Cross-Linked Files

106
Cross-linking is a common phenomena rarely associated with viruses. It occurs when two
files appear to share the same clusters on the disk.

Dropper

A dropper is a program containing a virus which has been compressed with PKLite, Diet,
LZExe, etc. it has been designed to deposit the virus onto a hard disk, floppy disk, a file,
or into memory. The children of this process are not droppers.

Encryption

Among the most difficult to detect, encrypted viruses use a brief encryption loop at the
start of the program to make the rest of the program unintelligible. This means that
scanners relaying on signature files have only a few bytes to look for. The encryption key
also changes each time a polymorphic virus replicates.

False Positive

A false positive occurs when a scanner identifies a file as infected when in fact it is not.

File Stealth Virus

In addition to redirection for the boot information, these viruses attack .COM and .EXE
(executable files) files when opened or copied and hides the file size changes from the
DIR command. The major problem arises when an attempt is made to use CHKDSK/F
and there appears to be a difference in the reported file size and the apparent size.
CHKDSK assumes this is the result of some cross-linked files and attempts to repair the
damage. The result is the destruction of the files involved. The FRODO or 4096 virus is
famous for this kind of damage.
See also Stealth Virus and Full Stealth Virus.

107
Full Stealth Virus

In this case, all normal calls to file locations are cached while the virus subtracts its own
length so that it appears clean.

Heuristics

A rule-based method of identifying new viruses. This method of scanning does not rely
on specific virus signatures. The advantage of the heuristic scan is that it is not fooled by
a new variant of an existing virus. However, it might occasionally report suspicious code
in normal programs. For example, the scanning of a program may generate the message:

F-PROT will issue a stronger warning based on the likelihood of a program really
containing a virus.

Integrity Checker

A program which checks for changes to files. Integrity checkers, when used correctly,
can provide an excellent second line of defense against new viruses or variants.

In the Wild

Viruses found “In the Wild” are viruses which are known to be spreading, as opposed to
viruses which are not currently spreading, but are confined “in the zoo.”

Joke Programs

F-PROT detects the presence of several well-known joke programs which can interrupt
the normal operation of a PC. While joke programs are generally not harmful in any way,
their side effects are often mistaken for those of a virus.

108
Macro Virus

A macro virus is a virus written in one of the many macro languages. The macro viruses
spread via infected files, which can be documents, spreadsheets, databases, or any
computer program which allows use of a macro language. At present these viruses can
infect Microsoft Word and Lotus Ami Pro documents. See also Macro Virus information
section.

Polymorphism

A virus is said to be polymorphic if its code appears to be different every time it


replicates ( through generally each replication of the virus is functionally identical). This
is usually achieved by encrypting the body of the virus, and adding a decryption routine
which is different for each replication. When a polymorphic virus replicates, a portion of
the decryption code is modified. Additionally, random, do-nothing blocks of code can be
embedded in the program and are shuffled around to further vary the signature. In
essence, it looks like a different program to virus scanners.

Stealth Virus

These viruses actively hide themselves while running. The first common virus, the
BRAIN (discovered in the wide in 1986), was a stealth virus. It infects the boot sector of
a floppy diskette and any attempts to read the boot sector with BRAIN active would be
redirected to a copy of the original boot sector someplace else on the diskette.

Trojan, Trojan Horse

A Trojan (or Trojan Horse) is a program which carries out an unauthorized function
while hidden inside an authorized program. It is designed to do something other than
what it claims to, and frequently is destructive in its actions.

109
Virus Simulator

A virus simulator is a program which creates files that “look like” viruses. Such files are
questionable for testing purposes because they are not really infected. F-PROT will not to
be fooled by a simulator.

Virus Variant

A variant is a modification of a previously known virus, i.e. a variation.

Worm

A worm is a program which reproduces by copying itself over and over, system to
system. Worms are self-contained and g

110

You might also like