0% found this document useful (0 votes)
89 views113 pages

Lec 5 (NO NEED)

The document provides an overview of the basic components of a computer system. It describes the major hardware components including the central processing unit (CPU), memory, input devices like keyboards and mice, output devices like monitors and printers, and secondary storage devices like hard drives and CD drives. It also explains the functions of these components and how they work together in the classic von Neumann architecture to process data as an information processing system.

Uploaded by

ShujaAmjad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views113 pages

Lec 5 (NO NEED)

The document provides an overview of the basic components of a computer system. It describes the major hardware components including the central processing unit (CPU), memory, input devices like keyboards and mice, output devices like monitors and printers, and secondary storage devices like hard drives and CD drives. It also explains the functions of these components and how they work together in the classic von Neumann architecture to process data as an information processing system.

Uploaded by

ShujaAmjad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 113

Computing Fundamentals

Computer

• COMPUTER is an electronic machine that


follows a set of instructions in order that it
may be able to accept and gather data and
transform these into information.
• Information Processing System
Computer vs Calculator
• Computers and calculators originated from the same source
• share similar features
• both are programmable electronic devices
• able to complete basic math operations,
• computers are more complex and can perform multiple calculations at the
same time.
• A calculator can work only with numbers. But so can a computer.
• Modern calculators are extremely fast in carrying out complex
calculations. But so are computers.
• Then what is the difference between the two?
• calculators can carry only one function at a time.
• Even when you need to solve a small problem, you need to press a
number of buttons to arrive at the solution.
• A computer is capable of carrying out many operations withut
assistannce.
• Computer programs are series of instructions that are given to
computers
• Can perform complex calculations without assistance with
them
Computer vs Calculator
• On the other hand, you need to keep on pushing buttons
• to solve even easy math problems when using a calculator.

• The word computer has become very broad in modern times and has come to
include smart devices such as Smartphone, MP3 players, desktops, laptops.
• These devices all have also basic calculator that can perform simple math
operations
• but they are capable of many more operations which are beyond the
capacity of a calculator.
Information Processing System

• DATA is a collection of independent and


unorganized facts.
• INFORMATION is the processed and organized
data presented in a meaningful form.
• DATA PROCESSING is the course of doing
things in a sequence of steps.
PROCESSING
SYSTEM

DATA INFORMATION
Functions of an Information Processing
System
1. It accepts and gather data. (INPUT)
2. It processes data to become information.
(PROCESSING)
3. It stores data and information. (STORE)
4. It presents information. (OUTPUT)
Three Major Components of an
Information Processing System

• HARDWARE is the tangible part of a computer


system.
• SOFTWARE is the non-tangible part that tells
the computer how to do its job.
• PEOPLEWARE refer to people who use and
operate the computer system, write computer
programs, and analyze and design the
information system.
Major Parts of a Computer

Dr. Muhammad Yousaf Hamza


Parts of a computer
Hardware
Software
BASIC PC HARDWARE
• HARDWARE is the tangible part of a computer
system.
Software
• Instructions that tell the computer how to
process data into the form you want.
• Software and programs are interchangeable.
• Two major types:
– System and Applications
Computer Hardware
Physical parts of the computer, including
processor and memory chips, input/output
devices, tapes, disks, modems, cable, etc.
Computer Parts

• There are many parts


that work together to
make a computer
work.
Parts of a Computer
A Common Computer
“The Box”
CRT Display CD-ROM Drive

Floppy
Disk
Drive

Keyboard

Mouse
Basic parts-
Basic Parts-
Mother Board
The von Neumann architecture

CPU
Input Device Output Device
ALU CU

Main memory Secondary


(RAM) storage
The von Neumann architecture
• Central Processing Unit (CPU): the “brain” of the machine.
– CU: Control Unit
– ALU: Arithmetic and Logic Unit
• Carries out all basic operations of the computer
• Examples of basic operation: adding two numbers, testing to see
if two numbers are equal.
• Main memory (called RAM for Random Access Memory): stores
programs and data
– Fast but volatile
• Secondary memory: provides permanent storage
• Human-computer interaction: through input and output devices.
– keyboard, mouse, monitor
– Information from input devices is processed by the CPU and may be
sent to the main or secondary memory. When information needs to
be displayed, the CPU sends it to the output device(s).
Basic Parts
Basic Parts-01
CPU Inside a CPU
CPU

• The Central Processing


Unit
Processor

• The CPU – The chip or


chips that interpret
and execute program
instructions and
manage the functions
of input, output, and
storage devices.
Computer Case

• Contains the major


components of the
computer. It helps
protect them.
Monitor

• A display screen to
provide “output” to
the user. It is where
you view the
information your are
working on.
Video Card

• Connects the computer to


the monitor. It is a circuit
board attached to the
motherboard that
contains the memory and
other circuitry necessary
to send information to the
monitor for display on
screen.
Keyboard

• Used to enter
information into the
computer and for
giving commands.
Mouse

• An input device operated


by rolling its ball across a
flat surface. The mouse is
used to control the on-
screen pointer by pointing
and clicking, double-
clicking, or dragging
objects on the screen.
Touchpad

• A pressure-sensitive
and motion sensitive
device used in place of
a mouse.
CD Rom Drive

• The drive that plays


CDs and reads data
that has been stored
on the CD.
CD

• Compact Disk – A type


of optical storage
device.
Floppy Disk Drive

• A device that holds a


removable floppy disk
when in use;
read/write heads read
and write data to the
diskette.
Hard Disk

• Magnetic storage
device in the
computer.
RAM

• Random Access Memory


RAM is a computer’s
temporary memory, which
exists as chips on the
motherboard near the
CPU. It stores data or
programs while they are
being used and requires
power.
Memory Unit
• Where the programs and data
are stored .
– READ ONLY MEMORY (ROM)
contains the pre-programmed
computer instructions such as
the Basic Input Output System
(BIOS).
– RANDOM ACCESS MEMORY
(RAM) is used to store the
programs and data that you will
run. Exists only when there is
power.
Printer

• An output device that


produces a hard copy
on paper. It gives
information to the
user in printed form.
Barcode Reader

• An input device that


converts a pattern of
printed bars into a
number that a
computer can read.
They are often used
by businesses to
quickly input price and
product information.
Scanner

• A device that allows


pictures to be placed
into a computer.
Microphone

• Allows the user to


record sounds as input
to their computer.
Speakers

• Used to generate or
reproduce voice,
music, and other
sounds.
Sound Card

• Connects the speakers


and microphone to
the computer.
Modem

• The place where the


computer is
connected to the
phone line.
Network Card

• A circuit board that


connects the
computer to the rest
of the network usually
using special cables.
Basic hardware of a PC system
• Central Processing Unit (CPU)
• Memory Unit
• Input Devices
• Output Devices
• Secondary Storage Devices
Central Processing Unit

• Brain of the computer.


• It directs and controls the entire computer
system and performs all arithmetic and logical
operations.
Input Devices
• Allows data and programs to be sent to the
CPU.
– Keyboard
– Mouse
– Joystick
– Microphone
– Webcam
– Scanner
– Monitor
Two Types of Mouse

• Mechanical - a type of
computer mouse that has a
rubber or metal ball on its
underside and it can roll in
every direction.
• Optical: This type uses a
laser for detecting the
mouse's movement.
Other Pointing Devices

• Trackball

• Touch pad

• Touch Screen
• Joystick – input device for
computer games

• Light Pens – light-sensitive


penlike device

• Stylus – penlike device


commonly used with tablet
PCs and PDAs.
Scanning Devices
• Optical scanners
• Card readers
• Bar code readers
• Character and mark recognition devices
Image Capturing Devices

• Digital Video Cameras


Output Devices
• Media used by the computer in displaying its
responses to our requests and instructions.
• Monitor
• Audio Speakers
• Printer
Dot matrix
printer

Laser Inkjet printer


printer
Secondary Storage Devices
• Attached to the computer system to allow you
to store programs and data permanently for
the purpose of retrieving them for future use.
• Floppy disk, Hard disk, CD Rom
Floppy Disk
• The most common secondary storage device
• 3.5” disk – 1.44MB
High-Capacity Floppy Disks
• Floppy disk cartridges
• 3 ½ inches in diameter
• Stores more information
• Zip disks
Hard Disk Drive or Hard Disk

• Made of rigid materials unlike floppy disks


• Holds a greater amount of data
Optical Discs
• A standard part of modern desktop machines,
especially used for multimedia purposes and
preferred in loading applications.
Optical Drives

• CD-ROM read CDs


• CD-Writer read/write CDs
• DVD-Combo read/write CDs, read DVD
• DVD Writer read/write CDs
read/write DVDs
Other Secondary Storage
• Solid-State Storage
– No moving parts
– Flash memory cards

– USB flash drives


Parts that Build Up A System Unit
• Casing or cover • Sound card
• Power Supply • Floppy disk drive
• Motherboard • Hard disk drive
• Microprocessor • CD-ROM drive
• Memory • MODEM
• Video Card
Casing or cover

• The box or outer shell


that houses most of the
computer, it is usually one
of the most overlooked
parts of the PC.
• Protects the computer
circuits, cooling and
system organization.
Power Supply
• Responsible for powering every device in your
computer.
• Parts of a Power supply:
– Disk drive connectors
– Motherboard connector
– Power supply fan
– Power switch
– Input voltage selector
– Cover
– Power plugs receptacle
Motherboard
• The physical arrangement in a computer that
contains the computer’s basic circuitry and
components.
• Components are:
– Microprocessor
– (Optional) Coprocessors
– Memory
– Basic Input/Output System (BIOS)
– Expansion Slot
– Interconnecting circuitry
Expansion Slots
• Graphic cards
• Sound cards
• Modem cards
• Network interface cards/network adapter
History of Computers

Dr. Muhammad Yousaf Hamza


The History of Computing
• 3000 B.C.: The Abacus
– The original mechanical counting device
• Arithmometer
– 1820, first computing machine used by clerks
• 1822: Charles Babbage’s Difference Engine

• This machine would


be able to compute
tables of numbers,
such as logarithm
tables.
• Babbage was not
deterred, and by
then was on to his
next brainstorm,
which he called the
Analytic Engine.
• 1842: Charles Babbage’s Analytical Engine
• Charles Babbage’s Analytical Engine

• This device, large as a house and powered


by 6 steam engines
• The Analytic Engine also had a key
function that distinguishes computers
from calculators: the conditional
statement.
• A conditional statement allows a program
to achieve different results each time it is
run.
• Based on the conditional statement, the
path of the program can be determined
based upon a situation that is detected at
the very moment the program is running.
Turing Machines
• Before determining what computers are ultimately capable
of, one must answer the following questions:
– What is computation?
– What are “reasonable” steps that can be performed in a
computation?

• Formally, computation is represented by a mathematical


model called a Turing Machine.
– Proposed in 1926 by Alan Turing to model “any possible
computation”
– Detailed discussion of Turing machines is beyond the
scope of this course.
• 1975: Microsoft and Bill Gates
– Bill gates and Paul Allen formed Microsoft Corporation,
now the largest and most influential software company
in the world
• 1976: The Apple I
– Steve Jobs and Steve Wozniak, along with Ronald G.
Wayne formed the Apple Computer Company
• 1981: The IBM PC
– IBM tossed its hat into the personal computer ring with
its announcement of the IBM Personal Computer
• 1984: The Macintosh and Graphical User
Interfaces
– Apple Computer introduced the Macintosh desktop
computer with a very friendly graphical user interface
• 1985-Present: Microsoft Windows
– Microsoft introduced Windows, a GUI for IBM PC-
compatible computers in 1985
Basic Units of Measurement

• BIT is a unit of information equivalent to the


result of a choice between only 2 possible
alternatives in the binary number system.
• BYTE is a sequence of 8 bits (enough to
represent one character of alphanumeric
data) processed as a single unit for
information.
Basic Units of Measurement

• A byte can be used to represent a single


character, which can be:
– A letter
– A number
– A special character or symbol, or
– A space
Basic Units of Measurement
• 1,024 bytes =1 kilobyte (KB)
1,024 KB =1 megabyte (MB)
1,024 MB =1 gigabyte (GB)
1,024 GB =1 Terabyte (TB)
ALGORITHMS AND FLOWCHARTS

Dr. Muhammad Yousaf Hamza


ALGORITHMS AND FLOWCHARTS

• A typical programming task can be divided into two


phases:
• Problem solving phase
– produce an ordered sequence of steps that describe
solution of problem
– this sequence of steps is called an algorithm
• Implementation phase
– implement the program in some programming language
Steps in Problem Solving
• First produce a general algorithm (one can use
pseudocode)
• Refine the algorithm successively to get step by step
detailed algorithm that is very close to a computer
language.
• Pseudocode is an artificial and informal language
that helps programmers develop algorithms.
Pseudocode is very similar to everyday English.
Pseudocode & Algorithm
• Example 1: Write an algorithm to determine a
student’s final grade and indicate whether it is
passing or failing. The final grade is calculated
as the average of four marks.
Pseudocode & Algorithm
Pseudocode:
• Input a set of 4 marks
• Calculate their average by summing and dividing by 4
• if average is below 50
Print “FAIL”
else
Print “PASS”
Pseudocode & Algorithm
• Detailed Algorithm
• Step 1: Input M1,M2,M3,M4
Step 2: GRADE ← (M1+M2+M3+M4)/4
Step 3: if (GRADE < 50) then
Print “FAIL”
else
Print “PASS”
endif
The Flowchart
• (Dictionary) A schematic representation of a sequence of
operations, as in a manufacturing process or computer
program.
• (Technical) A graphical representation of the sequence of
operations in an information system or program. Information
system flowcharts show how data flows from source
documents through the computer to final distribution to
users. Program flowcharts show the sequence of instructions
in a single program or subroutine. Different symbols are used
to draw each type of flowchart.
The Flowchart
A Flowchart
– shows logic of an algorithm
– emphasizes individual steps and their
interconnections
– e.g. control flow from one action to the next
Flowchart Symbols
Basic
Name Symbol Use in Flowchart

Oval Denotes the beginning or end of the program

Parallelogram Denotes an input operation

Rectangle Denotes a process to be carried out


e.g. addition, subtraction, division etc.

Diamond Denotes a decision (or branch) to be made.


The program should continue along one of
two routes. (e.g. IF/THEN/ELSE)

Hybrid Denotes an output operation

Flow line Denotes the direction of logic flow in the program


Example
START
Step 1: Input M1,M2,M3,M4
Step 2: GRADE ← (M1+M2+M3+M4)/4
Input
M1,M2,M3,M4
Step 3: if (GRADE <50) then
Print “FAIL”
else
GRADE←(M1+M2+M3+M4)/4 Print “PASS”
endif
N IS Y
GRADE<5
0

PRINT PRINT
“PASS” “FAIL”

STOP
Example 2
• Write an algorithm and draw a flowchart to
convert the length in feet to centimeter.
Pseudocode:
• Input the length in feet (Lft)
• Calculate the length in cm (Lcm) by
multiplying LFT with 30
• Print length in cm (LCM)
Example 2
Algorithm Flowchart

• Step 1: Input Lft START

• Step 2: Lcm ← Lft x 30 Input


Lft

• Step 3: Print Lcm


Lcm ← Lft x 30

Print
Lcm

STOP
Example 3
Write an algorithm and draw a flowchart that will
read the two sides of a rectangle and calculate its
area.
Pseudocode
• Input the width (W) and Length (L) of a rectangle
• Calculate the area (A) by multiplying L with W
• Print A
Example 3

Algorithm START

• Step 1: Input W,L Input

• Step 2: A ← L x W
W, L

• Step 3: Print A A←LxW

Print
A

STOP
Example 4

• Write an algorithm and draw a flowchart that will


calculate the roots of a quadratic equation
ax 2 + bx + c =0
• Hint: d = sqrt ( b 2 − 4),
acand the roots are: x1 =
(–b + d)/2a and x2 = (–b – d)/2a
Example 4
Pseudocode:
• Input the coefficients (a, b, c) of the quadratic
equation
• Calculate d
• Calculate x1
• Calculate x2
• Print x1 and x2
Example 4
START

• Algorithm:
• Step 1: Input a, b, c Input
a, b, c
• Step 2: d ← sqrt ( b × b − 4 × a ×
) c
• Step 3: x1 ← (–b + d) / (2 x a) d ← sqrt(b x b – 4 x a x c)

• Step 4: x2 ← (–b – d) / (2 x a)
x1 ←(–b + d) / (2 x a)
• Step 5: Print x1, x2
X2 ← (–b – d) / (2 x a)

Print
x1 ,x2

STOP
DECISION STRUCTURES
• The expression A>B is a logical expression
• it describes a condition we want to test
• if A>B is true (if A is greater than B) we take the
action on left
• print the value of A
• if A>B is false (if A is not greater than B) we take the
action on right
• print the value of B
DECISION STRUCTURES

Y N
is
A>B

Print Print
A B
IF–THEN–ELSE STRUCTURE
• The structure is as follows
If condition then
true alternative
else
false alternative
endif
IF–THEN–ELSE STRUCTURE
• The algorithm for the flowchart is as follows:
If A>B then
print A
else Y
is
N

print B A>B

endif
Print Print
A B
Relational Operators

Relational Operators
Operator Description
> Greater than
< Less than
= Equal to
≥ Greater than or equal to
≤ Less than or equal to
≠ Not equal to
Example 5
• Write an algorithm that reads two values, determines the
largest value and prints the largest value with an identifying
message.
ALGORITHM
Step 1: Input VALUE1, VALUE2
Step 2: if (VALUE1 > VALUE2) then
MAX ← VALUE1
else
MAX ← VALUE2
endif
Step 3: Print “The largest value is”, MAX
Example 5
START

Input
VALUE1,VALUE2

Y is
N
VALUE1>VALUE2

MAX ← VALUE1 MAX ← VALUE2

Print
“The largest value is”,
MAX

STOP
NESTED IFS
• One of the alternatives within an IF–THEN–
ELSE statement
– may involve further IF–THEN–ELSE statement
Example 6
• Write an algorithm that reads three numbers
and prints the value of the largest number.
Example 6
Step 1: Input N1, N2, N3
Step 2: if (N1>N2) then
if (N1>N3) then
MAX ← N1 [N1>N2, N1>N3]
else
MAX ← N3 [N3>N1>N2]
endif
else
if (N2>N3) then
MAX ← N2 [N2>N1, N2>N3]
else
MAX ← N3 [N3>N2>N1]
endif
endif
Step 3: Print “The largest number is”, MAX
Example 6
• Flowchart: Draw the flowchart of the above
Algorithm.

You might also like