Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Raghavendra Educational Institutions Society (R)
www.skit.org.in
Title: Introduction to computers
CO addressed: CO1
Course: BESCK204E
Presented by: Dr Nirmala S Guptha
Department: CSE
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
2
/skit.org.in
Introduction to Computers
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
3
/skit.org.in
DEFINITION
3/19/2025
4
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
CHARACTERISTICS OF COMPUTERS
Speed Accuracy Automation
Diligence
Versatile
Memory No I.Q.
Economical
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
5
/skit.org.in
STORED PROGRAM CONCEPT
While data is being read/written, the central processing unit (CPU) executes another program in the memory that is ready for execution.
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
6
/skit.org.in
Types of Stored Program Computers
•
Processor
Main Memory
Address Bus - carries addresses
Data Bus - carries data and instructions
Instruction memory
Processor
Data Memory
Data Address
Read/Write Data
Instruction Address
Instructions
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
7
/skit.org.in
1822
1890
1936
1941
1943
1944
300BC
Charles Babbage
steam-driven
Difference
Engine
Turing Machine
computing anything
HISTORY OF COMPUTERS
Timeline of Developments
Abacus
for mathematical computations
ENIAC
First digital
computers
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
8
/skit.org.in
HISTORY OF COMPUTERS
Timeline of Developments
1947
1953
1954
1958
1969
1946
vacuum tubes replaced
transistor
Formula Translation
FORTRAN
Unix
Operating System
UNIVAC
first
commercial
computer
COBOL
first computer language
Integrated Circuit
Chip
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
9
/skit.org.in
HISTORY OF COMPUTERS
Timeline of Developments
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
HISTORY OF COMPUTERS
Generations of Computers(evolution)
First Generation
(1942–
1955)
Used for
Scientific
applications
Examples
ENIAC EDVAC
EDSACUNIVAC I
IBM 701
Highlights
Bulky
Vacuum tubes emitted heat and burned Costly
Difficult to use
Constant maintenance
Hardware Technolog
Vacuum tubes which is made of fragile
glass
Memory
Primary: Electromagnetic relay
Secondary:
punched cards
Software Technolog
1
Programming was done in machine or assembly language.
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Second Generation (1955–
1964)
HISTORY OF COMPUTERS
Generations of Computers(evolution)
Used for
Scientific and commercial applications
Examples
Honeywell 400
IBM 7030
CDC 1604 UNIVAC LARC
Highlights
st
Bulky
less heat than 1st Gen
Faster than 1 Gen
Costly
Difficult to use
Consumed 1/10 than
Hardware
Technology
Memory
Transistors: reliable
, powerful,
cheaper, smaller & cooler .
Primary: Magnetic
core
Secondary: Magne tic tapes and disks
Software
Technology
1
Programming was done in High Level programming
languages
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Third Generation
(1964–
1975)
Used for
Scientific, Commercial & Interactive
online applications
Examples
IBM 360/370
PDP-8 & PADP-11,
CDC6600
Highlights
Bulky
nd
nd
less heat than 2 Gen
Faster than 2 Gen Costly
Difficult to use
Consumed less
Hardware Technology
Memory
integrated chips (ICs):
SSI and MSI technology
Primary: Large Magnetic core Secondary: Large Magnetic tapes & disks
Software Technology
1
Programming was done in High Level Language
Time sharing OS
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Fourth Generation (1975–
1989)
Used for
Scientific, Commercial, Intera ctive online & Network
Highlights
Faster, smaller,
cheaper, powerful, reliable, and easier
Examples
IBM PC, Apple II, TRS-
80, VAX 9000, CRAY- 1, CRAY-2, CRAY-X/MP
Hardware Technology
integrated chips (ICs):
LSI and VLSI
LAN & WAN
Memory
Primary: Semiconductor Secondary:
Large Magnetic tapes,
disks & Floppy
Software Technology
1
Programming was done in High Level Language- 'C'
GUI-OS
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Supercomputers
Mainframe computers
Minicomputers
Microcomputers
1
CLASSIFICATION OF COMPUTERS
(speed, amount of data processing & price)
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
CLASSIFICATION OF COMPUTERS
1
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
APPLICATIONS OF COMPUTERS
1
and development
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
BASIC ORGANIZATION OF A COMPUTER
1
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Input:
Strorage:
Processing (ALU):
Output :
Control (CU):
1
BASIC ORGANIZATION OF A COMPUTER
A computer performs five major operations:
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
INSIDE THE COMPUTER
1
3/19/2025
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
CPU
RAM
HDD
Video card
Sound card
Modem
Network card
Fans
Cables
2
INSIDE THE COMPUTER
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
MOTHERBOARD
2
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
MOTHERBOARD
2
I/O connectors
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Processor socket
in Zero Insertion Force (ZIF) sockets
RAM connectors
Expansion slots
I/O connectors
MOTHERBOARD
Characteristics of a Motherboard
Form factor
Integrated components
bus, processor, cache memory, RAM
Chipset
CMOS clock and battery
Basic Input/Output System (BIOS)
memory (ROM)
2
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
2
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Input Devices
Keyboard
Pointing devices
Mouse Trackball
Trackpad
Handheld devices
Pen Touchscreen
Joystick
Optical devices
Barcode reader Scanners
OCR
OMR
MICR
Audio/Visual devices
2
INPUT DEVICES
To feed data and instructions into a computer
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
INPUT DEVICES
2
1.1 Keyboard
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Numeric keys
- and +.
Function keys
Control keys
Inside the Keyboard
Advantage
Disadvantages
2
INPUT DEVICES
1.1 Keyboard
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
INPUT DEVICES
2
1.2 Pointing Devices
Mouse
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Trackball
one of the buttons to select objects or position the cursor for text entry
Advantages
Disadvantages
INPUT DEVICES
2
1.2 Pointing Devices
Trackball used like a mouse
Trackball on keyboard
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Touchpad
the screen.
Advantages
movements
INPUT DEVICES
3
1.2 Pointing Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Joystick
Stylus
Touch screen
3
INPUT DEVICES
1.3 Handheld Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Barcode Reader
Advantages
Disadvantages
3
INPUT DEVICES
1.4 Optical Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Image Scanner
digital image for computer editing and display
Advantages
Disadvantages
3
INPUT DEVICES
1.4 Optical Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Optical Character Recognition (OCR) Device
Advantages
Disadvantages
INPUT DEVICES
1.4 Optical Devices
Uses:
Printed
Documents
OCR Technology
Computer readable Text files of size 2- 3KB per page
Scans the documents and makes a bitmap of size 50-150KB per page
3
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Optical Mark Recognition (OMR) Device
Advantages
Disadvantages
INPUT DEVICES
3
1.4 Optical Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Magnetic Ink Character Reader
Advantages
INPUT DEVICES
3
1.4 Optical Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Either capture or create sound
Audio Devices
Video Input Devices Capture video from the outside world into the computer
Advantages
Disadvantages
3
INPUT DEVICES
1.5 Audio-visual Input Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
3
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Output Devices
Soft Copy Devices
Monitor
Projector
Speaker
Hard Copy Devices
Printer
Plotter
3
OUTPUT DEVICES
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
video card.
Three variants
4
OUTPUT DEVICES
2.1 Soft Copy Devices
3/19/2025
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
CRT Monitor
Work by firing charged electrons at a phosphorus film
When electrons hit the phosphor-coated screen, they glow, thereby enabling the user to see the output.
Advantages
CRT monitors provide images of good quality
CRT monitors are cheapest when compared to LCD and plasma monitors
The images are clear even when you try to view it from an angle.
Disadvantages
CRT monitors occupy a large space on the desk.
They are bigger in size and weight, so difficult to move from one place to another
Power consumption is higher than the other monitors.
OUTPUT DEVICES
4
2.1 Soft Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
LCD Monitor
A thin, flat, electronic visual display, uses the light modulating properties of liquid crystals,
which do not emit light directly
LCD screens are more compact, lightweight, portable, more reliable, easier on the eyes, energy efficient and offer safer disposal than CRTs
Most LCD displays use active matrix technology in which a thin film transistor (TFT) arranges tiny transistors and capacitors in a matrix on the glass of the display
Advantages
Very compact and lightweight consume less power.
They do not suffer from geometric distortion and Little or no flicker of images
Made in almost any size or shape and cause less eye fatigue
More reliable than CRTs
Disadvantages
Images are not very clear when tried to view from an angle
Expensive than CRTs.
OUTPUT DEVICES
4
2.1 Soft Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Plasma monitor
Advantages
Thin and flat monitors used in TVs and computers and two glass plates that have tiny cells filled
with xenon and neon gas The display electrode is covered by a magnesium oxide protective layer and arranged in
horizontal rows along the screen while the address electrodes are arranged in vertical columns
The electrodes that intersect at that cell are charged, current flow through the gas which creates a
rapid flow of charged particles to stimulate the gas atoms to release Ultra-Violet photons
The technology used in plasma monitors allows producing a very wide screen using extremely
thin materials
Very bright images are formed which look good from almost every angle
These monitors are not heavy and are thus easily portable
Disadvantages
Very expensive and High power consumption.
The images are phosphor-based, at times, they may suffer from flicker
OUTPUT DEVICES
4
2.1 Soft Copy Devices
3/19/2025
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Projector
or a game and the voice will be spread through the entire room
people
Speakers
4
OUTPUT DEVICES
2.1 Soft Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
OUTPUT DEVICES
4
2.2 Hard Copy Devices
Printers
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
OUTPUT DEVICES
4
2.2 Hard Copy Devices
in dots per inch (dpi). Even the least inexpensive printer provides sufficient resolution for most purposes at 600 dpi.
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Printers
Impact primers
Dot Matrix
Daisy wheel
Line
Non-Impact printers
Inkjet
Laser
4
OUTPUT DEVICES
2.2 Hard Copy Devices
3/19/2025
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Impact Printer
Advantages
Disadvantages
4
OUTPUT DEVICES
2.2 Hard Copy Devices
3/19/2025
/skit.org.in
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Non-impact
printer
either sprayed, dripped or electro statically drawn
Advantages
Disadvantages
4
OUTPUT DEVICES
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Dot matrix printer
Advantages
Disadvantages
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Daisy wheel printer
embossed at the outer end of the arms
to leave an impression on the paper
3/19/2025
/skit.org.in
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Line printer
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Band Printer
the paper
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Inkjet printer
images.
and yellow).
3/19/2025
/skit.org.in
5
OUTPUT DEVICES
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Laser printer
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Plotters
more automated pens
under the control of the computer.
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Plotters
OUTPUT DEVICES
5
2.2 Hard Copy Devices
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
5
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
its integrity
application makes the size of the program large but also makes it difficult to debug and maintain
MOV AX, A ADD AX, B MOV SUM, AX JMP STOP
…………….. STOP: EXIT
ADB 10
BDB 20
SUM DB?
Global data
5
Sequential code with
!MP
instruction
Structure of a monolithic program
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
1.2 Procedural Programming
languages
Program
Global Data
Subroutine
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
1.3 Structured Programming
Program
Global Data
Modules that have Global data, local data and code
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
1.3 Structured Programming
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
1.4 Object-oriented Programming (OOP)
the data.
functions.
Object1
Object 4
Object 2
Object3
Objects of a program interact by sending
messages to each other
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
2. Example of a Structured Program
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Requirem ents Analysis
Design
Impleme ntation
Testing
Software Deploym ent, Training & Support
Maintena nce
6
DESIGNING EFFICIENT PROGRAMS
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Requirements
Analysis
form of algorithms or flowcharts.
system programs and Visual Basic for writing an application program.
production environment.
6
Design
Implementation
Testing
Software Deployment, Training& Support
Maintenance
DESIGNING EFFICIENT PROGRAMS
3. Design and Implementation of Efficient Programs
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
6
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Step 1: Input first number as A Step 2: Input second number as B Step 3: Set Sum = A + B
Step 4: Print Sum Step 5: End
Algorithm to add two numbers
6
DESIGNING EFFICIENT PROGRAMS
Control Structures Used In Algorithms
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
Control Structures Used In Algorithms
Step 1:
Step 2:
Step 3:
7
Step 4:
Input first number as A Input second number as B IF A=B
Print “Equal” ELSE
Print “Not Equal” [END OF IF]
End
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Step 1:
Step 2:
Step 3:
Step 4:
7
Step 5:
[initialize] Set I = 1, N = 10 Repeat Steps 3 and 4 while I <= N Print I
SET I = I + 1 [END OF LOOP]
End
DESIGNING EFFICIENT PROGRAMS
Control Structures Used In Algorithms
Algorithm to print the first 10 natural numbers
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Example 1
Write an algorithm for interchanging/swapping two values.
Step 1: Input first number as A Step 2: Input second number as B Step 3: Set temp = A
Step 4: Set A = B
Step 5: Set B = temp Step 6: Print A, B Step 7: End
7
DESIGNING EFFICIENT PROGRAMS
4.1 Algorithms
Algorithms Examples:
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Example 2
Write an algorithm for interchanging/swapping two values.
7
DESIGNING EFFICIENT PROGRAMS
4.1 Algorithms
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
4.1 Algorithms
Example 3
Write an algorithm to find whether a number is even or odd.
7
•
•
•
Input number as A
IF A % 2 = 0
Print "Even"
ELSE
Print "Odd"
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Example 4
Write an algorithm to print the grade obtained by a student using the following rules.
7
DESIGNING EFFICIENT PROGRAMS
4.1 Algorithms
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Example 5
Write an algorithm to find the sum of first N natural numbers.
Step 1: Input N
Step 2: Set I = 1, sum = 0
Step 3: Repeat Steps 4 and 5 while I <= N Step 4: Set sum = sum + I
Step 5: Set I = I + 1
[END OF LOOP]
Step 6: Print sum Step 7: End
7
DESIGNING EFFICIENT PROGRAMS
4.1 Algorithms
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
| Start or Stop |
| Arrows |
| Processing Step |
| Input/Output |
| Decision |
| Connector |
DESIGNING EFFICIENT PROGRAMS
4.2 Flowcharts
7
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
4.2 Flowcharts
logic in the process.
7
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
7
4.2 Flowcharts Significance of Flowcharts
A flowchart is a diagrammatic representation that illustrates the sequence of steps that must be performed to solve a problem.
It facilitates communication between programmers and users.
Flowcharts help the programmers to understand the logic of complicated and lengthy problems and makes it easy to write the program in any high-level language
Flowchart are necessary for better documentation of complex programs and it follows the top-down approach in solving problems.
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
8
4.2 Flowcharts Advantages
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
4.2 Flowcharts Limitations
8
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
DESIGNING EFFICIENT PROGRAMS
4.3 Pseudocodes
done. This helps even non-programmers to understand the logic of the designed solution.
8
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Write a pseudocode for calculating the price of a product after adding the sales tax to its original price.
Variables: price of the item, sales tax rate, sales tax, total price
8
DESIGNING EFFICIENT PROGRAMS
4.3 Pseudocodes Pseudocodes Examples:
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Write a pseudocode to calculate the weekly wages of an employee The pay depends on wages per hour and the number of hours worked. Moreover, if the employee has worked for more than 30 hours, then he or she gets twice the wages per hour, for every extra hour that he or she has worked
Variables: hours worked, wages per hour,overtime charges, overtime hrs, salary
8
DESIGNING EFFICIENT PROGRAMS
4.3 Pseudocodes
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Run-time Errors:
dividing a number by zero
opening a file that already exists lack of free memory space
finding square or logarithm of negative numbers
8
DESIGNING EFFICIENT PROGRAMS
5. Types of Errors
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Compile-time Errors:
programming language but are not meaningful to the compiler.
8
DESIGNING EFFICIENT PROGRAMS
5. Types of Errors
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
8
DESIGNING EFFICIENT PROGRAMS
5. Types of Errors
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
prototype.
8
DESIGNING EFFICIENT PROGRAMS
5. Types of Errors
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
Method:
studied. and documented.
Backtracking
Method:
across the entire source code until the real cause of error is detected.
Cause Elimination:
are carried out to eliminate each of them.
9
DESIGNING EFFICIENT PROGRAMS
6. Testing and Debugging Approaches
Debugging includes execution testing and code correction by locating errors in the program code. Once the errors are located, they are isolated and fixed to produce an error-free code. Different approaches applied for debugging a code includes:
Sri Krishna Institute of Technology
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
3/19/2025
/skit.org.in
9