Unit 1 Important Notes
Unit 1 Important Notes
UNIT 1
CHARACTERISTICS OF COMPUTERS
The various characteristics of computers are as follows
1. Speed: Speed is the most important characteristics of computer .Computer having more speed
to perform jobs instantaneously.
2. Accuracy: The computers are perfect, accurate and precise. Accuracy signifies the reliability
of the hardware components of computers.
3. Automatic: A computer works automatically, once programs are stored and data are given to
it, constant supervision is not required.
4. Endurance: A computer works continuously and will not get tired and will not suffer from
lack of concentration.
5. Versatility: A computer can be put to work in various fields.
6. Reduction of cost: Though initial investment may be high, computer substantially reduces the
cost of transaction.
EVOLUTION OF COMPUTERS
ABACUS:
ABACUS uses movable beads stung on wires above and below a cross bar and its operation are
based on the idea of the place value notation. The beads of the counter represent digits. The
value of the digit in each position is determined by adding the values of the beads pressed against
the cross piece.
Pascal calculating machine:
It was the first real desktop calculating device that could add and subtract. It consists of a set of
toothed wheels or gears with each wheel or gear having digits 0 to 9 engraved on it. Arithmetic
operation could be performed by tunings these wheels.
Punched card Machine:
The presence and absence of the holes in the card represent the digits.
Charles Babbage’s Engine:
The machine took input from the punched card. The Analytical engine had a memory which will
perform arithmetic operations.
Unit 1 Computer Programming
Generations of Computers:
There are totally five computer generations known till date. Each generation has been discussed
in detail along with their time period, characteristics.
First Generation:
First generation of computer started with using vacuum tubes as the basic components for
memory and circuitry for CPU (Central Processing Unit). These tubes like electric bulbs
produced a lot of heat and were prone to frequent fusing of the installations, therefore, were very
expensive and could be afforded only by very large organizations. In this generation mainly
batch processing operating system were used. In this generation Punched cards, Paper tape,
Magnetic tape Input & Output device were used. There were Machine code and electric wired
board languages used.
Second Generation
This generation using the transistor was cheaper, consumed less power, more compact in size,
more reliable and faster than the first generation machines made of vaccum tubes.
In this generation, magnetic cores were used as primary memory and magnetic tape and
magnetic disks as secondary storage devices. In this generation assembly language and high level
programming language like FORTRAN, COBOL was used.
Third Generation
Unit 1 Computer Programming
The third generation of computer is marked by the use of Integrated Circuits (IC's) in place of
transistors. A single I.C has many transistors, resistors and capacitors along with the associated
circuitry. The I.C was invented by Jack Kilby. This development made computers smaller in
size, reliable and efficient. In this generation Remote processing, Time-sharing, Real-time,
Multi-programming Operating System were used.
High level language (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL-68 etc.)
were used during this generation.
Fourth Generation
The period of Fourth Generation was 1971-1980.
The fourth generation of computers is marked by the use of Very Large Scale Integrated (VLSI)
circuits. VLSI circuits having about 5000 transistors and other circuit elements and their
associated circuits on a single chip made it possible to
have microcomputers of fourth generation. Fourth Generation computers became more powerful,
compact, reliable, and affordable. As a result, it gave rise to personal computer (PC) revolution.
In this generation Time sharing, Real time, Networks, Distributed Operating System were used.
All the Higher level languages like C and C++, DBASE etc. were used in this generation.
Use of PC's
Very small size
Pipeline processing
No A.C. needed
Concept of internet was introduced
Great developments in the fields of networks
Computers became easily available
Fifth Generation
In the fifth generation, the VLSI technology became ULSI (Ultra Large Scale Integration)
technology, resulting in the production of microprocessor chips having ten million electronic
components. This generation is based on parallel processing hardware and AI (Artificial
Intelligence) software. AI is an emerging branch in computer science, which interprets means
and method of making computers think like human beings.
All the Higher level languages like C and C++, Java, .Net etc. are used in this generation.
AI includes:
Robotics
Neural networks
Game Playing
Development of expert systems to make decisions in real life situations.
Natural language understanding and generation.
ChromeBook
Classification of Computers
Computers differ based on their data processing abilities. They are classified according to
purpose, data handling and functionality.
According to purpose, computers are either general purpose or specific purpose. General purpose
computers are designed to perform a range of tasks.
They have the ability to store numerous programs, but lack in speed and efficiency. Specific
purpose computers are designed to handle a specific problem or to perform a specific task. A set
of instructions is built into the machine.
According to data handling, computers are analog, digital or hybrid. Analog computers work on
the principle of measuring, in which the measurements obtained are translated into data. Modern
analog computers usually employ electrical parameters, such as voltages, resistances or currents,
to represent the quantities being manipulated. Such computers do not deal directly with the
numbers. They measure continuous physical magnitudes. Digital computers are those that
operate with information, numerical or otherwise, represented in a digital form. Such computers
process data into a digital value (in 0s and 1s). They give the results with more accuracy and at a
faster rate. Hybrid computers incorporate the measuring feature of an analog computer and
counting feature of a digital computer. For computational purposes, these computers use analog
components and for storage, digital memories are used.
Analog Computer
Digital Computer
A computer that performs calculations and logical operations with quantities represented as
digits, usually in the binary number system
A combination of computers those are capable of inputting and outputting in both digital and
analog signals. A hybrid computer system setup offers a cost effective method of performing
complex simulations.
Computers are classified into four categories based on their size:
1. Mainframe Computers
2. Mini Computers
3. Micro Computers
4. Super Computers
1. Mainframe Computers.
Mainframe computers are built for general computing, directly serving the needs of
business and engineering. Although these computing systems are a step below super-
computers, they are still very fast and will process information at about 10 MIPS.
Mainframe computing systems are located in a centralized computing center with 20-
100+ workstations. This type of computer is still very expensive and is not readily found
in architectural/interior design offices.
They are big computer systems sensitive to temperature, humidity, dust etc.
Qualified & trained operators are required to operate them.
They have wide range of peripherals attached.
They have large storage capacity.
They can use wide variety of software.
They are not user friendly.
They can be used for more mathematical calculations.
They are installed in large commercial places or government organizations.
2
2. Mini Computers.
Minicomputers were developed in the 1960's resulting from advances in microchip
technology. Smaller and less expensive than mainframe computers, minicomputers run at
several MIPS and can support 5-20 users. CAD usage throughout the 1960's used
minicomputers due to their low cost and high performance. Examples of minicomputers
are: DEC PDP, VAX 11.
They have less memory & storage capacity than mainframe computers.
They offer limited range of peripherals.
Limited range of softwares can be used by them.
The end users can directly operate it.
They are not very sensitive to the external environment and hence are more
generalized.
They are used for data processing.
3. Micro Computers.
Microcomputers were invented in the 1970's and were generally used for home
computing and dedicated data processing workstations. Advances in technology have
improved microcomputer capabilities, resulting in the explosive growth of personal
computers in industry. In the 1980's many medium and small design firms were finally
Unit 1 Computer Programming
introduced to CAD as a direct result of the low cost and availability of microcomputers.
Examples are: IBM, Compaq, Dell, Gateway, and Apple Macintosh.
They brought revolution in the history of computers.
They are also known as Personal Computers.
They are cheap and user friendly.
The main components are Monitor, CPU, Keyboard, Mouse, Speakers, Modem and
Printer.
They are having limited peripherals attached to them.
This type of computers can use wide range of software.
They are used as desktops either in offices or even homes.
Their operation can be easily learnt by anyone having logical aptitude.
Children enjoy playing games & watching movies in these
computers.
Most popular micro computer’s processing chip manufacturing
company is Intel.
4. Super Computers.
Super-computers are very fast and powerful machines. Their internal architecture enables them
to run at the speed of tens of MIPS (Million Instructions per Second). Super-computers are very
expensive and for this reason are generally not used for CAD applications. Examples of super-
computers are: Cray and
CDC Cyber 205.
They are huge computers installed in space centers, nuclear power stations etc.
They are used for performing complex mathematical calculations. Only scientists
and mathematicians can operate them.
They are having huge memories & tremendous processing speed.
They are used for weather forecasting, animation graphics etc.
A computer system consists of mainly four basic units; namely input unit, storage unit,
central processing unit and output unit. Central Processing unit further includes Arithmetic logic
unit and control unit, as shown in the figure. A computer performs five major operations or
functions irrespective of its size and make. These are
INPUT UNIT
An I/O unit is a component of computer. The I/O unit is composed of two parts—input
unit and output unit. The input unit is responsible for providing input to the computer and the
output unit is for receiving output from the computer.The input unit gets the data and programs
from various input devices and makes them available for processing to other units of the
computer.The input data is provided through input devices, such as —keyboard, mouse, trackball
and joy-stick. Input data can also be provided by scanning images, voice recording, video
recording, etc.Irrespective of the kind of input data provided to a computer, all input devices
must translate the input data into a form that is understandable by the computer, i.e., in machine
readable form. The trans-formation of the input data to machine readable form is done by the
input interface of input device.the input unit accepts input data from the user via input device,
Unit 1 Computer Programming
transforms the input data in computer acceptable form using input interface for the input device
and provides the transformed input data for processing.
The ALU and the CU of a computer system are jointly known as the central processing
unit. You may call CPU as the brain of any computer system. It is just like brain that takes all
major decisions, makes all sorts of calculations and directs different parts of the computer
functions by activating and controlling the operations.
After the data is entered through the input device it is stored in the primary storage unit.
The actual processing of the data and instruction are performed by Arithmetic Logical Unit. The
major operations performed by the ALU are addition, subtraction, multiplication, division, logic
and comparison. Data is transferred to ALU from storage unit when required. After processing
the output is returned back to storage unit for further processing or getting stored.
The next component of computer is the Control Unit, which acts like the supervisor
seeing that things are done in proper fashion. Control Unit is responsible for co ordinating
various operations using time signal. The control unit determines the sequence in which
computer programs and instructions are executed. Things like processing of programs stored in
the main memory, interpretation of the instructions and issuing of signals for other units of the
computer to execute them. It also acts as a switch board operator when several users access the
computer simultaneously. Thereby it coordinates the activities of computer’s peripheral
equipment as they perform the input and output.
Storage Unit:
The process of saving data and instructions permanently is known as storage. Data has to
be fed into the system before the actual processing starts. It is because the processing speed of
Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same
speed. Therefore the data is first stored in the storage unit for faster access and processing. This
storage unit or the primary storage of the computer system is designed to do the above
functionality. It provides space for storing data and instructions.
Unit 1 Computer Programming
• All data and instructions are stored here before and after processing.
Memory:
Computer’s memory can be classified into two types; primary memory and secondary
memory
RAM or Random Access Memory is the unit in a computer system. It is the place in a
computer where the operating system, application programs and the data in current use are kept
temporarily so that they can be accessed by the computer’s processor. It is said to be ‘volatile’
since its contents are accessible only as long as the computer is on. The contents of RAM are no
more available once the computer is turned off.
ROM or Read Only Memory is a special type of memory which can only be read and
contents of which are not lost even when the computer is switched off. It typically contains
manufacturer’s instructions. Among other things, ROM also stores an initial program called the
‘bootstrap loader’ whose function is to start the operation of computer system once the power is
turned on.
Secondary Memory:
CD ROM
Secondary storage devices are of two types; magnetic and optical. Magnetic devices
include hard disks and optical storage devices are CDs, DVDs, Pen drive, Zip drive etc.
Hard Disk
Hard disks are made up of rigid material and are usually a stack of metal disks sealed in a
box. The hard disk and the hard disk drive exist together as a unit and is a permanent part of the
Unit 1 Computer Programming
computer where data and programs are saved. These disks have storage capacities ranging from
1GB to 80 GB and more. Hard disks are rewritable.
Compact Disk
Compact Disk (CD) is portable disk having data storage capacity between 650-700 MB.
It can hold large amount of information such as music, full-motion videos, and text etc. CDs can
be either read only or read write type.
Digital Video Disk (DVD) is similar to a CD but has larger storage capacity and
enormous clarity. Depending upon the disk type it can store several Gigabytes of data. DVDs are
primarily used to store music or movies and can be played back on your television or the
computer too. These are not rewritable.
OUTPUT UNIT: :
The output unit is used for storing the result as output produced by the computer after
processing.Devices used to get the response or result of a process from the computer is called
output.Output unit is the communication between the user and the computer.The output unit of a
computer provides the information and results of a computation to the outside world. The
processed data, stored in the memory of the computer is sent to the output unit, which then
converts it into a form that can be understood by the user. The output is usually produced in one
of the two ways – on the display device, or on paper (hard copy).
NUMBER SYSTEMS
In the decimal number system, there are ten possible values that can appear in each digit
position, and so there are ten numerals required to represent the quantity in each digit
position.The decimal numerals are the familiar zero through nine (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
Converting a decimal number to binary:
An example of the process: convert 3710 to binary
37 / 2 = 18 remainder 1 (least significant digit)
18 / 2 = 9 remainder 0
9 / 2 = 4 remainder 1
4 / 2 = 2 remainder 0
Unit 1 Computer Programming
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1 (most significant digit)
The resulting binary number is: 100101
Another example: convert 9310 to binary
93 / 2 = 46 remainder 1 (least significant digit)
46 / 2 = 23 remainder 0
23 / 2 = 11 remainder 1
11 / 2 = 5 remainder 1
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1 (most significant digit)
The resulting binary number is: 1011101
Conversion of Binary to Decimal
Converting a number from binary to decimal is quite easy. All that is required is to find the
decimal value of each binary digit position containing a 1 and add them up.
For example: convert 1011 to decimal.
1 0 1 1
23 22 21 20
8+0+2+1=11
Octal Representation
An octal number is represented using base 8. Octal representation is just a simple extension of
binary and decimal representations but using only the digits 0 to7. To convert an octal number to
a decimal number, it is required to multiply each octal digit by the appropriate power of 8 and
add the results.
octal representation of the decimal number 6410
Quotient Remainder
64/8 8 0 (LSB)
8/8 1 0
Unit 1 Computer Programming
1/8 0 1 (MSB)
Hence 6410 = 1008
2. In this method of conversion the fractional part of the given decimal number is
multiplied by 2 (i.e. the radix of binary number system).
3. The product obtained has an integer part and fractional part, the integer part here
is also referred as carry.
4. The carry that we obtain at each multiplication iteration becomes a digit in the
fractional binary number.
5. The fractional part obtained is again multiplied and the process is repeated until
the fractional part becomes zero or the number of multiplication iteration equals the
number of significant digits after the decimal point in the given fractional decimal
number.
6. The carry that we obtain at each stage are taken from first iteration to the last
iteration to form the numerals in the fractional binary number i.e. the carry obtained in
the first multiplication iteration is the most significant bit (MSB)after the decimal point
and the carry obtained in the last multiplication iteration is the least significant bit (LSB)
7. This procedure is illustrated in the following example.
Ex1: Convert (0.625)10 decimal number to binary number (?)2 using successive multiplication
method
Multiply 0.625 by 2
0.625 x 2 = 1.25(Product) Fractional part=0.25 Carry=1 (MSB)
Multiply 0.25 by 2
0.25 x 2 = 0.50(Product) Fractional part = 0.50 Carry = 0
Unit 1 Computer Programming
Multiply 0.50 by 2
0.50 x 2 = 1.00(Product) Fractional part = 1.00 Carry = 1 (LSB)
The fractional part in the 3rd iteration becomes zero and hence we stop the multiplication
iteration.
Carry from the 1st multiplication iteration becomes MSB and carry from 3rd iteration
becomes LSB.
Hence, the fractional binary number of the given fractional decimal number (0.625)10 is (0.101)2.
= 101010.1111
↑ ↑
MSB LSB
= 1 x 2 + 0 x 2 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 . 1 x 2-1 + 1 x 2-2 + 1 x 2-3 + 1 x 2-4
5 4
= 1 x 32 + 0 x 16 + 1 x 8 + 0 x 4 + 1 x 2 + 0 x 1 . 1 x ( 1 / 2 ) + 1 x ( 1 / 4 ) + 1 x ( 1 / 8 ) + 1 x
( 1 / 16 )
= 32 + 0 + 8 + 0 + 2 + 0 . ( 1 / 2 ) + ( 1 / 4 ) + ( 1 / 8 ) + ( 1 / 16 )
= 42 . 9375
Convert octal fraction to decimal fraction
Unit 1 Computer Programming
= 21. 2 1
↑ ↑
MSD LSD
= 2 x 81 + 1 x 80 . 2 x 8-1 + 1 x 8-2
= 2 x 8 + 1 x 1 . 2 x ( 1 / 8 ) + 1 x ( 1 / 64 )
= 16 + 1 . ( 0. 2 5 ) + ( 0 . 0 1 5 6 2 5 )
= 17 + 0. 265625
= 17 . 265625
Therefore ( 2 1 . 2 1 )8 = ( 1 7 . 2 6 5 6 2 5 )10
Convert hexadecimal fraction to decimal fraction
= EF. B 1
↑ ↑
MSD LSD
= 14 x 16 + 15 x 1 . 11 x ( 1 / 16 ) + 1 x ( 1 / 256 )
= 224 + 15 . ( 0. 6 8 7 5 ) + ( 0 . 0 0 3 9 0 6 2 5 )
= 239 + 0. 6914
= 239 . 691406
Therefore ( E F . B 1 )16 = ( 2 3 9 . 6 9 1 4 0 6 )10
Unit 1 Computer Programming
•Conversion of binary numbers to hex simply requires grouping bits in the binary
numbers into groups of four bits.
•Groups are formed beginning with the LSB and progressing to the MSB.
Example 1:
•1110 01112 = E716
Example 2:
•1 1000 1010 1000 01112
= 0001 1000 1010 1000 01112
= 1 8 A 8 716
Conversion of binary numbers to octal simply requires grouping bits in the binary number into
groups of three bits
•Groups are formed beginning with the Least Significant Bit and progressing to the MSB.
Start from right hand side and proceed to left. If the left most group contains only a
single digit or a double digit, add zeroes to make it 3 digits.
•Example 1
11 100 1112
= 011 100 1112
= 3 4 78
Example 2
1 100 010 101 010 010 0012
= 001 100 010 101 010 010 0012
= 14252218
ALGORITHM
An algorithm is a finite set of well defined instructions or step by step procedure to
solve
a given problem.
Programs= Algorithms + Data.
Characteristics of an Algorithm
1)Input : It may accept zero or more inputs
2)Definiteness : Each instruction must be clear, well-defined and precise. There
should not be any ambiguity
Unit 1 Computer Programming
Disadvantages of algorithm
Developing algorithm for large and complex problems would be time consuming
and difficult to understand
Unit 1 Computer Programming
FLOWCHART
A Flowchart
1. All symbols of the flowchart are connected by flow lines (note arrows, not lines)
2. Flowlines enter the top of the symbol and exit out the bottom, except for the
3. Decision symbol, which can have flow lines exiting from the bottom or the sides
4. Flowcharts are drawn so flow generally goes from top to bottom
5. The beginning and the end of the flowchart is indicated using the Terminal symbol
Symbols Used
Circle
Circles represents data in most flowchart diagrams. With GIS circles are used to distinguish data
input to a process and data that result from processing. It is convenient to use different colors to
identify various states of data: input, temporary, output, final product, and the like. ESRI's Model
Builder also uses circles in the case of processes that require constants or other input other than
spatial data
Rectangle
In most flowcharts, the rectangle is the most common shape. It is used to show a process, task,
action, or operation. It shows something that has to be done or an action that has to be taken. The
text in the rectangle almost always includes a verb.
Decision
A decision asks a question. The answer to the question determines which arrow you follow out
of the decision shape. Decisions can take place at points where results need to be evaluated
before the process may continue. Another use can be in the case of conditional operations
embedded in the flow.
Alternate Process
The rounded rectangle is sometimes used instead of the standard rectangle and can have the same
meaning. However, it is also used as an alternate process. The lines associated with the alternate
process are usually dashed. It allows you to specify a process in a sharp cornered rectangle and
an alternate process in a rounded rectangle. Some people also use the rounded rectangle for an
automated activity.
Manual input
This shape looks like a side view of a keyboard and often represents entering data into a
computer via a keyboard
Manual Operation
The trapezoid shape represents a manual operation. That is any operation or adjustment that has
to be done by hand rather than automatically.
Unit 1 Computer Programming
Preparation
This shape was originally used by IBM programmers to set a switch, modify an index register, or
initialize a routine. Currently you can use it to differentiate between steps that prepare for work
versus steps that actual do the work. It is probably best not to use this shape at all.
Database
A cylinder represents a data file or database. This shape can also represent the magnetic disc
itself. A hard drive is referred to as direct access storage since any sector on the drive can be
accessed. Compared to the circle symbol for data input and output the database is best used to
represent instances where collections of data are assembled in an organized manner like an ESRI
geodatabase.
Comment
This shape was used to add a comment or additional descriptive text to a software flowchart. A
dotted line should extend from the comment to the symbol it references. This shape is seldom
used today.
Input / Output
A parallelogram is used to show input or output. Examples of input are receiving a report, getting
an e-mail, getting an order, receiving data in some format, etc. Examples of output are generating
a report, sending an e-mail, faxing a message, etc.
Document
Terminator
This shape tells you where the flowchart begins and ends. It shows the entry point of your
flowchart and the exit point. It is useful to represent an end result of a flow process. It needs a
suitably descriptive label to be useful.
Off-page connector
This shape means the flow continues on another page. A letter or page number in the shape tells
you where to go. It is an alternative to using a circle.
1. Complex logic: - Sometimes, the program logic is quite complicated. In that case,
flowchart becomes complex and clumsy.
2. Alterations and Modifications: - If alterations are required the flowchart may require
re-drawing completely.
3. Reproduction: - As the flowchart symbols cannot be typed, reproduction of flowchart
becomes a problem.
4. The essentials of what is done can easily be lost in the technical details of how it is done.
Control structures
• Sequence – follow instructions from one line to the next without skipping over any lines
• Decision - if the answer to a question is “Yes” then one group of instructions is executed.
If the answer is “No,” then another is executed
Sequence Structure
Start
Read the
input
Do step 1
Do step 2
Stop
Unit 1 Computer Programming
Decision Structure
Looping Structure
Computation/Assignment
Compute var1 as the sum of x and y
Assign expression to var2
Increment counter1
Input/Output
Input: Get var1, var2, …
Output: Display var1, var2, …
Selection
Single-Selection IF
IF condition THEN (IF condition is true, then do subordinate statement 1, etc. If
condition is false, then skip statements)
statement 1
Double-Selection IF
IF condition THEN (IF condition is true, then do subordinate statement 1, etc. If
condition is false, then skip statements and execute statements under ELSE)
statement 1
ELSE (else if condition is not true, then do subordinate statement 2, etc.)
statement 2
statement 3
SWITCH expression TO
case 1: action1
case 2: action2
default: actionx
Repetition
Pseudocode Example
Express an algorithm to get two numbers from the user (dividend and divisor),
testing to
make sure that the divisor number is not zero, and displaying their quotient using pseudocode