foc
Introduction
1
Evolution of computers
First:
abacus
,
a help to calculation
BC 500 :Babylon
1642 B
laise
Pascal improves it. See d time gap!
1823
C
harles
Babbage
A
da
Byron
, Analytical Engine
It stored 1000 twenty digit decimal
numbers and a modifiable program so
that , it could do different computing jobs
2
Evolution of computers
It had 50,000 mechanical parts, and still
it could not give reliable results. Lacked
precision!
More the parts, more the trouble!
Too many cooks spoil the broth!
Too many leaders, spoil the people
3
Evolution of computers
With the advent of electrical motors and
machines, Hollerith, in 1889, made a
machine to count, calculate and sort; still
using punched cards
First electronic calculating computer was
developed by Konrad Zuse in 1941 and
was called Z3. But Turing is credited for
the first electronic computer in 1943,
called Colossus. But it was not
programmable.
4
The first general purpose computer was
developed in
1946
, was called ENIAC:
Electronic Numerical Integrator and
Calculator. It had 17000 vacuum tubes, over
500 miles of wire and weighed 30 tons! It
could do 100,000 operations per second.
Evolution of computers
Necessity is the mother of inventions! ?
5
In 1950 UNIVAC I, UNIVAC II, UNIVAC 1103
1948:Transistor
1958: general purpose computers using
transistors: efficient, small and faster.
1958: Integrated Circuits.
1960: computers using s
mall
&m
edium
s
cale
IC
1971: single chip microprocessor (4004)
1972:8 bit microprocessor (8008)
1973:Improved 8 bit microprocessor
(8080) and MC6800
Evolution of computers
6
1974:The
final
8 bit processor was 8085.
1978:8086!
1979: 8088 family of microprocessors
1981: IBM used 8088 in PC
personal computer
1983: Improved version of 8086 known
as 80286, A 16 bit micro processor!
Evolution of computers
7
1986:32 bit micro processor 80386 !
1989: the 80486
1993:Pentium in
Desktops give way to lap tops, palm tops
and even to cell phones these days!
Evolution of computers
8
Languages for the computers
1950: Assembly language for UNIVAC
1957: FORTRAN. Formula translation
Then came ALGOL, COBOL, BASIC,
PASCAL, C/C++, ADA and JAVA
O S:to supervise & manage comp.
Recourses
.
Using :

Easy for users
Utilization:

Efficient .
.
Then came OS: MS DOS, MS WINDOWS,
UNIX, LINUX
9
Generation of Computers
10
Classification
of computers
based on size
Super computer
Mainframe computer
Mini computer
Workstations
Micro computer
personal
Laptop/notebook
Palm top
11
Classification
of computers
based on purpose.
General purpose
Special purpose
12
Classification
of computers
based on technology
analog
digital
Hybrid
13
Organization of a computer
The basic units :
CPU,
memory unit,
input unit
output unit
Input devices
CPU: calculate, compare, copy…
Memory module: primary and secondary
14
15
Memory operations: read, write
Units of memory: byte, KB, MB, GB, TB,
Personal computer: H/W and S/W
Organization of a computer
16
Input devices, output devices, modem, PM,
PM types RAM, ROM, PROM, …
Internal processor memory, secondary
mem, CD rom,
Memory hierarchy
Organization of a computer
17
18
Software/ operating systems
Loading of OS to a PC
Booting, Basic I/O system
Operational overview of a computer
19
NUMBER SYSTEMS
There are many systems. They used sticks for
numbers. V for 5 sticks, and X for 10 sticks.
About 1500 years back indians used 0 as
a number which was taken to Arabs (sifr)
and then to the west (Zephiro),(Zero).
Every number system has a base.
20
Our common decimal system has a base
10. so 257 is to be understood as
7 singles + 5 tens + 2 hundreds! = 257
7 * 10
0
+ 5 * 10
1
+ 2 * 10
2
= 257
NUMBER SYSTEMS
7 * 10
0
5 * 10
1
+
2 * 10
2
+
21
Clearly the position at which a digit is
written, is significant. If the above
number is written as 752, the entire
meaning changes.
7* base
0
+ 5 * base
1
+ 2 * base
2
= 257
The weighting factor for 7 in 257 is 10
0
ie 1
and for 5 is 10
1
ie 10 and for 2 is 10
2
ie 100
NUMBER SYSTEMS
22
Different number systems are
Binary
Ternary
Quaternary
Quinary
Octal
Decimal
Duodecimal
Hexadecimal
Vigesimal
23
Binary number system
Here we have only two different digits namely 0
and 1. now let us find the actual value of 1100
1 1 0 0
0 * 2
0
= 0 +
0 * 2
1
= 0 +
1 * 2
2
= 4 +
1 * 2
3
= 8
12
weight
Multiplier
Multipliers
are written
and weights
are
assumed
from pos
24
Binary number system
Find out the value of 2361
8
in decimal
What will be the decimal equivalent of
3492
8
?!
25
Hexa decimal system
Digits are from 0 to 15 ! Then
how do you represent 10, 11….
10
A
11
B
12
C
13
D
14
E
15
F
0 0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001
10
1010
A
11
1011
B
12
1100
C
13
1101
D
14
1110
E
15
1111
F
26
Divide the number by 2.
note the remainder
Continue the same process on
the quotient, till it becomes 0
Write the remainders from
the last to first order as
shown by the arrow
19
2
9
1
2
4
1
2
2
0
2
1
0
Decimal to Binary conversion
convert
decimal 19 to binary
Thus 19
10
is 10011
2
2
0
1
27
1 1 0 1 0
.
1 * 2
1
= 2 +
0 * 2
2
= 0 +
1 * 2
3
= 8 +
1 * 2
4
= 16
26
weight
Multi
plier
0 * 2
0
= 0 +
Conversion from binary to decimal.
Convert 11010
2
to x
10
28
Thus the octal
equivalent of
decimal 84 is 124.
84
8
10
4
8
1
2
8
0
1
Decimal to Octal conversion:
convert decimal 84
10
to x
8
Thus 84
10
is 124
8
Here we continuously divide by 8 getting the quotient
and the remainder. Go on till the quotient becomes 0.
write the remainders in the reverse order
We check how many 8s are there
in 84. the rest should be singles!
We see there are 10 8s making it 80.
rest
4
singles(8
0
s) are there. then in
this 80 we check how many 8
2
or
64s are there. The rest should be 8s.
We see 1 64 and
2
8
1
s are there in 80
Finally in 1 we see 0 8
3
s are there
and rest
1
8
2
is there
29
2 B 4
.
4 * 16
0
= 4 +
11 * 16
1
= 176 +
2 * 16
2
= 512
692
weight
Multiplier
Hexadecimal to decimal conversion:
convert
Hexadecimal 2B4
16
to x
10
Thus 2B4
16
is 692
10
30
Thus the Hexadecimal equivalent of decimal 8945 is
21F1
8945
16
559
1
16
34
15 F
16
2
1
Thus 8945
10
is 21F1
16
Convert 8945
10
to x
16
16
0
2
31
Non decimal to Non decimal conversion:
In order to convert a number from any system S1
other than decimal to another system S2 other than
decimal, we first convert S1 to decimal and then
convert that decimal number to S2.
Thus X
16
to Z
8
can be done by X
16
Y
10
and then Y
10
Z
8
But if the base of X is a power of Z then the conversion
can be done directly as
Convert each digit directly into other system nibble by
nibble because hexadecimal base is 15 and binary is 2
and 16 = 2
4
. So 4 bits at a time!
A5 == 1010 1001 in binary
and
F8B == 1111 1000 1100
.
32
F8B == 1111 1000 1100
1101101101 is 0011 0110 1101 === 36D
7325
8
111 011 010 101
10 011 100
2
is 234
8
Group the binary digits into groups of 3 from the right
and convert each one to octal
.
33
Conversion of fractions
Convert 0.49 to binary
0.49 * 2 = 0.88
0
0.88 * 2 = 1.76
1
0.76 * 2 = 1.52
1
0.52 * 2 = 1. 04
1
0.04 * 2 = 0. 08
0
0.08 * 2 = 0. 16
0
For more precision we can go further
Thus 0.49 10
0.001110
34
Conversion from binary fraction to decimal
Convert 0. 1 0 1 1 to decimal
Thus 0.1011
2
= 0.6875
10
1 * 2

1
= 0.5 +
0. 1 0 1 1
0 * 2

2
= 0.0 +
1 * 2

3
= 0.125
+
1 * 2

3
= 0.0625 +
0.6875
35
Conversion of octal fraction to decimal
Convert 237.04
8
to x
10
2 3 7 . 0 4
7 * 8
0
= 7 +
3 * 8
1
= 24 +
2 * 8
2
= 128
159 . 0625
0 * 8

1
= 0 +
4 * 8

2
= 0 .0625 +
36
Conversion from binary fraction to octal
Convert 010.110 to octal
0 1 0 . 1 1 0
2
6
.
Convert 01010.110101 to octal
0 1 0 1 0 . 1 1 0 1 0 1
1
2
.
6
5
37
Conversion from binary fraction to Hexadecimal
Convert 0110.1101 to Hexadecimal
0 1 1 0 . 1 1 0 1
6
13 (D)
.
Convert 1001010.110101 to Hexadecimal
1 0 0 1 0 1 0 . 1 1 0 1 0 1
4
10 (A)
.
13(D)
1
38
ALGORITHMS/ step forms
What is algorithm?
It is a plan for a computer program.
An effective procedure for solving a problem in
finite
steps
Algorithm to make Tea
1. If the kettle is not filled with water, fill it with water
2.Plug the kettle to power and switch on
3.If the tea pot is not empty, then empty the tea pot
4.Place the tea leaves in the tea pot
5.If the water in the kettle is not boiling, go to step 5
6.Switch off the kettle
7.Pour the water from the kettle to teapot
.
.
39
Features of algorithm
Sequence (process) relates to the order. We can not have any order for an algorithm
Decision (selection) based on a condition some action is selected
Repetition (looping or iteration) some action/s are repeated finite number of times
Decision can be of two forms
1.
If condition
Then action
2.
If condition
Then action1
Else
action2
The repetition constructs
Repeat …………… Until
Repeat
action 1
action 2
Until condition satisfied
.
40
While (proposition) begin ………… end
While(kettle is not full)
Begin
pour water into the kettle
end
While (proposition)
Begin
action 1
action 2
………
action n
end
.
.
The same by using if then goto
1.
Pour water into the kettle
2.
If the kettle is not full, then goto step 1
1.
Action 1
2.
Action 2
3.
Action 3
4.
……
5.
If(proposition) then goto step 1
.
.
41
Variable is one whose value can vary.
Let us write an algorithm to boil some water
1. Pour water into a kettle
2. Connect a thermometer to take temperature readings
3. Connect the plug to power and switch it on
4. If the temperature is not equal to 100
0
C go to step 4
Here temperature is a variable and till it reaches 100, the process continues
Variabls are of different types like
numeric (integer, float, double..)
alphabetic ‘a’, ‘b’, or “University”
logical (ie true or false type)
Variable name should be meaningful.
Variable names shall be meaningful nouns.
.
.
.
42
Other ways of planing for a program are
Psuedo code
Flow chart
Nassi_Schneiderman
.
.
.
.
.
.
.
.
.
.
43
Other ways of planning for a program are
Psuedo code
A human understandable, easy to use way of expressing a programe flow
It uses, a well defined, restricted vocabulary.
Do while kettle not full
Add water to kettle
End dowhile
.
.
44
Flow chart
It provides the steps to be followd to arrive at a solution to a problem. So it is a
program design tool
Flow charts comprises of a set of figures of various shapes that are connected by
flow lines. Flow lines have arrows showing the direction of flow of control
between the figures. The action to be taken is written in the figures. Flow charts
can have connectors. Flow charts help understanding and explaining the problem
to the others
.
.
Standards for flow charts
They shoiuld start at the top and flow down and to the right
Only standard symbols should be used
Commonly understandable language should be used (not programming lang)
Flow chart for each subroutine should be drawn in separate pages with proper
starting and terminal symbols!
Arrows should be used to indicate the flow direction
45
.Flow Chart
Abcd
Pqua
xysz
Only one flow line should emerge from a process symbol
Only one flow line should enter a decision symbol, whereas multiple lines can
emerge from a decision symbol
Only one flow line should emerge from a start and no flow line shall emerge from
an end/stop
Arrows should be used to indicate the flow direction
46
.Flow Chart symbols from net
Also examples from the net
.
.
.
47
Program cycle
Define the problem
Design the solution
Code the program
Test the program
Document the program
Implement the program
Maintain the program
Commonly understandable language should be used (not programming lang)
Flow chart for each subroutine should be drawn in separate pages with proper
starting and terminal symbols!
Arrows should be used to indicate the flow direction
48
compiler
It checks for erros and lists them out
If no error, compiler generates the machine code for the program (object code)
which can be executed
Object code
compiler
Object code in
Machine language
errors
Syntax refers to the arrangement of words in a statement or the format/appearance or
general shape of a statement ( I ate a mango) noun, verb, noun
Semantics refers to the meaning/sense behind. (Mango ate i) noun verb noun
but no sense
49
Thus the octal equivalent of decimal 84 is 124.
84
8
10
4
8
1
2
8
0
1
Hexadecimal to decimal conversion convert Hexadecimal 284
16
to x
10
Thus 84
10
is 124
8
Convert 84
10
to x
8
Here we continuously divide by 8 getting the quotient and the remainder. Go on
till the quotient becomes 0. write the remainders in the reverse order
50
Comments 0
Log in to post a comment