Unit 1 - Fundamentals of Computing
Unit 1 - Fundamentals of Computing
A computer is an electronic
machine that takes input from the
user, processes the given input and
generates output in the form of
useful information.
Keyboard:
A standard keyboard includes alphanumeric keys, function keys,
modifier keys, cursor movement keys, spacebar, escape key,
numeric keypad, and some special keys, such as Page Up, Page
Down, Home, Insert, Delete and End.
PREETHA V AP/CSE, SRIT
Mouse:
The mouse allows the user to select elements on the screen, such
as tools, icons, and buttons, by pointing and clicking them.
The mouse is also known as a pointing device because it helps
change the position of the pointer or cursor on the screen.
The mouse consists of two buttons, a wheel at the top and a ball
at the bottom of the mouse.
Scanner:
Primary memory
Secondary memory
Cache memory is used to store the data and the related application that
was last processed by the CPU.
When the processor performs processing, it first searches the cache
memory and then the RAM, for an instruction.
The cache memory is always placed between CPU and the main memory
of the computer system.
ALU is a part of the CPU that performs arithmetic and logical operations
on the data.
The CRT monitors are large, occupy more space in the computer,
whereas LCD monitors are thin, light weighted, and occupy lesser
space.
PREETHA V AP/CSE, SRIT
Monitor (cont..)
Both the monitors are available as monochrome, gray scale and
color models. However, the quality of the visual display produced
by the CRT is better than that produced by the LCD.
A monitor can be characterized by the following two factors,
monitor size and
resolution.
The monitor size is the length of the screen that is measured
diagonally.
The resolution of the screen is expressed as the number of picture
elements or pixels of the screen. The resolution of the monitor is
also called the dot pitch.
The monitor with a higher resolution produces a clearer image.
Dot matrix printers are commonly used in low quality and high
volume applications like invoice printing, cash registers, etc.
However, inkjet printers are slower than dot matrix printers and
can generate high-quality photographic prints.
PREETHA V AP/CSE, SRIT
Printer (cont..)
The sound card being used in the computer system decides the
quality of audio that we listen using music CDs or over the
Internet.
• Analog computers
• Digital computers
• Hybrid computers
PREETHA V AP/CSE, SRIT
Analog computers:
Digital computers:
Special-purpose computers:
Perform only a specified task.
Not versatile
Speed and memory size depend on the task that is to be performed.
Efficient and consume less amount of time in generating the result.
PREETHA V AP/CSE, SRIT
Based on Size and Capability
• Microcomputers
• Mini computers
• Mainframe computers
• Super computers
Depending on the size, the microcomputer can be further classified into the
following types:
Desktop computer
Laptop computer
Hand-held Computer
Notebook
Tablet
Smart Phones
In expensive
Portable
Advantages:
Small in size
Can be carried anywhere
Has features of notebook computers but it accepts input from a stylus instead of
keyboard or mouse
Portable
Small in size
Used for computing and information storage for presonal or business use
They were called mini computers because of their smaller size than the other
computers of those times.
Can handle more data and more input and output than micro computers.
Less powerful than mainframe computers but more powerful than micro
computers.
For example, a number system can be used to represent the number of students in a
class.
Each number in this system consists of digits which are located at different
positions.
The position of first digit towards left side of the decimal point is 0.
Similarly, the position of first digit towards right side of decimal point is -1.
The position of second digit towards right side of decimal point is -2 and so on.
Base or Radix is 10
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Example:
Base or Radix is 2
Digits: 0, 1
Example:
Base or Radix is 8
Digits: 0, 1, 2, 3, 4, 5, 6, 7
Example:
2 25
2 12 -1
2 6-0
2 3-0
1-1
2510=110012
PREETHA V AP/CSE, SRIT
Binary to decimal conversion
11001
1X20 = 1
0X21 = 0
0X22 = 0
1X23 = 8
1X24 = 16
2510
8 125
8 15 - 5
1 -7
12510=1758
8 84
8 10 - 4
1 -2
8410=1248
175
5X80 = 5
7X81 = 56
1X82 = 64
125
1758 = 12510
PREETHA V AP/CSE, SRIT
Example 2:
124
4X80 = 4
2X81 = 16
1X82 = 64
84
1248 = 8410
PREETHA V AP/CSE, SRIT
Conversion of Decimal to Hexadecimal
16 450
16 28 - 2
1 - 12
45010=1C216
38510=18116
1C2
2X160 = 2
12X161 = 192
1X162 = 256
450
1C216 = 45010
1 81
1X160 = 1
8X161 = 128
1X162 = 256
385
18116 = 38510
(0010101110100011)2
BINARYOCTAL
BINARYHEXADECIMAL
OCTALHEXADECIMAL etc,.
011 001
3 1
110012=318
1 110 011
11100112=1638
0111 0011
0111 0011
7 3
11100112= 73 16
0001 1001
1 9
110012=1916
0001 1001
1 9
318=1916
1 B D
0001 1011 1101
1BD = 6758
2510=110012
PREETHA V AP/CSE, SRIT
0.125 X 2 = 0.250
0.250 X 2 = 0.5
0.5 X 2 = 1.0
25.12510 = 11001.0012
11 0 0 1 . 0 0 1
1X2-3 = 0.125
0X2-2 = 0
0X2-1 = 0
1X20 = 1
0X21 = 0
0X22 = 0
1X23 = 8
1X24 = 16
25.12510
84.250 10 Octal
8 84
8 10 - 4
1 -2
8410=1248
25.12310 = 124.28
124.2
2X8-1 = 0.25
4X80 = 1
2X81 = 0
1X82 = 0
25.25010
Input/Output
It is used for input or output.
Process Symbol
It is used to represent the calculations, data movements, initialization
operations etc,.
Flow lines
It is used to connect the symbols.
Connectors
It is used to connect the flow lines.
Only one flow line should be used with the terminal symbol.
START
STOP
GET a,b
COMPUTE c=a+b
PRINT c
stop
IF condition THEN
process 1 YES If NO
. condition
.
ELSE
process 2 Process 1 Process 2
.
.
END IF
.
.
END WHILE
PREETHA V AP/CSE, SRIT
Example: Finding the area of a circle
Algorithm
Step1: Start
Step2: Read the value of r
Step3: Calculate area = 3.14*r*r
Step4: Print area
Step5: Stop
Set area
READ the r
COMPUTE area=3.14*r*r
PRINT area
stop
Read r
area=3.14*r*r
Print area
STOP
PREETHA V AP/CSE, SRIT
Find the largest among three
Numbers
Algorithm
Step1: Start
Step2: Read the value of a, b, c
Step3: IF (a>b) and (a>c) THEN
print a is largest
ELSE IF (b>c) THEN
print b is largest
ELSE
print c is largest
Step4: Stop
PREETHA V AP/CSE, SRIT
Pseudocode
READ a, b, c
IF (a>b) and (a>c) THEN
WRITE a is largest
ELSE IF (b>c) THEN
WRITE b is largest
ELSE
WRITE c is largest
ENDIF
stop
Read a,b,c
If yes
(a>b) and Print a
(a>c) Is largest
no
If yes
Print b
b>c
Is largest
no
Print c
Is largest
PREETHA V AP/CSE, SRIT
stop
Finding roots of the Quadratic
equation
Step:1 Start
Step:2 Enter the values of a,b,c
Step:3 Find the value of D Using the Formula,
D = b*b-4*a*c
Step:4 If D is greater than or equal to zero find 2
roots
root1(-b+sqrt(D))/(2*a)
root2(-b-sqrt(D))/(2*a)
Step:5 Print root1 & root2
Step:6 If D is less than zero, then print the root are
imaginary
Step:7 Stop
PREETHA V AP/CSE, SRIT
Pseudocode
Set root1,root2
READ the value of a, b, c
Find D b*b-4*a*c
IF D>=0 THEN
calculate root1=(-b+sqrt(D))/(2*a)
root2=(-b-sqrt(D))/(2*a)
ELSE
Roots are imaginary
END IF
WRITE root1,root2
Stop
PREETHA V AP/CSE, SRIT
Flow chart Start
Read a,b,c
D=b*b-4*a*c
no
If D>=0
yes
Root1=[-b+sqrt(D)]/(2*a)
Root2=[-b+sqrt(D)]/(2*a) Print
roots are imaginary
Print root1,root2
PREETHA V AP/CSE, SRIT
Stop
Finding the Factorial
Algorithm
Step1: Start
Step2: Read the value of n and set i =1
Step3: While i <= n do
fact =fact * i
i=i+1
else Goto step5
Step4: Goto step 3
Step5: print the value of fact
Step6: Stop
PREETHA V AP/CSE, SRIT
Pseudocode
Read n
i=1
while no
i<=n
yes
fact=fact * i
i=i+1
Print fact
r = 0,sum=0
while no
n>0
yes
r=n%10
sum=sum + r
n=n/10
Print sum
PREETHA V AP/CSE, SRIT
stop
Finding the Reverse of a Number
Algorithm
Step1: Start
Step2: Read the value of n and set i = 0, sum = 0
Step3: While n>0 do
r=n%10
sum=sum *10 + r
n=n/10
else Goto step5
Step4: Goto step 3
Step5: print the value of sum
Step6: Stop
PREETHA V AP/CSE, SRIT
Pseudocode
r = 0,sum=0
while no
n>0
yes
r=n%10
sum=sum *10 + r
n=n/10
Print sum
PREETHA V AP/CSE, SRIT
stop
Armstrong Number
Example: 153
13 +53 + 33 =153
a = n,sum=0
while
n>0 no
yes
r=n%10
sum=sum + r*r*r
n=n/10
if
a=sum
Print It is Not an
Print Armstrong No Armstrong No
PREETHA V AP/CSE, SRIT
stop
Finding the Fibonacci series
Algorithm
Step1: Start
Step2: Read the value of n and set f=0,f1=-1, f2=1
Step3: While (f<n) do
f=f1+f2
f1=f2
f2=f
Print f
else Goto step5
Step4: Goto step 3
Step5: Stop
f=0,f1= -1,f2=1
while no
f<n
yes
f=f1+f2
f1=f2
f2=f
Print f
stop
Finding the sum of odd number between 1
to n
Algorithm
Step1: Start
Step2: Read the value of n and set sum=0,i=1
Step3: While (i<=n) do
sum=sum+i
i=i+2
else Goto step5
Step4: Goto step 3
Step5: Print sum
Step6: Stop
sum=0,i=1
While i<=n
sum=sum+i
i=i+2
Print sum
sum=0,i=0
While i<=n
sum=sum+i
i=i+2
Print sum
Algorithm
Step1: Start
Step2: Read the value of n and set i = 0, sum = 0
Step3: While n>0 do
r=n%10
sum=sum + r*pow(2,i)
n=n/10
i=i+1
else Goto step5
Step4: Goto step 3
Step5: print the value of sum
Step6: Stop
PREETHA V AP/CSE, SRIT
Pseudocode
sum=0,i=0
While n>0
r=n%10
sum=sum + r*Pow(2,i)
n=n/10
i=i+1
Print sum