You are on page 1of 37

Unit 1

Introduction to Computer

INTRODUCTION- The word computer is derived from the word compute. Compute means to calculate. The
computer was originally defined as a super fast calculator .The set of instructions given to the computer to
perform various operations is called as the Computer program. The process of converting the input data into
the required output form with the help of the computer program is called as data processing. The computers
are therefore also referred to as data processors
The terms hardware and software are almost always used in connection with the computer.

• The Hardware: The hardware is the machinery itself. It is made up of the physical parts or devices of the
computer system like the electronic Integrated Circuits (ICs), magnetic storage media and other mechanical
devices like input devices, output devices etc. All these various hardware are linked together to form an
effective functional unit. The various types of hardware used in the computers, has evolved from vacuum
tubes of the first generation to Ultra Large Scale Integrated Circuits of the present generation. • The Software:
The computer hardware itself is not capable of doing anything on its own. It has to be given explicit
instructions to perform the specific task. The computer program is the one which controls the processing
activities of the computer. The computer thus functions according to the instructions written in the program.

Software: Software mainly consists of these computer programs, procedures and other documentation used in
the operation of a computer system. Software is a collection of programs which utilize and enhance the
capability of the hardware.

Generation of Computer:
The computers of today are vastly different in appearance and performance as compared to the computers of
earlier days. But where did this technology come from and Where is it heading? To fully understand the
impact of computers on today’s world and the promises they hold for the future, it is important to understand
the evolution of computers.

. The First Generation:


1- The first generation computers made use of: Vacuum tube technology,
2- Punched cards for data input,
3- Punched cards and paper tape for output,
4- Machine Language for writing programs,
5- Magnetic tapes and drums for external storage.
Some of the early computers included:

ENIAC (Electronic Numeric Integrator and Calculator) – The first all electronic computer was produced by a
partnership between the US Government and the University of Pennsylvania.

EDVAC – In the mid 1940’s Dr. John von Neumann designed the Electronic Discrete Variable Automatic
Computer with a memory to store both program and data. This was the first machine which used the stored
program concept.

The Second Generation:

In the second generation computers:


1- Vacuum tube technology was replaced by transistorized technology,
2- Size of the computers started reducing
3- Assembly language started being used in place of machine language

1|Page Prepared By:- Ankur Rohilla


4- Concept of stored program emerged,
5- High level languages were invented.

The Third Generation:

1-The third generation computers were characterized by: Use of Integrated circuits,
2- Phenomenal increase in computation speed,
3- Substantial reduction in size and power consumption of the machines,
4- Use of magnetic tapes and drums for external storage,
5- Design-of Operating systems and new higher level languages,
6- Commercial production of computers.

The Fourth Generation:


1-The general features of the fourth generation computers were: Use of Very Large Scale Integration,
2- Invention of microcomputers,
3- Introduction of Personal Computers,
4- Networking,

The Fifth Generation: Defining the fifth generation computers is somewhat difficult because the field is still in
its infancy. The computers of tomorrow would be characterized by Artificial Intelligence (At). An example of Al
is Expert Systems. Computers could be developed which could think and reason in much the same way as
humans. Computers would be able to accept spoken words as input (voice recognition).
CLASSIFICATION OF COMPUTERS.

Analog computers: In analog computers, data is recognized as a continuous measurement of a physical property
like voltage, speed, pressure etc. Readings on a dial or graphs are obtained as the output, ex. Voltage,
temperature; pressure can be measured in this way.

Digital Computers: These are high speed electronic devices. These devices are programmable. They process data
by way of mathematical calculations, comparison, sorting etc. They accept input and produce output as discrete
signals representing high (on) or low (off) voltage state of electricity. Numbers, alphabets, symbols are all
represented as a series of 1s and Os.

Hybrid Computers: Hybrid Computers are a combination of Analog and Digital computers. They combine the
speed of analog computers and accuracy of digital computers. They are mostly used in specialized applications
where the input data is in an analog form i.e. measurement. This is converted into digital form for further
processing. The computers accept data from sensors and produce output using conventional input/output devices.

2|Page Prepared By:- Ankur Rohilla


3|Page Prepared By:- Ankur Rohilla
4|Page Prepared By:- Ankur Rohilla
5|Page Prepared By:- Ankur Rohilla
6|Page Prepared By:- Ankur Rohilla
7|Page Prepared By:- Ankur Rohilla
8|Page Prepared By:- Ankur Rohilla
9|Page Prepared By:- Ankur Rohilla
10 | P a g e Prepared By:- Ankur Rohilla
11 | P a g e Prepared By:- Ankur Rohilla
12 | P a g e Prepared By:- Ankur Rohilla
13 | P a g e Prepared By:- Ankur Rohilla
14 | P a g e Prepared By:- Ankur Rohilla
15 | P a g e Prepared By:- Ankur Rohilla
16 | P a g e Prepared By:- Ankur Rohilla
17 | P a g e Prepared By:- Ankur Rohilla
18 | P a g e Prepared By:- Ankur Rohilla
19 | P a g e Prepared By:- Ankur Rohilla
20 | P a g e Prepared By:- Ankur Rohilla
21 | P a g e Prepared By:- Ankur Rohilla
22 | P a g e Prepared By:- Ankur Rohilla
23 | P a g e Prepared By:- Ankur Rohilla
24 | P a g e Prepared By:- Ankur Rohilla
25 | P a g e Prepared By:- Ankur Rohilla
26 | P a g e Prepared By:- Ankur Rohilla
27 | P a g e Prepared By:- Ankur Rohilla
Translators

Computers only understand machine code (binary), this is an issue because programmers prefer to use a
variety of high and low-level programming languages instead.To get around the issue, the high-level and
low-level program code (source code) needs to pass through a translator.A translator will convert the source
code into machine code (object code).

There are several types of translator programs, each able to perform different tasks.

Compiler:-

Compilers are used to translate a program written in a high-level language into machine code (object
code).Once compiled (all in one go), the translated program file can then be directly used by the computer
and is independently executable.

Compiling may take some time but the translated program can be used again and again without the need for
recompilation.

Interpreter programs are able to read, translate and execute one statement at a time from a high-level language
program.The interpreter stops when a line of code is reached that contains an error.

28 | P a g e Prepared By:- Ankur Rohilla


Interpreters are often used during the development of a program. They make debugging easier as each line of code is
analysed and checked before execution.

Assembler

Assemblers are used to translate a program written in a low-level assembly language into a machine code
(object code) file so it can be used and executed by the computer. Once assembled, the program file can be
used again and again without re-assembly.

Summary of translators

Compiler Interpreter Assembler

Translates low-level
Temporarily executes high-level
Translates high-level languages into assembly code
languages, one
machine code into machine
statement at a time
code

An executable file of
No executable file of machine
An executable file of machine code is machine code is
code is produced (no
produced (object code) produced (object
object code)
code)

Interpreted programs cannot be Assembled programs no


Compiled programs no longer
used without the longer need the
need the compiler
interpreter assembler

One low-level language


Error report produced once entire Error message produced
statement is
program is compiled. These immediately (and
usually translated
errors may cause your program program stops at that
into one machine
to crash point)
code instruction

Interpreted code is run through


Compiling may be slow, but the
the interpreter (IDE),
resulting program code will run
so it may be slow, e.g.
quick (directly on the
to execute program
processor)
loops

One high-level language statement may


be several lines of machine

29 | P a g e Prepared By:- Ankur Rohilla


code when compiled

What is Computer algorithm?

‘’a set of steps to accomplish or complete a task that is described precisely enough that a computer can run
it’’.

In order to qualify as an algorithm, a sequence of instructions must have following characteristics:

Each and every instruction should be precise and unambiguous .

Each instruction should be such that it can be performed in a finite time.

One or more instructions should not be repeated infinitely. This ensures that the algorithm will ultimately
terminate .

After performing the instructions, that is after the algorithm terminates, the desired results must be obtained

SIMPLE EXAMPLE OF ALGORITHMS

There are 50 students in a class who appeared in their final examination. Their mark sheets have been given
to you. The division column of the mark sheet contains the division (FIRST, SECOND, THIRD or FAIL)
obtained by the student. Write an algorithm to calculate and print the total number of students who passed in
FIRST division.

Step 1: Initialize Total_First_Division and Total_Marksheets_Checked to zero

. Step 2: Take the mark sheet of the next student.

Step 3: Check the division column of the mark sheet to see if it is FIRST, if no, go to Step 5.

Step 4: Add 1 to Total_First_Division.

Step 5: Add 1 to Total_Marksheets_Checked.

30 | P a g e Prepared By:- Ankur Rohilla


Step 6: Is Total_Marksheets_Checked = 50, if no, go to Step 2.

Step 7: Print Total_First_Division.

Step 8: Stop.

Flowchart

- Flowchart is a pictorial representation of an algorithm

- Uses symbols (boxes of different shapes) that have standardized meanings to denote different types of
instructions

- Actual instructions are written within the boxes

-Boxes are connected by solid lines having arrow marks to indicate the exact sequence in which the
instructions are to be executed

A student appears in an examination, which consists of total 10 subjects, each subject having maximum
marks of 100. The roll number of the student, his/her name, and the marks obtained by him/her in various
subjects are supplied as input data. Such a collection of related data items, which is treated as a unit is
known as a record. Draw a flowchart for the algorithm to calculate the percentage marks obtained by the
student in this examination and then to print it along with his/her roll number and name.

31 | P a g e Prepared By:- Ankur Rohilla


50 students of a class appear in the examination of Example 3. Draw a flowchart for the algorithm to
calculate and print the percentage marks obtained by each student along with his/her roll number and name.

32 | P a g e Prepared By:- Ankur Rohilla


ADVANTAGE OF FLOWCHART

Better Communication

Proper program documentation

Efficient coding

Systematic debugging

Systematic testing

LIMITATION OF FLOWCHART

Flowcharts are very time consuming and laborious to draw (especially for large complex programs)

Redrawing a flowchart for incorporating changes/ modifications is a tedious task

There are no standards determining the amount of detail that should be included in a flowchart

PSEUDO-CODE

A program planning tool where program logic is written in an ordinary natural language using a structure
that resembles computer instructions
33 | P a g e Prepared By:- Ankur Rohilla
“ Pseudo” means imitation or false and “ Code” refers to the instructions written in a programming language.
Hence, pseudocode is an imitation of actual computer instructions

Because it emphasizes the design of the program, pseudocode is also called Program Design Language
(PDL)

Any program logic can be expressed by using only following three simple logic structures:

1. Sequence logic,

2. Selection logic, and

3. Iteration (or looping) logic Programs structured by using only these three logic structures are called
structured programs, and the technique of writing such programs is known as structured programming

SEQUENCE:-

It is used for performing instructions one after another in sequence.

SELECTION

Also known as decision logic, it is used for making decisions • Three popularly used selection logic
structures are 1. IF…THEN…ELSE 2. IF…THEN 3. CASE

34 | P a g e Prepared By:- Ankur Rohilla


LOOP:-

Used to produce loops in program logic when one or more instructions may be executed several times
depending on some conditions

Two popularly used iteration logic structures are 1. DO…WHILE 2. REPEAT…UNTIL

35 | P a g e Prepared By:- Ankur Rohilla


ADVANTAGE OF PSEUDOCODE

Converting a pseudocode to a programming language is much more easier than converting a flowchart to a
programming language

- As compared to a flowchart, it is easier to modify the pseudocode of a program logic when program
modifications are necessary

- Writing of pseudocode involves much less time and effort than drawing an equivalent flowchart as it has
only a few rules to follow

LIMITATION OF PSEUDOCODE

In case of pseudocode, a graphic representation of program logic is not available

- There are no standard rules to follow in using pseudocode

- Different programmers use their own style of writing pseudocode and hence communication problem
occurs due to lack of standardization

- For a beginner, it is more difficult to follow the logic of or write pseudocode, as compared to flowcharting

36 | P a g e Prepared By:- Ankur Rohilla


37 | P a g e Prepared By:- Ankur Rohilla

You might also like