Computer Fundamentals: Pradeep K. Sinha Priti Sinha
Computer Fundamentals: Pradeep K. Sinha Priti Sinha
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 1
Introduction
Chapter 01: Introduction Slide 1/17
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Computer
Data processing
Characteristic features of computers
Computers’ evolution to their present form
Computer generations
Characteristic features of each computer generation
Computer
The word computer comes from the word “compute”,
which means, “to calculate”
Data Processing
Characteristics of Computers
Sr.
Characteristics Description
No.
It can store huge amount of information and can recall any piece
6 Memory
of this information whenever required
Evolution of Computers
Evolution of Computers
Blaise Pascal invented the first mechanical adding
machine in 1642
Baron Gottfried Wilhelm von Leibniz invented the first
calculator for multiplication in 1671
Keyboard machines originated in the United States
around 1880
Around 1880, Herman Hollerith came up with the concept
of punched cards that were extensively used as input
media until late 1970s
Evolution of Computers
Computer Generations
Computer Generations
“Generation” in computer talk is a step in technology. It
provides a framework for the growth of computer industry
Computer Generations
Some
Generation Key hardware Key software Key
representative
(Period) technologies technologies characteristics
systems
First • Vacuum tubes Machine and Bulky in size ENIAC
(1942-1955) • Electromagnetic assembly Highly unreliable EDVAC
relay memory languages Limited commercial
Stored program use commercial EDSAC
• Punched cards concept production difficult and UNIVAC I
secondary storage costly
Mostly scientific IBM 701
applications Difficult to use
Computer Generations
Third ICs with SSI and Timesharing Faster, smaller, more IBM 360/370
(1964-1975) MSI technologies operating system reliable, easier and PDP-8
Larger magnetic cheaper to produce
Standardization PDP-11
core memory Commercially, easier
of high-level CDC 6600
Larger capacity to use, and easier to
programming
magnetic disks and upgrade than previous
languages
tapes secondary generation systems
storage Unbundling of Scientific, commercial
software from and interactive on-line
Minicomputers hardware applications
Computer Generations
Key hardware Key software Key Some
Generation
representative
(Period) technologies technologies Characteristics systems
Fourth ICs with VLSI Operating systems for Small, IBM PC and its
(1975-1989) technology PCs with GUI and Multiple affordable, clones
Microprocessors; windows on a single reliable, and easy Apple II
semiconductor terminal screen to use PCs
Multiprocessor operating More powerful TRS-80
memory
systems and concurrent and reliable VAX 9000
Larger capacity programming languages mainframe
hard disks as in- CRAY-1
UNIX operating system systems
built secondary General purpose CRAY-2
storage C and C++
programming languages machines CRAY-X/MP
Magnetic tapes PC-based applications; Easier to
and floppy disks as produce
network-based
portable storage commercially
applications
media
Object-oriented software
Personal design
computers
Spread of high-
speed computer
networks (Continued on next slide)
Computer Generations
Key hardware Key software Key Some
Generation
representative
(Period) technologies technologies Characteristics systems
Fifth ICs with ULSI World Wide Portable computers iPhone
(1989- technology Web Hand-held mobile iPad
Present) Multicore processor Multimedia, smart devices
chips More powerful, IBM notebooks
Internet-based
Larger capacity main applications cheaper, reliable, and Pentium PCs
memory and hard disks easier to use desktop Windows PC
Microkernel, machines
Optical disks as multithreading, Apple PC
portable read-only Very powerful
multicore OS
storage media mainframes SUN
JAVA, Python Very high uptime Workstations
Solid state disks and other due to hot-pluggable IBM SP/2
Notebook computers programming components
Powerful desktop PCs languages SGI Origin 2000
General purpose
and workstations MPI and PVM PARAM
machines
Very powerful libraries for supercomputers
mainframes Easier to produce
parallel commercially
Supercomputers based programming
on parallel processing
Internet
(Continued on next slide)
Key Words/Phrases
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 2
Basic Computer
Organization
Chapter 02: Basic Computer Organization Slide 1/19
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Basic operations performed by all types of computer
systems
Basic organization of a computer system
Input unit and its functions
Output unit and its functions
Storage unit and its functions
Types of storage used in a computer system
Learning Objectives
Secondary
Storage
Program Information
Input Output (Results)
and
Unit Unit
Data Primary
Storage
Control
Unit
Indicates flow of
instructions and data
Arithmetic
Indicates the control
Logic Unit
exercised by the
control unit
Central Processing Unit (CPU)
Input Unit
An input unit of a computer system performs the
following functions:
Output Unit
An output unit of a computer system performs the
following functions:
Storage Unit
The storage unit of a computer system holds (or stores)
the following :
Types of Storage
The broad categories of storage are:
1. Primary storage
2. Secondary storage
Primary Storage
Secondary Storage
Used to hold stored program instructions
Used to hold data and information of stored jobs
Slower than primary storage
Large Capacity
Lot cheaper that primary storage
Retains data even without power
Arithmetic Central
Logic Unit Control Unit = Processing
+ (CU)
(ALU) Unit (CPU)
Key Words/Phrases
Arithmetic Logic Unit (ALU) Output interface
Auxiliary storage Output unit
Central Processing Unit (CPU) Outputting
Computer system Primate storage
Control Unit (CU) Processing
Controlling Secondary storage
Input interface Storage unit
Input unit Storing
Inputting System
Main memory
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 3
Number Systems
Chapter 03: Number Systems Slide 1/43
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Learning Objectives
Convert a number’s base
Another base to decimal base
Decimal base to another base
Some base to another base
Shortcut methods for converting
Binary to octal number
Octal to binary number
Binary to hexadecimal number
Hexadecimal to binary number
Fractional numbers in binary number system
Number Systems
Difficulty
It is difficult to perform arithmetic with such a
number system
Example
= 2000 + 500 + 80 + 6
= 16 + 0 + 4 + 0 + 1
= 2110
101012 = 2110
Bit
Example
= 1024 + 0 + 40 + 7
= 107110
Example
1AF16 = (1 x 162) + (A x 161) + (F x 160)
= 1 x 256 + 10 x 16 + 15 x 1
= 256 + 160 + 15
= 43110
Method
Example
47068 = ?10
Column values
multiplied
by the
47068 = 4 x 83 + 7 x 82 + 0 x 81 + 6 x 80 corresponding
digits
= 4 x 512 + 7 x 64 + 0 + 6 x 1
= 2048 + 448 + 0 + 6 Sum of these
products
= 250210
Division-Remainder Method
Step 1: Divide the decimal number to be converted by
the value of the new base
Note that the last remainder thus obtained will be the most
significant digit (MSD) of the new base number
Example
95210 = ?8
Solution:
8 952 Remainders
119 0
14 7
1 6
0 1
Method
Example
5456 = ?4
Solution:
Step 1: Convert from base 6 to base 10
5456 = 5 x 62 + 4 x 61 + 5 x 60
= 5 x 36 + 4 x 6 + 5 x 1
= 180 + 24 + 5
= 20910
4 209 Remainders
52 1
13 0
3 1
0 3
Method
Step 1: Divide the digits into groups of three starting
from the right
Example
11010102 = ?8
0012 = 0 x 22 + 0 x 21 + 1 x 20 = 1
1012 = 1 x 22 + 0 x 21 + 1 x 20 = 5
0102 = 0 x 22 + 1 x 21 + 0 x 20 = 2
Method
Step 1: Convert each octal digit to a 3 digit binary
number (the octal digits may be treated as
decimal for this conversion)
Example
5628 = ?2
Method
Example
1111012 = ?16
0011 1101
Method
Example
2AB16 = ?2
Fractional Numbers
Fractional Numbers
Fractional numbers are formed same way as decimal
number system
In general, a number in a number system with base b
would be written as:
an an-1… a0 . a-1 a-2 … a-m
Binary Point
Position 4 3 2 1 0 . -1 -2 -3 -4
Quantity 16 8 4 2 1 1/
2
1/
4
1/
8
1/
16
Represented
Example
Octal Point
Position 3 2 1 0 . -1 -2 -3
Quantity 512 64 8 1 1/
8
1/
64
1/
512
Represented
Example
Key Words/Phrases
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 4
Computer Codes
Chapter 04: Computer Codes Slide 1/36
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
Computer data
Computer codes: representation of data in binary
Most commonly used computer codes
Collating sequence
Data Types
Computer Codes
Computer codes are used for internal representation of
data in computers
As computers use binary numbers for internal data
representation, computer codes use binary coding
schemes
In binary coding, every symbol that appears in the data
is represented by a group of bits
The group of bits used to represent a symbol is called a
byte
Computer Codes
BCD
BCD
Solution:
B= 110010 in BCD binary notation
A= 110001 in BCD binary notation
S= 010010 in BCD binary notation
E= 110101 in BCD binary notation
Using octal notation, show BCD coding for the word DIGIT
Solution:
D = 64 in BCD octal notation
I = 71 in BCD octal notation
G = 67 in BCD octal notation
I = 71 in BCD octal notation
T = 23 in BCD octal notation
Hence, BCD coding for the word DIGIT in octal notation will be
64 71 67 71 23
D I G I T
EBCDIC
EBCDIC
Using binary notation, write EBCDIC coding for the word BIT. How
many bytes are required for this representation?
Solution:
B = 1100 0010 in EBCDIC binary notation
I = 1100 1001 in EBCDIC binary notation
T = 1110 0011 in EBCDIC binary notation
Hence, EBCDIC coding for the word BIT in binary notation will be
ASCII
ASCII
A 0100 0001 41
B 0100 0010 42
C 0100 0011 43
D 0100 0100 44
E 0100 0101 45
F 0100 0110 46
G 0100 0111 47
H 0100 1000 48
I 0100 1001 49
J 0100 1010 4A
K 0100 1011 4B
L 0100 1100 4C
M 0100 1101 4D
(Continued on next slide)
Write binary coding for the word BOY in ASCII-7. How many bytes are required
for this representation?
Solution:
Since each character in ASCII-7 requires one byte for its representation and
there are 3 characters in the word BOY, 3 bytes will be required for this
representation
Write binary coding for the word SKY in ASCII-8. How many bytes are
required for this representation?
Solution:
Since each character in ASCII-8 requires one byte for its representation
and there are 3 characters in the word SKY, 3 bytes will be required for
this representation
Unicode
Unicode
Why Unicode:
No single encoding system supports all languages
Different encoding systems conflict
Unicode features:
Provides a consistent way of encoding multilingual
plain text
Defines codes for characters used in all major
languages of the world
Defines codes for special characters, mathematical
symbols, technical symbols, and diacritics
Unicode
Unicode features (continued):
Capacity to encode as many as a million characters
Assigns each character a unique numeric value and
name
Reserves a part of the code space for private use
Affords simplicity and consistency of ASCII, even
corresponding characters have same code
Specifies an algorithm for the presentation of text
with bi-directional behavior
Encoding Forms
UTF-8, UTF-16, UTF-32
Collating Sequence
Collating Sequence
Collating sequence defines the assigned ordering
among the characters used by a computer
Sorting in EBCDIC
Example
Solution:
A1 < 1A < 23
Sorting in ASCII
Example
Solution:
Therefore, the sorted sequence will be: 1A, 23, 2a, A1, Aa, a2, and
aA
Key Words/Phrases
Alphabetic data
Alphanumeric data
American Standard Code for Information Interchange (ASCII)
Binary Coded Decimal (BCD) code
Byte
Collating sequence
Computer codes
Control characters
Extended Binary-Coded Decimal Interchange Code (EBCDIC)
Hexadecimal equivalent
Numeric data
Octal equivalent
Packed decimal numbers
Unicode
Zoned decimal numbers
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 5
Computer
Arithmetic
Chapter 05: Computer Arithmetic Slide 1/31
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Why Binary?
Bulb
Switch
Circuit
Pulse
Binary Arithmetic
Binary Arithmetic
Binary Addition
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 plus a carry of 1 to next higher column
Solution
Binary Decimal
carry 11 carry 1
10011 19
+1001 +9
11100 28
In this example, carry are generated for first and second columns
Solution
The addition of three 1s
Binary Decimal can be broken up into two
steps. First, we add only
carry 11111 carry 1 two 1s giving 10 (1 + 1 =
100111 39 10). The third 1 is now
added to this result to
+11011 +27 obtain 11 (a 1 sum with a 1
carry). Hence, 1 + 1 + 1 =
1000010 66 1, plus a carry of 1 to next
higher column.
Binary Subtraction
0 - 0 = 0
0 - 1 = 1 with a borrow from the next column
1 - 0 = 1
1 - 1 = 0
Solution
12
0202
10101
-01110
00111
Complement of a Number
Number of digits
in the number
C = Bn - 1 - N
Example
Solution
Example
Find the complement of 68
Solution
Since the number has 1 digit and the value of
base is 8,
(Base)n - 1 = 81 - 1 = 710 = 78
Now 78 - 68 = 18
Hence, complement of 68 = 18
Example
Complement of 1 0 1 1 0 1 0 is
0 1 0 0 1 0 1
Example:
Subtract 5610 from 9210 using complementary method.
Solution
Step 1: Complement of 5610
= 102 - 1 - 56 = 99 – 56 = 4310 The result may be
verified using the
Step 2: 92 + 43 (complement of 56) method of normal
= 135 (note 1 as carry) subtraction:
Result = 36
Example
Subtract 3510 from 1810 using complementary method.
Solution
18 - 35 = -17
Solution
1011100
+1000111 (complement of 0111000)
10100011
0100100
Solution
010010
+011100 (complement of 100011)
101110
Binary Multiplication
0x0=0
0x1=0
1x0=0
1x1=1
Solution
1010 Multiplicand
x1001 Multiplier
1010
x1001
1010
1010SS (S = left shift)
1011010
Binary Division
Table for binary division is as follows:
Example
4 x 8 = 8 + 8 + 8 + 8 = 32
Example
Divide 3310 by 610 using the method of addition
Solution:
33 - 6 = 27
27 - 6 = 21 Since the result of the last
21 - 6 = 15 subtraction is less than zero,
15 - 6 = 9
9-6= 3 Quotient = 6 - 1 (ignore last
3 - 6 = -3 subtraction) = 5
Key Words/Phrases
Additive method of division
Additive method of multiplication
Additive method of subtraction
Binary addition
Binary arithmetic
Binary division
Binary multiplication
Binary subtraction
Complement
Complementary subtraction
Computer arithmetic
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 6
Boolean Algebra
and Logic Circuits
Chapter 06: Boolean Algebra and Logic Circuits Slide 1/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
Boolean algebra
Fundamental concepts and basic laws of Boolean
algebra
Boolean function and minimization
Logic gates
Logic circuits and Boolean expressions
Combinational circuits and their design
Boolean Algebra
Boolean Algebra
Ref. Page 63 Chapter 06: Boolean Algebra and Logic Circuits Slide 4/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 64 Chapter 06: Boolean Algebra and Logic Circuits Slide 5/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
A B = C A B = C
0 0 0 0 0 0 A A
0 1 1 0 1 0
0 1
1 0 1 1 0 0
1 1 1 1 1 1 1 0
Truth Table for OR (+) Truth Table for AND (.) Truth Table for NOT (-)
Ref. Page 64 Chapter 06: Boolean Algebra and Logic Circuits Slide 6/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Operator Precedence
Ref. Page 65 Chapter 06: Boolean Algebra and Logic Circuits Slide 7/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Operator Precedence
XYZ
Ref. Page 65 Chapter 06: Boolean Algebra and Logic Circuits Slide 8/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Postulate 2:
(a) x 0 = x
(b) x 1 = x
Ref. Page 65 Chapter 06: Boolean Algebra and Logic Circuits Slide 9/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Postulate 6:
(a) x x = 1
(b) x x = 0
Ref. Page 65 Chapter 06: Boolean Algebra and Logic Circuits Slide 10/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
For example, in the table below, the second row is obtained from
the first row and vice versa simply by interchanging ‘+’ with ‘.’
and ‘0’ with ‘1’
Ref. Page 66 Chapter 06: Boolean Algebra and Logic Circuits Slide 11/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Some Important Theorems of
Boolean Algebra
2 x+1=1 x0=0
4 x =x Involution Law
5 x (x + y ) = x y x +x y = x + y
Ref. Page 66 Chapter 06: Boolean Algebra and Logic Circuits Slide 12/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 66 Chapter 06: Boolean Algebra and Logic Circuits Slide 13/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Proving a Theorem by Using Postulates
(Example)
Theorem:
x+x·y=x
Proof:
L.H.S.
= xxy
= x1xy by postulate 2(b)
= x (1 y) by postulate 5(a)
= x (y 1) by postulate 3(a)
= x1 by theorem 2(a)
= x by postulate 2(b)
= R.H.S.
Ref. Page 67 Chapter 06: Boolean Algebra and Logic Circuits Slide 14/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Proving a Theorem by Perfect Induction
(Example)
Theorem:
x + x ·y = x
=
x y xy xxy
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
Ref. Page 67 Chapter 06: Boolean Algebra and Logic Circuits Slide 15/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Proving a Theorem by the
Principle of Duality (Example)
Theorem:
x+x=x
Proof:
L.H.S.
=xx
= (x x) 1 by postulate 2(b)
= (x x) (x + X) by postulate 6(a)
= x x X by postulate 5(b)
=x0 by postulate 6(b)
=x by postulate 2(a)
= R.H.S.
Ref. Page 66 Chapter 06: Boolean Algebra and Logic Circuits Slide 16/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Proving a Theorem by the
Principle of Duality (Example)
Dual Theorem:
xx=x
Proof:
L.H.S.
=xx
=xx0 by postulate 2(a) Notice that each step of
the proof of the dual
= x x x X by postulate 6(b)
theorem is derived from
= x (x + X ) by postulate 5(a) the proof of its
=x1 by postulate 6(a) corresponding pair in
=x by postulate 2(b) the original theorem
= R.H.S.
Ref. Page 66 Chapter 06: Boolean Algebra and Logic Circuits Slide 17/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Boolean Functions
Boolean Functions
Binary variables
An algebraic expression, or
A truth table
Ref. Page 70 Chapter 06: Boolean Algebra and Logic Circuits Slide 19/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
W = X + Y ·Z
Variable W is a function of X, Y, and Z, can also be
written as W = f (X, Y, Z)
Ref. Page 70 Chapter 06: Boolean Algebra and Logic Circuits Slide 20/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
X Y Z W
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
W= X+ Y Z
Ref. Page 70 Chapter 06: Boolean Algebra and Logic Circuits Slide 21/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 70 Chapter 06: Boolean Algebra and Logic Circuits Slide 22/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 71 Chapter 06: Boolean Algebra and Logic Circuits Slide 23/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
F1 = x y z + x y z + x y
F1 has 3 literals (x, y, z) and 3 terms
F2 = x y + x z
F2 has 3 literals (x, y, z) and 2 terms
Ref. Page 71 Chapter 06: Boolean Algebra and Logic Circuits Slide 24/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
x y z F1 F2
0 0 0 0 0
0 0 1 1 1
0 1 0 0 0
0 1 1 1 1
1 0 0 1 1
1 0 1 1 1
1 1 0 0 0
1 1 1 0 0
Ref. Page 71 Chapter 06: Boolean Algebra and Logic Circuits Slide 25/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Try out some Boolean Function
Minimization
(a) x x y
(b) x x y
(c) x y z x y z x y
(d) x y x z y z
(e) x y x z y z
Ref. Page 71 Chapter 06: Boolean Algebra and Logic Circuits Slide 26/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
A +A +A +...+A =A A A ...A
1 2 3 n 1 2 3 n
A A A ...A =A +A +A +...+A
1 2 3 n 1 2 3 n
Ref. Page 72 Chapter 06: Boolean Algebra and Logic Circuits Slide 27/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Complementing a Boolean
Function (Example)
F = x y z+ x y z
1
x+ y+z x+ y+z
Now we complement each literal giving
F = x+ y +z x+ y+ z
1
Ref Page. 73 Chapter 06: Boolean Algebra and Logic Circuits Slide 28/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 74 Chapter 06: Boolean Algebra and Logic Circuits Slide 29/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
0 0 1
x yz m1 xyz M 1
0 1 0
x yz m2 xyz M 2
0 1 1
x yz m3 xyz M 3
1 0 0 x yz m4 xyz M 4
1 0 1 x yz m5 xyz M 5
1 1 0 x yz m6 x yz M 6
1 1 1 x yz m7 xyz M 7
Note that each minterm is the complement of its corresponding maxterm and vice-versa
Ref. Page 75 Chapter 06: Boolean Algebra and Logic Circuits Slide 30/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
x x+ y
x+ y z x y+z
xy + xy x y + x y z
Ref. Page 75 Chapter 06: Boolean Algebra and Logic Circuits Slide 31/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Steps to Express a Boolean Function
in its Sum-of-Products Form
Ref. Page 75 Chapter 06: Boolean Algebra and Logic Circuits Slide 32/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Expressing a Function in its
Sum-of-Products Form (Example)
x y z F1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Ref. Page 75 Chapter 06: Boolean Algebra and Logic Circuits Slide 33/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Expressing a Function in its
Sum-of-Products Form (Example)
x y z, x y z, and x y z
Taking the OR of these minterms, we get
Ref. Page 75 Chapter 06: Boolean Algebra and Logic Circuits Slide 34/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 77 Chapter 06: Boolean Algebra and Logic Circuits Slide 35/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Steps to Express a Boolean Function
in its Product-of-Sums Form
Ref. Page 77 Chapter 06: Boolean Algebra and Logic Circuits Slide 36/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Expressing a Function in its
Product-of-Sums Form
x y z F1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Ref. Page 77 Chapter 06: Boolean Algebra and Logic Circuits Slide 37/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Expressing a Function in its
Product-of-Sums Form
Their corresponding maxterms are:
F1 x,y,z = Π 0,2,3,5,6
Ref. Page 77 Chapter 06: Boolean Algebra and Logic Circuits Slide 38/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Conversion Between Canonical Forms
(Sum-of-Products and Product-of-Sums)
Example:
F x,y,z = Π 0,2,4,5 = Σ 1,3,6,7
F x,y,z = Σ 1,4,7 = Σ 0,2,3,5,6
Ref. Page 78 Chapter 06: Boolean Algebra and Logic Circuits Slide 39/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Logic Gates
Logic Gates
Ref. Page 79 Chapter 06: Boolean Algebra and Logic Circuits Slide 41/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
AND Gate
Ref. Page 80 Chapter 06: Boolean Algebra and Logic Circuits Slide 42/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
AND Gate (Block Diagram Symbol
and Truth Table)
A
C= AB
B
Inputs Output
A B C=AB
0 0 0
0 1 0
1 0 0
1 1 1
Ref. Page 80 Chapter 06: Boolean Algebra and Logic Circuits Slide 43/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
OR Gate
Ref. Page 80 Chapter 06: Boolean Algebra and Logic Circuits Slide 44/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
OR Gate (Block Diagram Symbol
and Truth Table)
A
C=A+B
B
Inputs Output
A B C=A +B
0 0 0
0 1 1
1 0 1
1 1 1
Ref. Page 80 Chapter 06: Boolean Algebra and Logic Circuits Slide 45/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
NOT Gate
Ref. Page 81 Chapter 06: Boolean Algebra and Logic Circuits Slide 46/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
NOT Gate (Block Diagram Symbol
and Truth Table)
A A
Input Output
A A
0 1
1 0
Ref. Page 81 Chapter 06: Boolean Algebra and Logic Circuits Slide 47/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
NAND Gate
Ref. Page 82 Chapter 06: Boolean Algebra and Logic Circuits Slide 48/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
NAND Gate (Block Diagram Symbol
and Truth Table)
A
B C=A B=A B=A +B
Inputs Output
A B C =A +B
0 0 1
0 1 1
1 0 1
1 1 0
Ref. Page 82 Chapter 06: Boolean Algebra and Logic Circuits Slide 49/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
NOR Gate
Complemented OR gate
Ref. Page 82 Chapter 06: Boolean Algebra and Logic Circuits Slide 50/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
NOR Gate (Block Diagram Symbol
and Truth Table)
A
B C=A B=A B=A B
Inputs Output
A B C =A B
0 0 1
0 1 0
1 0 0
1 1 0
Ref. Page 82 Chapter 06: Boolean Algebra and Logic Circuits Slide 51/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Logic Cicruits
Logic Circuits
The three logic gates (AND, OR, and NOT) are logically
complete because any Boolean expression can be
realized as a logic circuit using only these three gates
Ref. Page 83 Chapter 06: Boolean Algebra and Logic Circuits Slide 53/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Finding Boolean Expression
of a Logic Circuit (Example 1)
A
A
NOT D= A B + C
B B+C AND
C
OR
Ref. Page 83 Chapter 06: Boolean Algebra and Logic Circuits Slide 54/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Finding Boolean Expression
of a Logic Circuit (Example 2)
OR
A A B
B
C= A +B A B
A B A B AND
AND NOT
Ref. Page 85 Chapter 06: Boolean Algebra and Logic Circuits Slide 55/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Constructing a Logic Circuit from a Boolean
Expression (Example 1)
AND
A A B
B
A B+C
C
OR
Ref. Page 86 Chapter 06: Boolean Algebra and Logic Circuits Slide 56/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Constructing a Logic Circuit from a Boolean
Expression (Example 2)
Boolean Expression = A B+C D+E F
AND NOT
A A B A B
B
AND AND
C C D
D A B+C D+E F
AND
E E F E F
F NOT
Ref. Page 86 Chapter 06: Boolean Algebra and Logic Circuits Slide 57/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 87 Chapter 06: Boolean Algebra and Logic Circuits Slide 58/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementation of NOT, AND and OR
Gates by NAND Gates
AA=A+A=A
A
(a) NOT gate implementation.
A A B A B A B
B
(b) AND gate implementation.
Ref. Page 87 Chapter 06: Boolean Algebra and Logic Circuits Slide 59/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementation of NOT, AND and OR
Gates by NAND Gates
A A =A
A
A B A +B A B
B B=B
B
(c) OR gate implementation.
Ref. Page 87 Chapter 06: Boolean Algebra and Logic Circuits Slide 60/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Method of Implementing a Boolean
Expression with Only NAND Gates
Ref. Page 88 Chapter 06: Boolean Algebra and Logic Circuits Slide 61/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementing a Boolean Expression with
Only NAND Gates (Example)
Boolean Expression = A B +C A +B D
A A B
A B +C A +B D
B
B B D
D A +B D
A
C C A +B D
Ref. Page 89 Chapter 06: Boolean Algebra and Logic Circuits Slide 62/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementing a Boolean Expression with
Only NAND Gates (Example)
AND
OR
A A B
1
B
5
AND OR
B B D
2
D A+BD
A B + C A+B D
3
AND
C A+B D
4
C
Ref. Page 89 Chapter 06: Boolean Algebra and Logic Circuits Slide 63/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementing a Boolean Expression with
Only NAND Gates (Example)
A
1
B A B + C A +B D
5
B
2
D
3
A
4
C
Ref. Page 89 Chapter 06: Boolean Algebra and Logic Circuits Slide 64/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 91 Chapter 06: Boolean Algebra and Logic Circuits Slide 65/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementation of NOT, OR and AND
Gates by NOR Gates
A A =AA =A
A
A A B A B A B
B
Ref. Page 91 Chapter 06: Boolean Algebra and Logic Circuits Slide 66/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementation of NOT, OR and AND
Gates by NOR Gates
A A A =A
A +B A B A B
B B=B
B
Ref. Page 91 Chapter 06: Boolean Algebra and Logic Circuits Slide 67/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Method of Implementing a Boolean
Expression with Only NOR Gates
Ref. Page 92 Chapter 06: Boolean Algebra and Logic Circuits Slide 68/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementing a Boolean Expression with
Only NOR Gates (Examples)
Boolean Expression A B + C A +B D
=
A A B
B A B + C A +B D
B B D
D A +B D
A
C C A +B D
(a) Step 1: AND/OR implementation.
Ref. Page 93 Chapter 06: Boolean Algebra and Logic Circuits Slide 69/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementing a Boolean Expression with
Only NOR Gates (Examples)
AN
A D
A B
1
OR
A B + C A +B D
B
5 6
AN
B D
B D
2
D OR
AN
3 D
A
C A +B D
4
C
A+BD
(b) Step 2: Substituting equivalent NOR functions.
(Continued on next slide)
Ref. Page 93 Chapter 06: Boolean Algebra and Logic Circuits Slide 70/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Implementing a Boolean Expression with
Only NOR Gates (Examples)
A 1
B A B + C A +B D
5 6
B 2
D
3
A
4
C
(c) Step 3: NOR implementation.
Ref. Page 93 Chapter 06: Boolean Algebra and Logic Circuits Slide 71/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Exclusive-OR Function
A B =A B + A B
A C = A B = A B+ A B
B
A C = A B = A B+ A B
B
Also, A B C = A B C = A B C
Ref. Page 94 Chapter 06: Boolean Algebra and Logic Circuits Slide 72/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Inputs Output
A B C =A B
0 0 0
0 1 1
1 0 1
1 1 0
Ref. Page 94 Chapter 06: Boolean Algebra and Logic Circuits Slide 73/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Equivalence Function with Block Diagram
Symbol
A B = A B+ A B
A C = A B = A B+ A B
B
Also, (A B) = A (B C) = A B C
Ref. Page 94 Chapter 06: Boolean Algebra and Logic Circuits Slide 74/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Inputs Output
A B C=AB
0 0 1
0 1 0
1 0 0
1 1 1
Ref. Page 94 Chapter 06: Boolean Algebra and Logic Circuits Slide 75/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Design of
Combinational Circuits
Ref. Page 95 Chapter 06: Boolean Algebra and Logic Circuits Slide 77/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit
Example 1 – Half-Adder Design
Inputs Outputs
A B C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
S = A B+A B
Boolean functions for the two outputs.
C = A B
Ref. Page 96 Chapter 06: Boolean Algebra and Logic Circuits Slide 78/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit
Example 1 – Half-Adder Design
A A B
A
S = A B+ A B
B
B A B
A
B C = A B
Ref. Page 96 Chapter 06: Boolean Algebra and Logic Circuits Slide 79/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit
Example 2 – Full-Adder Design
Inputs Outputs
A B D C S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
Truth table for a full adder
(Continued on next slide)
Ref. Page 97 Chapter 06: Boolean Algebra and Logic Circuits Slide 80/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit
Example 2 – Full-Adder Design
Ref. Page 97 Chapter 06: Boolean Algebra and Logic Circuits Slide 81/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit
Example 2 – Full-Adder Design
A A B D
B
D
A A B D
B
D
S
A
B A B D
D
A A B D
B
D
Ref. Page 98 Chapter 06: Boolean Algebra and Logic Circuits Slide 82/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit
Example 2 – Full-Adder Design
A A B
B
A A D C
D
B BD
D
Ref. Page 98 Chapter 06: Boolean Algebra and Logic Circuits Slide 83/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Designing a Combinational Circuit:
Full-Adder Design using Half-Adders
AB
A
HA C
AB AB A B A B D
B
HA
D S
A BD
Ref. Page 98 Chapter 06: Boolean Algebra and Logic Circuits Slide 84/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
A4 A3 A2 A1
B4 B3 B2 B1
FA FA FA HA
Carry Carry Carry
S5 S4 S3 S2 S1
Ref. Page 99 Chapter 06: Boolean Algebra and Logic Circuits Slide 85/86
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Absorption law Equivalence function NOT gate
AND gate Exclusive-OR function Operator precedence
Associative law Exhaustive enumeration OR gate
Boolean algebra method Parallel Binary Adder
Boolean expression Half-adder Perfect induction
Boolean functions Idempotent law method
Boolean identities Involution law Postulates of Boolean
Canonical forms for Literal algebra
Boolean functions Logic circuits Principle of duality
Combinational logic Logic gates Product-of-Sums
circuits Logical addition expression
Cumulative law Logical multiplication Standard forms
Complement of a Maxterms Sum-of Products
function Minimization of Boolean expression
Complementation functions Truth table
De Morgan’s law Minterms Universal NAND gate
Distributive law NAND gate Universal NOR gate
Dual identities
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 7
Processor and
Memory
Chapter 07: Processor and Memory Slide 1/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
Cache memory
S
E
Accumulator
C Decoder
register
O I/O
N Program control General-purpose
D
D register register D
E
A E
V Storage Instruction General-purpose I/O
R V
I interfaces register register interfaces
Y I
C Memory address
S C
E register
T E
S
O Memory buffer S
R register
A
I/O
G
register
E
General-purpose General-purpose
register register
Ref. Page 105 Chapter 07: Processor and Memory Slide 3/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Central Processing
Unit (CPU)
Ref. Page 104 Chapter 07: Processor and Memory Slide 5/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 105 Chapter 07: Processor and Memory Slide 6/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 106 Chapter 07: Processor and Memory Slide 7/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Instruction Set
CPU has built-in ability to execute a particular set of machine
instructions, called its instruction set
Most CPUs have 200 or more instructions (such as add,
subtract, compare, etc.) in their instruction set
CPUs made by different manufacturers have different
instruction sets
Manufacturers tend to group their CPUs into “families” having
similar instruction sets
New CPU whose instruction set includes instruction set of its
predecessor CPU is said to be backward compatible with its
predecessor
Ref. Page 106 Chapter 07: Processor and Memory Slide 8/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Registers
Ref. Page 106 Chapter 07: Processor and Memory Slide 9/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 107 Chapter 07: Processor and Memory Slide 10/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Execution of Instructions
Control unit takes address of the next program instruction
to be executed from program control register and reads
the instruction from corresponding memory address into
the instruction register
Control unit then sends the operation and address parts of
the instruction to the decoder and memory address
register
Decoder interprets the instruction and accordingly the
control unit sends command signals to the appropriate
unit for carrying out the task specified in the instruction
As each instruction is executed, address of next
instruction is loaded and steps are repeated
Ref. Page 107 Chapter 07: Processor and Memory Slide 11/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Processor Speed
Ref. Page 108 Chapter 07: Processor and Memory Slide 12/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Types of Processors
Type of
Features Usage
Architecture
Large instruction set
CISC (Complex Variable-length instructions Mostly used in
Instruction Set Variety of addressing modes personal
Computer) Complex & expensive to computers
produce
Small instruction set
RISC (Reduced
Fixed-length instructions Mostly used in
Instruction Set
Reduced references to workstations
Computer)
memory to retrieve operands
Ref. Page 108 Chapter 07: Processor and Memory Slide 13/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Types of Processors
Type of
Features Usage
Architecture
Allows software to
communicate explicitly to the
processor when operations
are parallel
EPIC (Explicitly
Uses tighter coupling Mostly used in
Parallel
between the compiler and the high-end servers
Instruction
processor and workstations
Computing)
Enables compiler to extract
maximum parallelism in the
original code, and explicitly
describe it to the processor
Ref. Page 109 Chapter 07: Processor and Memory Slide 14/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Types of Processors
Type of
Features Usage
Architecture
Processor chip has multiple
cooler-running, more energy-
efficient processing cores
Improve overall performance
Mostly used in
Multi-Core by handling more work in
high-end servers
Processor parallel
and workstations
can share architectural
components, such as memory
elements and memory
management
Ref. Page 111 Chapter 07: Processor and Memory Slide 15/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Power-Efficient Processors
Ref. Page 112 Chapter 07: Processor and Memory Slide 16/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Main Memory
Main Memory
Every computer has a temporary storage built into
the computer hardware
It stores instructions and data of a program mainly
when the program is being executed by the CPU
This temporary storage is known as main memory,
primary storage, or simply memory
Physically, it consists of some chips either on the
motherboard or on a small circuit board attached to
the motherboard of a computer
It has random access property
It is volatile
Ref. Page 112 Chapter 07: Processor and Memory Slide 18/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Storage
Large storage capacity Small Large
capacity
Ref. Page 113 Chapter 07: Processor and Memory Slide 19/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
0
1
2
3
Addresses of 4
Words of a
a memory 5 memory
N-2
N-1
Each word
Bit 1 Bit 2 contains the
same number of
bits = word
length
(Continued on next slide)
Ref. Page 114 Chapter 07: Processor and Memory Slide 20/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 114 Chapter 07: Processor and Memory Slide 21/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
1024
Ref. Page 115 Chapter 07: Processor and Memory Slide 22/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
4096 4096
Ref. Page 115 Chapter 07: Processor and Memory Slide 23/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Memory Capacity
Memory capacity of a computer is equal to the number
of bytes that can be stored in its primary storage
Ref. Page 116 Chapter 07: Processor and Memory Slide 24/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Memory chips
PROM EPROM
UVEPROM EEPROM
Ref. Page 117 Chapter 07: Processor and Memory Slide 25/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 116 Chapter 07: Processor and Memory Slide 26/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 117 Chapter 07: Processor and Memory Slide 27/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Types of ROMs
Type Usage
Data is burnt by the
Manufacturer-
manufacturer of the electronic
programmed ROM
equipment in which it is used.
User-programmed ROM
or The user can load and store
“read-only” programs and data
Programmable ROM in it
(PROM)
Ref. Page 117 Chapter 07: Processor and Memory Slide 28/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Types of ROMs
Type Usage
Electrically EPROM
(EEPROM) A type of EPROM chip in which the
or stored information is erased by
using high voltage electric pulses
Flash memory
Ref. Page 117 Chapter 07: Processor and Memory Slide 29/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Cache Memory
It is commonly used for minimizing the memory-
processor speed mismatch.
It is an extremely fast, small memory between CPU
and main memory whose access time is closer to the
processing speed of the CPU.
It is used to temporarily store very active data and
instructions during processing.
Ref. Page 118 Chapter 07: Processor and Memory Slide 30/32
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Accumulator Register (AR) Flash Memory
Address Input/Output Register (I/O)
Arithmetic Logic Unit (ALU) Instruction Register (I)
Branch Instruction Instruction set
Cache Memory Kilobytes (KB)
Central Processing Unit (CPU) Main Memory
CISC (Complex Instruction Set Manufacturer-Programmed ROM
Computer) architecture Megabytes (MB)
Clock cycles Memory
Clock speed Memory Address Register (MAR)
Control Unit Memory Buffer Register (MBR)
Electrically EPROM (EEPROM) Microprogram
Erasable Programmable Read- Multi-core processor
Only Memory (EPROM) Non-Volatile storage Processor
Explicitly Parallel Instruction Program Control Register (PC)
Computing (EPIC) Programmable Read-Only Memory
Fixed-word-length memory (PROM)
Random Access Memory (RAM)
Key Words/Phrases
Read-Only Memory (ROM)
Register
RISC (Reduced Instruction Set Computer)
architecture
Single In-line Memory Module (SIMM)
Ultra Violet EPROM (UVEPROM)
Upward compatible
User-Programmed ROM
Variable-word-length memory
Volatile Storage
Word length
Word size
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 8
Secondary Storage
Devices
Chapter 08: Secondary Storage Devices Slide 1/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Learning Objectives
Ref. Page 122 Chapter 08: Secondary Storage Devices Slide 4/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Secondary Storage
Ref. Page 122 Chapter 08: Secondary Storage Devices Slide 5/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Classification of Commonly Used Secondary
Storage Devices
Ref. Page 123 Chapter 08: Secondary Storage Devices Slide 6/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 123 Chapter 08: Secondary Storage Devices Slide 8/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 123 Chapter 08: Secondary Storage Devices Slide 9/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Tapes
Ref. Page 124 Chapter 08: Secondary Storage Devices Slide 11/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Tape - Storage Organization
(Example 1)
Characters for
Track/channel A frame
corresponding codes
numbers
0 1 2 3 4 5 6 7 8 9 A B C D E F G H I
Parity bit 7
6 Each vertical
Zone line represents
5
a binary 1 bit
4
Numeric 3
2
1
Illustrates the concepts of frames, tracks, parity bit, and character-by-character data
storage
Ref. Page 125 Chapter 08: Secondary Storage Devices Slide 12/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Tape - Storage Organization
(Example 2)
Track/channel A frame for Characters for
numbers each character corresponding codes
0 1 2 3 4 5 6 7 8 9 A B C
8’s digit 9
2’s digit 8
Each vertical
Added zone 7 line represents
Track a binary 1 bit
Added zone 6
representation
Zone 5
Parity bit 4
Zone 3
Unit’s digit 2
4’s digit 1
Illustrates the concepts of frames, tracks, parity bit, and character-by-character data storage
Ref. Page 125 Chapter 08: Secondary Storage Devices Slide 13/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 126 Chapter 08: Secondary Storage Devices Slide 14/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 126 Chapter 08: Secondary Storage Devices Slide 15/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 126 Chapter 08: Secondary Storage Devices Slide 16/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Write tape header label used to update the contents of tape header label
Back space one block rewinds the tape to the beginning of previous block
Ref. Page 126 Chapter 08: Secondary Storage Devices Slide 17/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 126 Chapter 08: Secondary Storage Devices Slide 18/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 126 Chapter 08: Secondary Storage Devices Slide 19/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 127 Chapter 08: Secondary Storage Devices Slide 20/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 127 Chapter 08: Secondary Storage Devices Slide 21/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Read/write
head assembly
Vacuum
columns
Tape loops
varying in length
Ref. Page 127 Chapter 08: Secondary Storage Devices Slide 22/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 127 Chapter 08: Secondary Storage Devices Slide 23/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 127 Chapter 08: Secondary Storage Devices Slide 24/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 25/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 26/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
7
8
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 27/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 28/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
The Helical Scan Techniques
Used in DAT Drives
Write head B
Read head A
Spinning
Read head B
helical
scan
Write head A
Moving tape
Shaft
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 29/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 30/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 128 Chapter 08: Secondary Storage Devices Slide 31/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 129 Chapter 08: Secondary Storage Devices Slide 32/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 129 Chapter 08: Secondary Storage Devices Slide 33/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Processing Next
processing
Ref. Page 129 Chapter 08: Secondary Storage Devices Slide 34/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Disks
Ref. Page 129 Chapter 08: Secondary Storage Devices Slide 36/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Disk – Storage Organization
Illustrates the Concept of Tracks
Ref. Page 130 Chapter 08: Secondary Storage Devices Slide 37/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Disk – Storage Organization
Illustrates the Concept of Sectors
A sector
Ref. Page 130 Chapter 08: Secondary Storage Devices Slide 38/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Disk Pack
Data is accessed from a disk by specifying its disk address
Ref. Page 130 Chapter 08: Secondary Storage Devices Slide 39/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Cylinder-Head-Sector (CHS)
Ref. Page 131 Chapter 08: Secondary Storage Devices Slide 40/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Disk – Storage Organization
(Illustrates the Concept of Cylinder)
Upper surface
not used
Read/Write head
Surface - 0
Surface - 1
Direction of movement of
access arms assembly
Surface - 2
Cylinder
Surface - 3
Lower surface
not used Central shaft
Ref. Page 131 Chapter 08: Secondary Storage Devices Slide 41/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 132 Chapter 08: Secondary Storage Devices Slide 42/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Access Mechanism
Ref. Page 132 Chapter 08: Secondary Storage Devices Slide 43/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
One read/write
head per surface Central shaft
Direction of movement of
access arms assembly .
. Disk platters
.
Access arms
assembly
Vertical cross section of a disk system. There is one read/write head per
recording surface
Ref. Page 132 Chapter 08: Secondary Storage Devices Slide 44/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 133 Chapter 08: Secondary Storage Devices Slide 45/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 133 Chapter 08: Secondary Storage Devices Slide 46/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Disk Formatting
Process of preparing a new disk by the computer
system in which the disk is to be used.
For this, a new (unformatted) disk is inserted in the disk
drive of the computer system and the disk formatting
command is initiated
Low-level disk formatting
Disk drive’s read/write head lays down a magnetic
pattern on the disk’s surface
Enables the disk drive to organize and store the
data in the data organization defined for the disk
drive of the computer
Ref. Page 134 Chapter 08: Secondary Storage Devices Slide 47/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Disk Formatting
OS-level disk formatting
Creates the File Allocation Table (FAT) that is a
table with the sector and track locations of data
Leaves sufficient space for FAT to grow
Scans and marks bad sectors
One of the basic tasks handled by the computer’s
operating system
Enables the use of disks manufactured by third party
vendors into one’s own computer system
Ref. Page 134 Chapter 08: Secondary Storage Devices Slide 48/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 134 Chapter 08: Secondary Storage Devices Slide 49/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 134 Chapter 08: Secondary Storage Devices Slide 50/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 135 Chapter 08: Secondary Storage Devices Slide 51/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Magnetic Disks
Ref. Page 135 Chapter 08: Secondary Storage Devices Slide 52/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Hard Disks
Ref. Page 135 Chapter 08: Secondary Storage Devices Slide 53/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Zip/Bernoulli Disks
Uses a single hard disk platter encased in a plastic
cartridge
Disk drives may be portable or fixed type
Fixed type is part of the computer system, permanently
connected to it
Portable type can be carried to a computer system,
connected to it for the duration of use, and then can be
disconnected and taken away when the work is done
Zip disks can be easily inserted/removed from a zip drive
just as we insert/remove floppy disks in a floppy disk
drive
Ref. Page 135 Chapter 08: Secondary Storage Devices Slide 54/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Disk Packs
Uses multiple (two or more) hard disk platters
mounted on a single central shaft
Disk drives have a separate read/write head for each
usable disk surface (the upper surface of the top-most
disk and the lower surface of the bottom most disk is
not used)
Disks are of removable/interchangeable type in the
sense that they have to be mounted on the disk drive
before they can be used, and can be removed and
kept off-line when not in use
Ref. Page 135 Chapter 08: Secondary Storage Devices Slide 55/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Winchester Disks
Ref. Page 136 Chapter 08: Secondary Storage Devices Slide 56/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Winchester Disks
Ref. Page 136 Chapter 08: Secondary Storage Devices Slide 57/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 136 Chapter 08: Secondary Storage Devices Slide 58/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 136 Chapter 08: Secondary Storage Devices Slide 59/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 136 Chapter 08: Secondary Storage Devices Slide 60/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 136 Chapter 08: Secondary Storage Devices Slide 61/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 137 Chapter 08: Secondary Storage Devices Slide 62/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 137 Chapter 08: Secondary Storage Devices Slide 63/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 137 Chapter 08: Secondary Storage Devices Slide 64/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 137 Chapter 08: Secondary Storage Devices Slide 65/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 137 Chapter 08: Secondary Storage Devices Slide 66/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Optical Disks
Ref. Page 137 Chapter 08: Secondary Storage Devices Slide 68/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Has one long spiral track, which starts at the outer edge
and spirals inward to the center
Track is divided into equal size sectors
(a) Track pattern on an optical disk (b) Track pattern on a magnetic disk
Ref. Page 138 Chapter 08: Secondary Storage Devices Slide 69/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
= Number of sectors
Number of bytes per sector
Ref. Page 139 Chapter 08: Secondary Storage Devices Slide 70/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Laser Laser
beam beam
source source
Laser beam is
scattered by a pit
Laser beam is
reflected by a land
Ref. Page 139 Chapter 08: Secondary Storage Devices Slide 71/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 140 Chapter 08: Secondary Storage Devices Slide 72/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 139 Chapter 08: Secondary Storage Devices Slide 73/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Optical disk
Is placed on top
Headphone socket
of this groove
enables a user to
plug-in headphones Tray Direction
to recorded sound eject of movement
when the drive is button of the tray Optical disk tray
used to play audio
CDs.
Ref. Page 140 Chapter 08: Secondary Storage Devices Slide 74/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
CD-ROM
Ref. Page 140 Chapter 08: Secondary Storage Devices Slide 75/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 141 Chapter 08: Secondary Storage Devices Slide 76/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 141 Chapter 08: Secondary Storage Devices Slide 77/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 142 Chapter 08: Secondary Storage Devices Slide 78/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 141 Chapter 08: Secondary Storage Devices Slide 79/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 142 Chapter 08: Secondary Storage Devices Slide 80/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 142 Chapter 08: Secondary Storage Devices Slide 81/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 143 Chapter 08: Secondary Storage Devices Slide 82/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
DVD-audio
Offers multiple choices of sampling rate and number of bits
per sample
Specification also supports up to six channels of
multichannel
Surround sound with 24-bit sampling at a 48 KHz rate
Provision for visual menus, still images, and video to
accompany the audio program
Ref. Page 143 Chapter 08: Secondary Storage Devices Slide 83/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 143 Chapter 08: Secondary Storage Devices Slide 84/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 143 Chapter 08: Secondary Storage Devices Slide 85/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 143 Chapter 08: Secondary Storage Devices Slide 86/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 144 Chapter 08: Secondary Storage Devices Slide 88/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 144 Chapter 08: Secondary Storage Devices Slide 89/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
(a) Hard Disk Drive (HDD) (b) Solid State Drive (SSD)
Figure 8.16. Inside view of HDD and SSD. When packaged in an enclosure, both may
look similar from outside, but internally their design is very different.
Ref. Page 145 Chapter 08: Secondary Storage Devices Slide 90/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 146 Chapter 08: Secondary Storage Devices Slide 91/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 146 Chapter 08: Secondary Storage Devices Slide 92/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 147 Chapter 08: Secondary Storage Devices Slide 93/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 147 Chapter 08: Secondary Storage Devices Slide 94/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Vendor name
Storage
capacity
Ref. Page 147 Chapter 08: Secondary Storage Devices Slide 95/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Dual-drive system
Ref. Page 148 Chapter 08: Secondary Storage Devices Slide 96/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 148 Chapter 08: Secondary Storage Devices Slide 98/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Disk Array
Ref. Page 148 Chapter 08: Secondary Storage Devices Slide 99/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Disk Array
Enhanced storage capacity is achieved by using
multiple disks
Enhanced performance is achieved by using parallel
data transfer technique from multiple disks
Enhanced reliability is achieved by using techniques
such as mirroring or striping
In mirroring, the system makes exact copies of files
on two hard disks
In striping, a file is partitioned into smaller parts and
different parts of the file are stored on different disks
Ref. Page 148 Chapter 08: Secondary Storage Devices Slide 100/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
A RAID Unit
Multiple
disks
RAID Controller
Computer
Ref. Page 148 Chapter 08: Secondary Storage Devices Slide 101/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 149 Chapter 08: Secondary Storage Devices Slide 102/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
CD-ROM Jukebox
Set of CD-ROMs and CD-ROM drives with a controller
mounted in a single box, forming a single large
storage unit
Large CD-ROM jukebox can accommodate up to
several hundred CD-ROM disks bringing the storage
capacity of the storage unit to several terabytes
Used for archiving read-only data in such
applications as on-line museums, on-line digital
libraries, on-line encyclopedia, etc
Ref. Page 149 Chapter 08: Secondary Storage Devices Slide 103/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Data Backup
Ref. Page 150 Chapter 08: Secondary Storage Devices Slide 105/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 150 Chapter 08: Secondary Storage Devices Slide 106/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Types of Backup
Full backup
All data on an on-line secondary storage device is copied
on a backup device at the time of backup
Full backup is simpler and a little safer
To restore a particular file we need to search for it at
only one place
Incremental backup
Only newly created files or files that have been changed
since the last backup are copied on backup device from
on-line secondary storage device at the time of backup
Incremental backup is faster than full backup
To restore a particular file we need to search for it on
several backups
Ref. Page 150 Chapter 08: Secondary Storage Devices Slide 107/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Backup Policy
Ref. Page 151 Chapter 08: Secondary Storage Devices Slide 108/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Backup Policy
Ref. Page 151 Chapter 08: Secondary Storage Devices Slide 109/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
On-line storage
On-line storage device is under direct control of the
processing unit of the computer
Near-line storage
Near-line storage device is an intermediate storage
between on-line storage and off-line storage
Off-line storage
Off-line storage is not under direct control of any
computer
Ref. Page 151 Chapter 08: Secondary Storage Devices Slide 111/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Hierarchical Storage
System (HSS)
Ref. Page 153 Chapter 08: Secondary Storage Devices Slide 113/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 152 Chapter 08: Secondary Storage Devices Slide 114/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 152 Chapter 08: Secondary Storage Devices Slide 115/117
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Automated tape library Floppy disk
Auxiliary memory Hard disk
Block Hard Disk Drive (HDD)
Blocking Hierarchical Storage System (HSS)
Blocking factory Inter-block gap (IBG)
CD-ROM Inter-record gap (IRG)
CD-ROM jukebox Land
Check bit Latency
Cylinder Magnetic disk
Data transfer rate Magnetic tape
Direct access device Magnetic tape drive
Disk array Mass storage devices
Disk controller Master file
Disk drive Odd parity
Disk formatting Off-line storage
Disk pack On-line storage
DVD Optical disk
Even parity Parallel representation
File Allocation Tube (FAT) Parity bit
Pit
Key Words/Phrases
QIC Standard
Record
Redundant Array of Inexpensive Disks (RAID)
Secondary storage
Sector
Seek time
Sequential access device
Solid State Drive (SSD)
Storage hierarchy
Tape controller
Track
Transaction file
Winchester disk
WORM disk
Zip disk
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 9
Input-Output
Devices
Chapter 09: Input-Output Devices Slide 1/73
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
I/O Devices
Provide means of communication between a computer
and outer world
Also known as peripheral devices because they
surround the CPU and memory of a computer system
Input devices are used to enter data from the outside
world into primary storage
Output devices supply results of processing from
primary storage to users
Input Results of
data CPU processing
Input Output
from and in human
Devices Devices
external Memory acceptable
world form
Input Devices
Keyboard devices
Point-and-draw devices
Data scanning devices
Digitizer
Electronic cards based devices
Speech recognition devices
Vision based devices
Keyboard Devices
Point-and-Draw Devices
Mouse
Mouse is the most popular point-and-draw device
Mouse is a small hand-held device that fits comfortably in a
user’s palm
It rolls on a small bearing and has one or more buttons on
the top
When a user rolls a mouse on a flat surface, a graphics
cursor moves on the terminal screen in the direction of the
mouse’s movement
Different applications display the graphics cursor as different
symbols
Graphics cursor, irrespective of its size and shape, has a
pixel-size point that is the point of reference to decide the
position of the cursor on the screen. This point is called hot
spot
Mouse
Click Button
Types of Mouse
Mechanical mouse
Mechanical mouse has a ball inside it that partially projects out
through an opening in its base
Ball rolls due to surface friction when the mouse is moved on a
flat surface
On two sides of the ball are two small wheels that spin to
match the speed of the ball. Each wheel of the mouse is
connected to a sensor
As the mouse ball rolls when a user moves the mouse, the
sensors detect how much each wheel spins and send this
information to the computer in the form of changes to the
current position
Types of Mouse
Optical mouse
An optical mouse has no mechanical parts like the ball and
wheels
It has a built-in photo-detector
When a user moves the mouse on a special pad with gridlines,
the photo-detector senses each horizontal and vertical line on
the pad, and sends this information to the computer in the
form of changes to the current position
One, Two, and Three buttons mouse
Mouse can have one, two, or three buttons
With a mouse having multiple buttons, the leftmost button is
the main button that allows for most mouse operations
A user can configure another button as main button
(Continued on next slide…)
Types of Mouse
Trackball
Trackball
Ball is rolled
with fingers
Click button
Joystick
Joystick is a pointing device that works on the same
principle as a trackball
To make the movements of the spherical ball easier, it is
placed in a socket with a stick mounted on it
User holds the stick in his/her hand and moves it around to
move the spherical ball
User can move the stick forward or backward, left or right,
to move and position the graphics cursor at a desired
position
Joysticks use potentiometers to sense stick and ball
movements
A button on top of the stick enables a user to select the
option pointed to by the cursor
Joystick
Click button
Stick
Socket
Light
indicator
Electronic Pen
Light pen
Uses a photoelectric cell and an optical lens mounted in a pen-shaped
case
It focuses on to it any light in its field of view
It detects the light emitted from a limited field of view of the monitor’s
display
System transmits this electric response to a processor, which identifies
the menu item or icon that is triggering the photocell
Pen has a finger-operated button
Touch Screen
Image Scanner
Bar-code Reader
21000 67520
Manufacturer/supplier
identification number Specific product code
number
Digitizer
Digitizer
Table top
Digitizing tablet
Cursor
Stylus
Electronic-card Reader
Electronic cards are small plastic cards having encoded
data appropriate for the application for which they are
used
Electronic-card reader (normally connected to a
computer) is used to read data encoded on an
electronic card and transfer it to the computer for
further processing
Used together as a means of direct data entry into a
computer system
Used by banks for use in automatic teller machines
(ATMs) and by organizations for controlling access of
employees to physically secured areas
Vision-Input Systems
Output Devices
Monitors
Printers
Plotters
Screen image projector
Voice response systems
Types of Output
Soft-copy output
Not produced on a paper or some material that can be touched
and carried for being shown to others
Temporary in nature and vanish after use
Examples are output displayed on a terminal screen or spoken out
by a voice response system
Hard-copy output
Produced on a paper or some material that can be touched and
carried for being shown to others
Permanent in nature and can be kept in paper files or can be
looked at a later time when the person is not using the computer
Examples are output produced by printers or plotters on paper
Monitors
Monitors
Monitor
Keyboard
Types of Monitors
Printers
Dot-Matrix Printers
ABCDEFGHIJKLM
NOPQRSTUVWXYZ
0123456789-.,
&/$*#%@=(+)
Direction of movement
of print head
Printed characters
formed of dots in a 5 Print head
x 7 matrix
Inkjet Printers
Inkjet Printers
An Inkjet Printer
Drum Printers
Line printers that print one line at a time
Have a solid cylindrical drum with characters embossed
on its surface in the form of circular bands
Set of hammers mounted in front of the drum in such a
manner that an inked ribbon and paper can be placed
between the hammers and the drum
Can only print a pre-defined set of characters in a pre-
defined style that is embossed on the drum
Impact printers and usually monochrome
Typical speeds are in the range of 300 to 2000 lines per
minute
Chain/Band Printers
Chain/Band Printers
Ribbon
Hammers
Laser Printers
Page printers that print one page at a time
Consist of a laser beam source, a multi-sided mirror, a
photoconductive drum and toner (tiny particles of
oppositely charged ink)
To print a page, the laser beam is focused on the electro
statically charged drum by the spinning multi-sided
mirror
Toner sticks to the drum in the places the laser beam
has charged the drum’s surface.
Toner is then permanently fused on the paper with heat
and pressure to generate the printer output
Laser printers produce very high quality output having
resolutions in the range of 600 to 1200 dpi
(Continued on next slide)
Laser Printers
Can print many special characters, different sizes of
print, and graphics such as charts and graphs
Are non-impact printers
Most laser printers are monochrome, but color laser
printers are also available
Low speed laser printers can print 4 to 12 pages per
minute. Very high-speed laser printers can print 500
to 1000 pages per minute
More expensive than other printers
A Laser Printer
Plotters
Plotters are an ideal output device for architects,
engineers, city planners, and others who need to
routinely generate high-precision, hard-copy graphic
output of widely varying sizes
Two commonly used types of plotters are:
Drum plotter, in which the paper on which the
design has to be made is placed over a drum that
can rotate in both clockwise and anti-clockwise
directions
Flatbed plotter, in which the paper on which the
design has to be made is spread and fixed over a
rectangular flatbed table
Plotters
Paper
Design drawn
on the paper
Design drawn
on the paper
Paper
3D Printers
Types of 3D Printers
Applications of 3D Printers
Rapid prototyping
Operations buttons
Speech Synthesizers
Key Words/Phrases
3D Printer Information Kiosk
Bard code reader Inkjet printer
Cathode Ray Tube (CRT) Input/Output device
Chain/Band printer Joystick
Data scanning device Keyboard device
Digital Light Processing (DLP) Laser printer
Digitizer Magnetic-Ink Character Recognition
Digitizing tablet (MICR)
Dot-Matrix printer Monitor
Drum plotter Mouse
Drum printer Optical Character Recognition (OCR)
Electronic card reader Optical Mark Reader (OMR)
Electronic Pen Peripheral device
Flatbed plotter Phonemes
Flatbed Scanner Plotter
Fused Deposition Modeling (FDM) Point-and-draw device
Graphical User Interface Printer
Hand-held scanner QWERTY keyboard
Hard-copy output Screen Image Projector
Image Scanner (Continued on next slide)
Key Words/Phrases
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 10
Computer Software
Chapter 10: Computer Software Slide 1/37
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
Software, Firmware
and Middleware
Software
Types of Software
System Software
Application Software
USERS
APPLICATION SOFTWARE
SYSTEM SOFTWARE
HARDWARE
Physical devices/components of
the computer system
Software that constitute the operating and programming
environment of the computer system
Firmware
Middleware
Network connection
Network connection
Acquiring Software
Downloading Public-domain
Software
Public-domain software is software available free or for a
nominal charge from the bulletin boards or user-group
libraries on the Internet
Public-domain software is also referred to as shareware/
freeware
They are also known as community-supported software as
mostly the authors do not support the product directly and
users of the software support and help each other
Open Source Software (OSS): Usually, OSS allows a user to
download, view, modify, and distribute modified source code
to others
Software Development
Life Cycle (SDLC)
System analysis
and design
Implementation
Testing and
debugging
Deployment
Maintenance
Software Engineering
Uniformity
Software product should maintain uniformity in design, coding,
documentation, etc. Uniformity ensures consistency
CASE (Computer Aided Software Engineering) tools
provide a wide range of features for creation of better and
more reliable software products
Design specification tools
Allow programmers to design visually screens, menus, database
tables, reports, dialog boxes, and other key components of a program
Documentation tools
Assist in automatic generation of technical documents for a software
product
Key Words/Phrases
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 11
Planning the
Computer Program
Chapter 11: Planning the Computer Program Slide 1/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
Purpose of Program
Planning and Algorithm
Ref. Page 202 Chapter 11: Planning the Computer Program Slide 4/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
What is an Algorithm?
Algorithm refers to the logic of a program
It is a step-by-step description of how to arrive at a solution
to a given problem
Is defined as a sequence of instructions that when executed
in the specified sequence, the desired results are obtained
Instructions must possess following characteristics:
Each instruction should be precise and unambiguous
Each instruction should be executed in a finite time
No instruction should be repeated infinitely. This ensures that
the algorithm terminates ultimately
After executing the instructions (when the algorithm
terminates), the desired results are obtained
Ref. Page 203 Chapter 11: Planning the Computer Program Slide 5/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 203 Chapter 11: Planning the Computer Program Slide 6/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Step 8: Stop.
Ref. Page 203 Chapter 11: Planning the Computer Program Slide 7/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 204 Chapter 11: Planning the Computer Program Slide 8/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 204 Chapter 11: Planning the Computer Program Slide 9/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Representation of Algorithms
As programs
As flowcharts
As pseudocodes
Ref. Page 204 Chapter 11: Planning the Computer Program Slide 10/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Flowcharts
What is a Flowchart?
Flowchart is a pictorial representation of an algorithm
Programmers often use it as a program-planning tool
It uses boxes of different shapes to denote different types
of instructions
Process of drawing a flowchart for an algorithm is known as
flowcharting
Ref. Page 205 Chapter 11: Planning the Computer Program Slide 12/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 205 Chapter 11: Planning the Computer Program Slide 13/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 205 Chapter 11: Planning the Computer Program Slide 14/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 206 Chapter 11: Planning the Computer Program Slide 15/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Yes A=B
Ref. Page 207 Chapter 11: Planning the Computer Program Slide 16/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
I=?
=0 =1 =2 =3 =4 =5 = Other
Ref. Page 207 Chapter 11: Planning the Computer Program Slide 17/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 207 Chapter 11: Planning the Computer Program Slide 18/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Percentage = Total / 10
Stop
Ref. Page 208 Chapter 11: Planning the Computer Program Slide 19/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 208 Chapter 11: Planning the Computer Program Slide 20/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 209 Chapter 11: Planning the Computer Program Slide 21/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Count = 0
Percentage = Total/10
Ref. Page 210 Chapter 11: Planning the Computer Program Slide 22/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Yes
Is Rollno = 0000000?
Generalized flowchart
No for the solution of
Add marks of all subjects Example 4 using the
Stop
giving Total concept of trailer
record. Here the
process loop is
Percentage = Total / 10 terminated by detecting
a special non-data
record.
Write output data
Ref. Page 210 Chapter 11: Planning the Computer Program Slide 23/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 210 Chapter 11: Planning the Computer Program Slide 24/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Yes
Is Rollno = 9999999?
No Write Count
Percentage = Total/10
No
Is Percentage = > 30?
Yes
Write output data
Add 1 to Count
Ref. Page 211 Chapter 11: Planning the Computer Program Slide 25/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 212 Chapter 11: Planning the Computer Program Slide 26/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Count = 0
Yes 2
Is Sexcode = Z?
No
1 No Is Sexcode = F?
Yes
Add marks of all subjects giving Total
Percentage = Total / 10
3
(Continued on next slide…)
No
1 Is Percentage = > 45?
Yes
2
No
1 Is Percentage < 60?
Write Count
Yes
Write output data
Stop
Add 1 to Count
Ref. Page 214 Chapter 11: Planning the Computer Program Slide 28/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Levels of Flowchart
Ref. Page 215 Chapter 11: Planning the Computer Program Slide 29/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Part of a macro 1
flowchart
A micro
I=1
Flowchart
Total = 0
No
Is I > 10?
Yes
1
Ref. Page 215 Chapter 11: Planning the Computer Program Slide 30/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Flowcharting Rules
First chart the main line of logic, then incorporate detail
Ref. Page 215 Chapter 11: Planning the Computer Program Slide 31/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Flowcharting Rules
Ref. Page 215 Chapter 11: Planning the Computer Program Slide 32/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Advantages of Flowcharts
Better communication
Flowchart is a pictorial representation of a program
Effective analysis
Macro flowchart, which charts the main line of logic of a
software system, becomes the system’s model
Effective synthesis
Group of programmers are associated with the design of a big
software system
Each programmer is responsible for designing only a part of
the entire system
Flowcharts of all programmers put together can help visualize
the overall system design
Ref. Page 216 Chapter 11: Planning the Computer Program Slide 33/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Advantages of Flowcharts
Proper program documentation
Documentation involves collecting, organizing, storing, and
maintaining a complete historical record of programs, and other
documents associated with a system
Flowcharts often provide valuable documentation support
Efficient coding
Once a flowchart is ready, programmers find it very easy to write
the corresponding program because the flowchart acts as a road
map
Systematic debugging
Flowchart is very helpful in detecting, locating, and removing
mistakes (bugs) in a program in a systematic manner
Systematic testing
Flowchart is very helpful in designing test data for systematic
testing of programs
Ref. Page 216 Chapter 11: Planning the Computer Program Slide 34/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Limitations of Flowchart
Ref. Page 217 Chapter 11: Planning the Computer Program Slide 35/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Pseudocode
What is Pseudocode?
Pseudocode is another program-planning tool used for
planning program logic
“Pseudo” means imitation or false and “Code” refers to the
instructions written in a programming language
Pseudocode is an imitation of actual computer instructions
Pseudo-instructions are phrases written in a natural language
Pseudocode uses a structure that resembles computer
instructions
A programmer can concentrate solely on developing the logic
of a program without worrying about the syntax
He/she can convert the pseudocode easily into a suitable
programming language
Ref. Page 217 Chapter 11: Planning the Computer Program Slide 37/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
1. Sequence logic,
2. Selection logic, and
3. Iteration (or looping) logic
Ref. Page 218 Chapter 11: Planning the Computer Program Slide 38/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Sequence Logic
It is used for performing instructions one after another
in sequence.
Process 1
Process 1
Process 2
Process 2
Ref. Page 218 Chapter 11: Planning the Computer Program Slide 39/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Selection Logic
• Also known as decision logic, it is used for making
decisions
Ref. Page 219 Chapter 11: Planning the Computer Program Slide 40/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Yes No IF Condition
IF (condition)
THEN Process 1
THEN ELSE ELSE Process 2
Process 1 Process 2
ENDIF
Ref. Page 219 Chapter 11: Planning the Computer Program Slide 41/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Yes No
IF (condition)
IF Condition
THEN
THEN Process 1
Process 1
ENDIF
Ref. Page 219 Chapter 11: Planning the Computer Program Slide 42/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Yes
Type 1 Process 1
No
Yes
Type 2 Process 2 CASE Type
Yes
Type n Process n
Case Type n: Process n
No
ENDCASE
(a) Flowchart
(b) Pseudocode
Ref. Page 220 Chapter 11: Planning the Computer Program Slide 43/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
1. DO…WHILE
2. REPEAT…UNTIL
Ref. Page 220 Chapter 11: Planning the Computer Program Slide 44/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Iteration (or Looping) Logic
(DO…WHILE Structure)
False
Condition?
True
Process 1 DO WHILE Condition
Process 1
Block
Process n
Process n ENDDO
Ref. Page 221 Chapter 11: Planning the Computer Program Slide 45/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Iteration (or Looping) Logic
(REPEAT…UNTIL Structure)
Process 1
REPEAT
Process 1
Process n
Process n
False
Condition? UNTIL Condition
True
(a) Flowchart (b) Pseudocode
Ref. Page 221 Chapter 11: Planning the Computer Program Slide 46/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 222 Chapter 11: Planning the Computer Program Slide 47/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Advantages of Pseudocode
Converting a pseudocode to a programming language
is much more easier than converting a flowchart to a
programming language
Ref. Page 222 Chapter 11: Planning the Computer Program Slide 48/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Limitations of Pseudocode
Ref. Page 223 Chapter 11: Planning the Computer Program Slide 49/50
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Algorithm
Basic logic structures
Control structures
Flowchart
Iteration logic
Looping logic
Micro flowchart
Macro flowchart
Pseudocode
Program Design Language (PDL)
Sequence logic
Selection logic
Sentinel value
Structured programming
Trailer record
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 12
Computer
Chapter 12: Computer Languages
Languages Slide 1/65
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
Analogy with
Natural Languages
Machine language
Assembly language
High-level language
Machine Language
Machine Language
OPCODE OPERAND
(operation code) (address/location)
Instruction format
(Continued on next slide…)
Machine Language
001000000000001100111001 10001471
001100000000010000100001 14002041
011000000000011100101110 30003456
101000111111011100101110 50773456
000000000000000000000000 00000000
In Binary In Decimal
(Difficult to read and understand) (Easier to read and understand)
Advantage
Limitations
Machine dependent
Difficult to program
Error prone
Difficult to modify
Assembly Language
Assembly Language
Assembler
One-to-one correspondence
(Source program) (Object program)
Machine dependent
Knowledge of hardware required
Machine level coding
High-level Language
High-Level Languages
Machine independent
Do not require programmers to know anything about the
internal structure of computer on which high-level
language programs will be executed
Deal with high-level coding, enabling the programmers
to write instructions using English words and familiar
mathematical symbols and expressions
Compiler
Input Output
High-level language Compiler Machine language
program program
One-to-many correspondence
(Source program) (Object program)
Program P1 in high-
level language L1 Same results obtained
Syntax Errors
Illegal characters
Illegal combination of characters
Improper sequencing of instructions in a program
Use of undefined variable names
Edit
source program
Source program
Compile
source program
Syntax
No Generate
errors
detected? object program
Linker
Linker
Linker
Compilation
process
Prog-1.obj Prog-2.obj Prog-n.obj Object programs
Linking
process
Interpreter
Interpreter
Interpreter
Machine independent
Easier to learn and use
Fewer errors during program development
Lower program preparation cost
Better documentation
Easier to maintain
Object-Oriented
Languages
Person
Boy Man
Class ‘B’
(Sub-class of Object ‘b’
Class ‘A’) (Instance of ‘B’)
Inherits from ‘A’ Class ‘B’
Sr.
Element Meaning
No.
1 Abstraction Abstraction means that an object’s characteristics are broken
into manageable chunks as defined and documented in its
class description.
2 Encapsulation Encapsulation stipulates that code and data are stored as one
unit. Encapsulation also enables selective or total information
hiding, since it can make portions of the code and data
inaccessible from outside the unit.
3 Modularity Modularity defines the unit reuse. These units group
abstractions together.
4 Hierarchy Hierarchy allows an object’s behaviors to be refined
(subclasses) without recoding of the parent object (the
superclass). Some OO languages allow an object to have
more than one superclass, a feature that is known as multiple
inheritance. Inheritance hierarchies enable ranking/ordering
of abstractions.
5 Messages Messages, similar in use to function calls, are requests to
perform an operation on an instantiated object.
Some High-level
Languages
FORTRAN
COBOL
BASIC
Pascal
Java
C# (C Sharp)
Python
Highly portable
Interpreted language
LISP
SNOBOL
Simplicity
Naturalness
Abstraction
Efficiency
Structured Programming Support
Compactness
Locality
Extensibility
Suitability to its environment
Subprogram
Subprogram
Structure of a Subprogram
Subprogram header
sqrt (x)
1 2 subprogram header
subprogram body
7
5
Key Words/Phrases
Key Words/Phrases
SNOBOL
Source program
Sub-procedure
Subprogram
Subroutine
Symbolic language
Syntax error
Syntax rules
Programmer-written subprograms
Pradeep K. Sinha
Priti Sinha
Chapter 13
Chapter 00
System
Implementation
Title
and Operation
Chapter 13: System Implementation and Operation Slide 1/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
Program Errors,
Testing and Debugging
Ref. Page 263 Chapter 13: System Implementation and Operation Slide 4/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 264 Chapter 13: System Implementation and Operation Slide 5/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Testing of a Program
Ref. Page 264 Chapter 13: System Implementation and Operation Slide 6/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 265 Chapter 13: System Implementation and Operation Slide 7/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 265 Chapter 13: System Implementation and Operation Slide 8/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 266 Chapter 13: System Implementation and Operation Slide 9/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 266 Chapter 13: System Implementation and Operation Slide 10/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 266 Chapter 13: System Implementation and Operation Slide 11/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
4 Testing can begin in the early Debugging can begin only after the program
stages of software is ready
development.
The approach used for debugging largely
Although the test runs of a depends on the personal choice of the
program are carried out only programmer and the type of error in the
after the program is coded, program
but the decision of what to
test, how to test, and with
what kind of data to test, can
and should be done before
the coding is started
Ref. Page 267 Chapter 13: System Implementation and Operation Slide 12/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Software Documentation
What is Documentation?
Ref. Page 267 Chapter 13: System Implementation and Operation Slide 14/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 267 Chapter 13: System Implementation and Operation Slide 15/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Forms of Documentation
Requirement specification document
Before developing some software, the development team
must analyze its requirements and document them
Requirement specification document is an outcome of this
exercise
Specifies the objectives of developing the software and its
usefulness to various categories of users
Specifies the functionalities, capabilities, performance, inputs,
and outputs requirements of the software
Specifies what all the software will do when developed
Design document
Defines overall architecture of the software
Specifies various hardware and software components of the
software and interfaces between the components
(Continued on next slide…)
Ref. Page 268 Chapter 13: System Implementation and Operation Slide 16/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Forms of Documentation
Ref. Page 269 Chapter 13: System Implementation and Operation Slide 17/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Forms of Documentation
System manual
Standard system manuals contain the following information:
Specific module names along with their description and
purpose
Detailed system flow charts and program flow charts for each
module
Description of the program listings and the control procedures
Source listing of all the programs with full details of all
modifications
Specifications of all input and output media
Specimen of all types of input and output
File layout
Structure and description of all test data, test results, storage
dumps, trace program printouts, etc. (Continued on next slide…)
Ref. Page 269 Chapter 13: System Implementation and Operation Slide 18/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Forms of Documentation
User manual
User manual describes how to use the software
User manual must contain following information:
Installation and operational details of software
Loading and unloading procedures
Starting, running, and terminating procedures
Description and example of any control statements used
All console commands with errors and console messages, their
meaning, reply, and/or operation action
List of error conditions with explanation for their re-entry into the
system
List of programs, which users must execute before and after
execution of each program
Special checks (if any) and security measures, etc.
(Continued on next slide…)
Ref. Page 269 Chapter 13: System Implementation and Operation Slide 19/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Forms of Documentation
Ref. Page 270 Chapter 13: System Implementation and Operation Slide 20/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Forms of Documentation
Ref. Page 270 Chapter 13: System Implementation and Operation Slide 21/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Documentation Standard
It deals with:
How to do documentation?
How to choose meaningful program variable names?
How to design the GUI?
How and up to what detail to include comments?
What diagrams, charts, reports, outputs, etc. are
necessary for completing documentation?
Ref. Page 270 Chapter 13: System Implementation and Operation Slide 22/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Software Deployment
Ref. Page 271 Chapter 13: System Implementation and Operation Slide 24/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Cut-off date
Time
Ref. Page 272 Chapter 13: System Implementation and Operation Slide 25/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Overlapping period of
complete operation of
Old system
both the old and the new
systems
New system
Time
Ref. Page 272 Chapter 13: System Implementation and Operation Slide 26/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Old system
New system
Time
Ref. Page 272 Chapter 13: System Implementation and Operation Slide 27/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
System Evaluation
System Evaluation
Ref. Page 273 Chapter 13: System Implementation and Operation Slide 29/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Software Maintenance
Definition
Ref. Page 274 Chapter 13: System Implementation and Operation Slide 31/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 274 Chapter 13: System Implementation and Operation Slide 32/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 274 Chapter 13: System Implementation and Operation Slide 33/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Controlling Modifications
Ref. Page 274 Chapter 13: System Implementation and Operation Slide 34/35
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 14
Operating Systems
Chapter 14: Operating Systems Slide 1/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Definition and need for operating system
Main functions of an operating system
Commonly used mechanisms for:
Process management
Memory management
File management
Device management
Security
Command interpretation
Some commonly used OS capability enhancement software
Some popular operating systems
Users
Other system
software and application programs
Operating system
Computer hardware
Main Functions of an OS
Process management
Memory management
File management
Device management
Security
Command interpretation
Process Management
Process Management
$END
$RUN
$LOAD
COBOL program
$COBOL
$JOB, ONGC05839,
USER=SINHA
Uniprogramming
Main memory
area
progress
CPU
Uniprogramming
A job does not need CPU for entire duration of its processing
Depending on CPU utilization during the course of processing,
jobs are of two types
CPU-bound jobs, which mostly perform computations
with little I/O operations
I/O-bound jobs, which mostly perform I/O operations
with little computation
In a uniprogramming system, CPU is idle whenever the
currently executing job performs I/O operations
Multiprogramming
Multiprogramming
Main memory
Operating system
Writing output
data
Job A
Job B
Execution in Job C
progress (Waiting for CPU)
Secondary disk
storage
CPU
Multiprogramming
Blocked
Large memory
Memory protection
Job status preservation
Proper job mix (CPU and I/O bound jobs)
CPU scheduling
process state
program counter
values of various CPU
registers
accounting and
scheduling information
I/O status information
Multitasking
Multithreading
Multithreading
Multithreading System
(a) (b)
Multiprocessing
System with two or more CPUs having ability to execute
multiple processes concurrently
Multiple CPUs are used to process either instructions from
different and independent programs or different
instructions from the same program simultaneously
Types of multiprocessing:
Tightly-coupled: Single system-wide primary memory
shared by all processors
Loosely-coupled: Each processor has its own local
memory
Main
memory
Multiprocessing System
Time-sharing
Job is allocated to
CPU for execution
New job Ready Running Job processing
completed
Allotted time slice is over
Blocked
Memory Management
Memory Management
User process
User area
Unused
Partition 1
Partition 2
User area divided into n
equal-sized partitions Partition 3
Partition n
P3 P3 P3 P3
The number, size, and location of the partitions vary dynamically as processes come and go.
Virtual Memory
File Management
File Management
File Naming
File naming deals with the rules for naming files in an
operating system. This may include such rules as:
Maximum number of characters that a file name may
have
Special characters allowed in a file name
Distinction between upper case and lower case letters
Multi-part file names allow file extensions to be part of a
file name. File extensions indicate something about the
file and its content
Used by applications to check for the intended type of
file before operating on it
File
Its meaning
extension
.bas Basic source program file
.c C source program file
.ftn Fortran source program file
.pas Pascal source program file
.obj Object file (compiler output, not yet linked)
.bin Executable binary program file
.lib Library of .obj files used by the linker
.dat Data file
.hlp Text file for HELP command
.man Online manual page file
File
Its meaning
extension
.txt General text file
.bak Backup file
.doc Microsoft word document file
.wav Microsoft windows sound file
.wk4 Lotus 1-2-3 spreadsheet file
.xls Microsoft Excel spreadsheet file
.jpg JPEG graphics file
.gif GIF graphics file
Device Management
DMA transfer
When the operating system prepares for data transfer
operation, it writes the relevant commands and their associated
parameters into the controller’s registers
After the controller has read the data from the device into its
buffer, it copies the data one byte or word at a time from its
buffer into main memory at the specified memory address
It does not involve the CPU
Device controller sends an interrupt to CPU only after it
completes copying the entire data
Security
Security
Security
Command Interpretation
Command Interpretation
Command Interpretation
OS Capability
Enhancement Software
Some Popular
Operating Systems
UNIX OS
MS-DOS
Microsoft Windows
Linux
Open-source OS enhanced and backed by thousands of
programmers world-wide
Multi-tasking, multiprocessing OS, originally designed to
be used in PCs
Name “Linux” is derived from its inventor Linus Torvalds
Several Linux distributions available (Red Hat, SuSE).
Difference in distribution is mostly set of tools, number
and quality of applications, documentation, support, and
service
Mac OS
iOS
WatchOS
Health Kit
Music
Android OS
An open source OS for mobile devices from Google
Keywords/Phrases
Access control Lightweight processes
Android OS Linux
Batch processing Loosely coupled system
Command interpretation Mac OS
Command-line interface (CLI) Memory management
CPU-bound jobs Memory partition
Cryptography Microsoft Windows
Demand paging Microsoft Windows NT
Device manageemnt MS-DOS
External security Multiprocessing
File Multiprogramming
File attributes Multiprogramming with fixed tasks (MFT)
File extensions Multiprogramming with variable tasks (MVT)
File management Multitasking
Graphical User Interface (GUI) Multithreading
I/O-bound jobs Operating system
iOS Process
Internal security Process Control Block (PCB)
Job Process management
Job control language (JCL) Random access files
Library programs Response time (Continued on next slide…)
Keywords/Phrases
Security
Sequential access files
Swapping
Throughput
Tightly coupled system
Time-sharing
Time slice
Time slot
Translating programs
Turnaround time
Uniprogramming system
Unix
User authentication
Utility programs
Virtual machine
Virtual memory
WatchOS
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 15
Application
Software Packages
Chapter 15: Application Software Packages Slide 1/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
Word-processing package
Spreadsheet package
Graphics package
Personal assistance package
Word-Processing Package
Word-Processing Package
Ref. Page 314 Chapter 15: Application Software Packages Slide 4/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Commonly Supported Features in a
Word-Processing Package
Ref. Page 314 Chapter 15: Application Software Packages Slide 5/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 315 Chapter 15: Application Software Packages Slide 6/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 316 Chapter 15: Application Software Packages Slide 7/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 315 Chapter 15: Application Software Packages Slide 8/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 316 Chapter 15: Application Software Packages Slide 9/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 316 Chapter 15: Application Software Packages Slide 10/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 317 Chapter 15: Application Software Packages Slide 11/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
(2)
t R t u Su u1 u2
(u)
a, b, c a, b a, b r a, c s
Ref. Page 319 Chapter 15: Application Software Packages Slide 12/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Spreadsheet Package
Spreadsheet Package
Ref. Page 321 Chapter 15: Application Software Packages Slide 14/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 321 Chapter 15: Application Software Packages Slide 15/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Common Features of Spreadsheet
Package
Ref. Page 322 Chapter 15: Application Software Packages Slide 16/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Sample Spreadsheet
A label running across
Row numbers
multiple columns
Column
letters A B C D E F
1 FINAL EXAM MARKS SHEET(CLASS-X: 2020)
2
3 NAME PHYS CHEM MATHS TOTAL PERCENT A label
4 Cell F4
5 P. Davis 92 95 88 275 91.66
Ref. Page 322 Chapter 15: Application Software Packages Slide 17/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Examples of a Line Graph, a Bar Chart
and a Pie Chart
10%
40%
35%
15%
(a) A line graph (b) A bar chart (c) A pie chart
Ref. Page 325 Chapter 15: Application Software Packages Slide 18/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Graphics Package
Graphics Package
Ref. Page 325 Chapter 15: Application Software Packages Slide 20/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Drawing designs
Painting drawings and pictures
Presenting graphs and charts
Dragging-and-dropping graphic objects
Importing graphic objects
Capturing screen snapshots
Ref. Page 325 Chapter 15: Application Software Packages Slide 21/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 325 Chapter 15: Application Software Packages Slide 22/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Personal Assistance
Package
Personal-assistance Package
Ref. Page 327 Chapter 15: Application Software Packages Slide 24/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Common Features of Personal
Assistance Package
Calendar
To-do list
Address book
Investments book
Inventory book
Ref. Page 327 Chapter 15: Application Software Packages Slide 25/26
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Bit-mapped image Style sheet
Bold Underline
Cell Vector graphics
Center justification What You See Is What you Get
Clip-art library (WYSIWYG)
Computer Aided Design (CAD) Word-processing
Font Word-processing package
Full justification
Graphics package
Italic
Justification
Landscape mode
Left justification
Personal assistance package
Portrait mode
Raster graphics
Right justification
Spreadsheet package
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 16
Business Data
Processing
Chapter 16: Business Data Processing Slide 1/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Learning Objectives
Basic Concepts
Data Processing
Ref. Page 330 Chapter 16: Business Data Processing Slide 4/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Level 1 Character Multiple related bits are combined to form a character (byte).
Ref. Page 331 Chapter 16: Business Data Processing Slide 5/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Relationship Among
Character, Field, Record, and File
A field having Employee Code First Name Last Name Hours worked Hourly rate Tax rate
4 characters 0004 Kumar Rana 40 14.00 0.09
Employee Code First Name Last Name Hours worked Hourly rate Tax rate
0003 Pratap Singh 43 15.00 0.10
Employee Code First Name Last Name Hours worked Hourly rate Tax rate
0002 Ravi Patel 42 10.00 0.07
Employee Code First Name Last Name Hours worked Hourly rate Tax rate
0001 Pradeep Sinha 45 12.00 0.08
A record
Records
Fields of a file
Ref. Page 332 Chapter 16: Business Data Processing Slide 6/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Standard Methods of
Organizing Data
File-oriented Approach
Ref. Page 333 Chapter 16: Business Data Processing Slide 8/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 333 Chapter 16: Business Data Processing Slide 9/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 333 Chapter 16: Business Data Processing Slide 10/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Database-oriented Approach
This approach integrates together data from multiple related
files in the form of a database having following properties:
Provides greater query flexibility
Reduces data redundancy
Solves data integrity (inconsistency) problem
Makes data independent of application programs
Includes data security features at database level, record level,
and even at field level
Ref. Page 333 Chapter 16: Business Data Processing Slide 11/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 334 Chapter 16: Business Data Processing Slide 13/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
File Types
Ref. Page 334 Chapter 16: Business Data Processing Slide 14/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
File Organization
Ref. Page 335 Chapter 16: Business Data Processing Slide 15/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Sequential Files
A sequential file stores its records one after another in
ascending/descending order of their key field values
A computer processes a sequential file in the order in which
the file stores its records
Sequential file organization is the most efficient and
economical file organization for applications in which we have
to update a large number of file records at regularly
scheduled intervals
Activity ratio is ratio of total number of records in transaction
file and total number of records in master file
Ref. Page 335 Chapter 16: Business Data Processing Slide 16/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Sequential Files
Advantages
Simple to understand and use
Easy to organize and maintain
Need relatively inexpensive I/O media and devices
Efficient and economical to use for applications in which activity
ratio is high
Disadvantages
Inefficient and uneconomical to use for applications in which
activity ratio is low
Limited to batch-processing environment because of the need to
accumulate transactions in batches
Precludes possibility of up-to-the-minute data because of the need
to accumulate transactions in batches
Requires extra overhead of sorting the files before using them for
processing
Leads to data redundancy problem
Ref. Page 335 Chapter 16: Business Data Processing Slide 17/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Direct Files
Direct/random file organization is suitable for applications that
directly locate any record by its key field value, without having to
search through a sequence of other records
A direct file stores each record at a location to which the address-
generating function maps the record’s key field value
This mechanism is known as hashing and the address-generating
function is called hashing algorithm
Hashing algorithm sometimes maps the key values of two or more
records to same storage address. This problem is known as collision
To search a record, given its key value, the computer applies the
hashing algorithm on the given key to generate its corresponding
address
If required, an application can process the records of a direct file
sequentially in ascending/descending sequence of key field value
(Continued on next slide…)
Ref. Page 336 Chapter 16: Business Data Processing Slide 18/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Direct Files
Advantages
Can quickly locate and retrieve any record directly
Does not require sorting of transactions
Does not require accumulation of transactions in batches
Can support interactive online applications
Application can process direct file records sequentially
Disadvantages
Require relatively expensive hardware and software resources
Due to address generation overhead involved, they are less
efficient and economical than sequential files for high activity ratio
applications
Often require special security and access synchronization
mechanisms
Ref. Page 337 Chapter 16: Business Data Processing Slide 19/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 337 Chapter 16: Business Data Processing Slide 20/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Employee Address
Address location Employee record
code (key) location
0001 1003 1001 0002 R. S. Patel …
0002 1001 1002 0004 R. K. Rana …
0003 1004 1003 0001 K. P. Sinha …
0004 1002 1004 0003 N. P. Singh …
Ref. Page 338 Chapter 16: Business Data Processing Slide 21/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Advantages
Applications in which activity ratio is high, can use index sequential
files quite efficiently for sequential processing
Applications in which activity ratio is low, can also use index
sequential files quite efficiently for direct access processing
Disadvantages
Require relatively expensive hardware and software resources
Require more storage space than other types of files
Are unsuitable for online applications requiring direct access to
records
Ref. Page 338 Chapter 16: Business Data Processing Slide 22/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
File Utilities
Are routines, which perform generic operations on data files
Sorting utility
Arranges records of a file in some defined sequence
Keys determine the sorting sequence of the file’s records
Enables users to specify their sequencing requirements for a
file by means of input parameters
Reads un-sequenced records of an input file, and by means of
various copying techniques, ultimately produces an output file
containing records of the input file in desired sequence
Searching utility
Finds a particular record in a file
Matches the specified key values with their values in each
record to search the desired record
Efficiency of a search algorithm depends on file organization
(Continued on next slide…)
Ref. Page 338 Chapter 16: Business Data Processing Slide 23/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
File Utilities
Searching a record from a direct or index sequential file
requires much less time than searching a record from a
sequential file
Merging utility
Combines records of two or more ordered (sorted) files into a
single ordered file
Requires records of each of the input files to be sorted in the
same order, although their record layout need not be identical
Places records from each of the input files in their correct
relative order, producing an output file having all records in the
same order as input files
Copying utility
Produces a copy of a file either from one unit of a storage
device to another similar unit or from one storage medium to
another (Continued on next slide…)
Ref. Page 340 Chapter 16: Business Data Processing Slide 24/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
File Utilities
Ref. Page 340 Chapter 16: Business Data Processing Slide 25/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
File Utilities
Maintenance utility
Copies data from one or more files to a new file selectively, or
updates a file’s contents selectively
Ref. Page 341 Chapter 16: Business Data Processing Slide 26/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Sorting on one key in ascending Sorting on two keys in ascending employee-code (secondary
employee-code sequence key) within ascending department-code (primary key)
Ref. Page 339 Chapter 16: Business Data Processing Slide 27/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 340 Chapter 16: Business Data Processing Slide 28/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Database Management
System
Ref. Page 341 Chapter 16: Business Data Processing Slide 30/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Database Models
Ref. Page 341 Chapter 16: Business Data Processing Slide 31/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Hierarchical Databases
Hierarchical database links its data elements as an inverted
tree structure
Below the single-root data element are subordinate elements,
each of which, in turn, has its own subordinate elements, and
so on
Tree can grow to multiple levels
There may be many children elements under each parent
element, but there can be only one parent element for any
child element
Main limitation of hierarchical database is that it does not
support flexible data access
Applications can access its data elements only by following
paths formed by branches of the tree structure
Ref. Page 341 Chapter 16: Business Data Processing Slide 32/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
A child element
Ref. Page 341 Chapter 16: Business Data Processing Slide 33/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Network Databases
Ref. Page 342 Chapter 16: Business Data Processing Slide 34/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
College
Computer
Courses English Hindi Mathematics
Science
Ref. Page 342 Chapter 16: Business Data Processing Slide 35/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Relational Databases
Ref. Page 343 Chapter 16: Business Data Processing Slide 36/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Relational Databases
Ref. Page 343 Chapter 16: Business Data Processing Slide 37/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 343 Chapter 16: Business Data Processing Slide 38/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Sample Report
Ref. Page 344 Chapter 16: Business Data Processing Slide 39/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Object-oriented Databases
Ref. Page 344 Chapter 16: Business Data Processing Slide 40/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Object-oriented Databases
Ref. Page 344 Chapter 16: Business Data Processing Slide 41/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Object-Oriented Database
Vehicle VehicleSpecs
Id Length
Color Width
Specifications Height
Manufacturer Engine Type
Fuel Type
Fuel Tank Capacity
No. of Wheels
TwoWheeler FourWheeler
Other details Other details
of the vehicle of the vehicle Company Employee
like with/ like no. of
without gear, doors, seating Name Id
seating capacity, etc. Location Name
capacity, etc. President Age
DomesticCompany ForeignCompany
Ref. Page 345 Chapter 16: Business Data Processing Slide 42/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 346 Chapter 16: Business Data Processing Slide 43/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 347 Chapter 16: Business Data Processing Slide 44/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Creating a Database
Ref. Page 348 Chapter 16: Business Data Processing Slide 45/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
CITY: PUNE
STATE: MH
POSTAL CODE: 411007
Ref. Page 349 Chapter 16: Business Data Processing Slide 46/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Viewing, Modifying, Deleting, and
Adding Records
Ref. Page 350 Chapter 16: Business Data Processing Slide 47/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Searching a Database
Ref. Page 351 Chapter 16: Business Data Processing Slide 48/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Creating Reports
Ref. Page 352 Chapter 16: Business Data Processing Slide 49/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Ref. Page 353 Chapter 16: Business Data Processing Slide 50/52
Computer Fundamentals: Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Key Words/Phrases
Query By Example
Query language
Record
Relational database
Report file
Report Generator
Schema
Searching
Secondary key
Sequential file
Sorting
Transaction file
Tuple
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 17
Data Communications
& Computer Networks
Chapter 17: Data Communications & Computer Networks Slide 1/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
In this chapter you will learn about:
Basic elements of a communication system
Techniques, channels, and devices used to transmit data
between distant locations
Types of computer networks
Communication protocols and their use in computer
networks
Internetworking tools and their use in building large
computer networks
Wireless communications technologies and wireless
networks
Characteristics and advantages of distributed computing
systems
Ref. Page 357 Chapter 17: Data Communications & Computer Networks Slide 4/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Basic Elements of a Communication
System
Ref. Page 358 Chapter 17: Data Communications & Computer Networks Slide 5/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Sender Receiver
(a) Simplex
Sender Receiver
OR
(or Receiver) (or Sender)
(b) Half-duplex
Sender Receiver
(and Receiver) AND (and Sender)
(c) Full-duplex
Ref. Page 358 Chapter 17: Data Communications & Computer Networks Slide 6/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 359 Chapter 17: Data Communications & Computer Networks Slide 7/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 359 Chapter 17: Data Communications & Computer Networks Slide 8/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 360 Chapter 17: Data Communications & Computer Networks Slide 10/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 360 Chapter 17: Data Communications & Computer Networks Slide 11/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Coaxial Cable
Central copper
PVC insulation wire
Copper mesh
Ref. Page 360 Chapter 17: Data Communications & Computer Networks Slide 12/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
In between
repeaters
Ref. Page 360 Chapter 17: Data Communications & Computer Networks Slide 13/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Satellite in space
6 GHz 4 GHz
Uplink Downlink
Transmitting Receiving
station on earth station on earth
Ref. Page 361 Chapter 17: Data Communications & Computer Networks Slide 14/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 363 Chapter 17: Data Communications & Computer Networks Slide 15/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 364 Chapter 17: Data Communications & Computer Networks Slide 17/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 364 Chapter 17: Data Communications & Computer Networks Slide 18/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Voltage
+v
t
0 1/f 2/f
-v
(a) Analog signal
v
1 1 1 1
0 0 0 0
t
(b) Digital signal
Ref. Page 365 Chapter 17: Data Communications & Computer Networks Slide 19/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Modulation Techniques
Ref. Page 365 Chapter 17: Data Communications & Computer Networks Slide 20/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Modems
Ref. Page 365 Chapter 17: Data Communications & Computer Networks Slide 21/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Analog signals on
Digital signals telephone line Digital signals
01 10 0 1 10
Modulator Demodulator
Sender Receiver
computer computer
Demodulator Modulator
0 10 0 0 1 0 0
Ref. Page 366 Chapter 17: Data Communications & Computer Networks Slide 22/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Transmission speed
Internal versus external
Facsimile facility
Error correction
Data compression
Ref. Page 366 Chapter 17: Data Communications & Computer Networks Slide 23/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Data Transmission
Services
Ref. Page 367 Chapter 17: Data Communications & Computer Networks Slide 25/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 368 Chapter 17: Data Communications & Computer Networks Slide 26/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Multiplexing Techniques
Multiplexing
Method of dividing physical channel into many logical
channels so that a number of independent signals may
be simultaneously transmitted
Electronic device that performs multiplexing is known
as a multiplexer
Multiplexing enables a single transmission medium to
concurrently transmit data between several
transmitters and receivers
Ref. Page 368 Chapter 17: Data Communications & Computer Networks Slide 28/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
A Multiplexed System
T1 T2 T3 T4
Multiplexer
Modem
Modem
Multiplexer
Computer
Ref. Page 368 Chapter 17: Data Communications & Computer Networks Slide 29/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 369 Chapter 17: Data Communications & Computer Networks Slide 30/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Frequency-Division Multiplexing
Modulator Demodulator
Signal-1 40 KHz 40 KHz Signal-1
Ref. Page 369 Chapter 17: Data Communications & Computer Networks Slide 31/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Time-Division Multiplexing
Signal A A3 A2 A1 A3 A2 A1
Sender Receiver
end end
Signal B B3 B2 B1 Channel Demulti- B3 B2 B1
plexer
… C2 B2 A21 C1 B1 A1
Signal C C3 C2 C1 C3 C2 C1
Ref. Page 369 Chapter 17: Data Communications & Computer Networks Slide 32/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Asynchronous and
Synchronous Transmission
Ref. Page 370 Chapter 17: Data Communications & Computer Networks Slide 34/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Asynchronous and Synchronous
Transmission
Synchronous transmission
Sender and receiver must synchronize with each
other to get ready for data transmission before it
takes place
Entire blocks of characters are framed and
transmitted together
Well suited to remote communication between a
computer and such devices as buffered terminals
and printers
Ref. Page 371 Chapter 17: Data Communications & Computer Networks Slide 35/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Asynchronous Transmission
Ref. Page 370 Chapter 17: Data Communications & Computer Networks Slide 36/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Synchronous Transmission
Ref. Page 370 Chapter 17: Data Communications & Computer Networks Slide 37/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Switching Techniques
Data is often transmitted from source to destination
through a network of intermediate nodes
Switching techniques deal with the methods of
establishing communication links between the sender
and receiver in a communication network
Three commonly used switching techniques are:
Circuit switching: Dedicated physical path is
established between sending and receiving stations
through nodes of the network for the duration of
communication
Ref. Page 371 Chapter 17: Data Communications & Computer Networks Slide 39/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Switching Techniques
Ref. Page 372 Chapter 17: Data Communications & Computer Networks Slide 40/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Switching nodes
Dotted lines and shaded
balls indicate the circuit
established
Ref. Page 372 Chapter 17: Data Communications & Computer Networks Slide 41/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Store-and-Forward Method of
Message Switching
4 B
A 1
3
Ref. Page 373 Chapter 17: Data Communications & Computer Networks Slide 42/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Nodes 1 2 3 n
Message
Broadcast channel
Ref. Page 373 Chapter 17: Data Communications & Computer Networks Slide 43/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Routing Techniques
Ref. Page 374 Chapter 17: Data Communications & Computer Networks Slide 44/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Routing Techniques
Ref. Page 374 Chapter 17: Data Communications & Computer Networks Slide 45/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Network Topologies
and Types
Network Topology
A network’s topology refers to the way in which the network
links its nodes
It determines the various data paths available between any
pair of nodes in the network
Choice of a topology depends on a combination of factors
such as:
Desired performance
Desired reliability
Size of the system
Expandability
Cost of components and services
Availability of communication lines
Acceptable delays in routing
Ref. Page 375 Chapter 17: Data Communications & Computer Networks Slide 47/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Network Topologies
Although number network topologies are possible, four
major ones are:
Star network
Ring network
Completely connected network
Multi-access bus network
Ref. Page 375 Chapter 17: Data Communications & Computer Networks Slide 48/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Star Network
Host node
Ref. Page 375 Chapter 17: Data Communications & Computer Networks Slide 49/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ring Network
Ref. Page 376 Chapter 17: Data Communications & Computer Networks Slide 50/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 376 Chapter 17: Data Communications & Computer Networks Slide 51/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 377 Chapter 17: Data Communications & Computer Networks Slide 52/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Hybrid Network
Ref. Page 377 Chapter 17: Data Communications & Computer Networks Slide 53/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Network Types
Five types of networks in common use are:
Personal-area networks (PANs)
Local-area networks (LANs)
Campus-area networks (CANs)
Metropolitan-area networks (MANs)
Wide-area networks (WANs)
Ref. Page 378 Chapter 17: Data Communications & Computer Networks Slide 54/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Communication Protocols
Communication Protocols
Ref. Page 379 Chapter 17: Data Communications & Computer Networks Slide 56/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Data sequencing
Breaking a long message into smaller packets of fixed size
Rules define method of numbering packets to detect loss or
duplication of packets, and to identify packets
Data routing
Decide the path between source and destination
Data formatting
Define which group of bits or characters within a packet
constitutes data, control, addressing, or other information
Flow control
Prevent a fast sender from flooding a slow receiver with data by
regulating flow of data on communication lines
(Continued on next slide)
Ref. Page 379 Chapter 17: Data Communications & Computer Networks Slide 57/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 379 Chapter 17: Data Communications & Computer Networks Slide 58/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Concept of Layered Protocols in
Network Design
Networks have modular design for easy and efficient handling of
the system
Consist of several modules, which are grouped into layers
logically
Each layer offers certain services to higher layers, shielding those
layers from implementation details of services offered by lower
layers
Each layer has its own set of protocols
Main reasons for using layered protocols are:
Layers makes their implementation more manageable
Provides well-defined interfaces between layers
Allows interaction between functionally paired layers in different
locations
Protocol suite, protocol family, or protocol stack are terms used to
refer to a collection of protocols of a network system
Ref. Page 380 Chapter 17: Data Communications & Computer Networks Slide 59/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 380 Chapter 17: Data Communications & Computer Networks Slide 60/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 380 Chapter 17: Data Communications & Computer Networks Slide 61/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Layers, Interfaces, and Protocols
in the OSI Model
Node 1 Node 2
Process A Process B
Application protocol
Layer 7 (application) Layer 7 (application)
Interface Interface
Presentation protocol Layer 6 (presentation)
Layer 6 (presentation)
Interface Interface
Session protocol
Layer 5 (session) Layer 5 (session)
Interface Interface
Transport protocol
Layer 4 (transport) Layer 4 (transport)
Interface Interface
Network protocol
Layer 3 (network) Layer 3 (network)
Interface Interface
Data-link protocol
Layer 2 (data link) Layer 2 (data link)
Interface Interface
Physical protocol
Layer 1 (physical) Layer 1 (physical)
Network
Ref. Page 381 Chapter 17: Data Communications & Computer Networks Slide 62/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
An example illustrating transfer of message M from sending node to the
receiving node in the OSI model: Hn, header added by layer n:Tn, trailer
added by layer n.
Process A Process B
H7 M H7 M
H6 H7 M H6 H7 M
H5 H6 H7 M H5 H6 H7 M
H4 H5 H6 H7 M1 H4 H5 H6 H7 M2 H4 H5 H6 H7 M1 H4 H5 H6 H7 M2
H3 H4 H5 H6 H7 M1 H3 H4 H5 H6 H7 M2 H3 H4 H5 H6 H7 M1 H3 H4 H5 H6 H7 M2
H2 H3 H4 H5 H6 H7 M1 T2 H2 H3 H4 H5 H6 H7 M2 T2 H2 H3 H4 H5 H6 H7 M1 T2 H2 H3 H4 H5 H6 H7 M2 T2
Ref. Page 384 Chapter 17: Data Communications & Computer Networks Slide 63/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Internetworking Tools
Internetworking
Ref. Page 384 Chapter 17: Data Communications & Computer Networks Slide 65/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Bridges
Ref. Page 384 Chapter 17: Data Communications & Computer Networks Slide 66/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Routers
Ref. Page 385 Chapter 17: Data Communications & Computer Networks Slide 67/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Gateways
Ref. Page 385 Chapter 17: Data Communications & Computer Networks Slide 68/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Wireless Networks
Ref. Page 385 Chapter 17: Data Communications & Computer Networks Slide 70/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Lower bandwidth
Variable bandwidth
Higher error rate
Increased security concern
Dynamically changing network
Lost or degraded connection
Support for routing and location
management functions
Limited power
Ref. Page 385 Chapter 17: Data Communications & Computer Networks Slide 71/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Wireless Applications
Ref. Page 386 Chapter 17: Data Communications & Computer Networks Slide 72/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Wireless Technologies
Ref. Page 387 Chapter 17: Data Communications & Computer Networks Slide 73/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 387 Chapter 17: Data Communications & Computer Networks Slide 74/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
S. No. Features 1G 2G 3G 4G 5G
Maximum 64 Kbps,
2.4
2. communication 384 Kbps 2 Mbps 1 Gbps 35.46 Gbps
Kbps
speed with 2.5G
Ref. Page 389 Chapter 17: Data Communications & Computer Networks Slide 75/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
S. No. Features 1G 2G 3G 4G 5G
4. Key Services Analog Digital Digital phone IP-based IP-based services
phone phone calls, True services including phone calls,
calls calls, and multimedia including Multimedia messaging,
Messaging messaging phone calls, Web access, HDTV,
(SMS, including Multimedia Video conferencing,
MMS) video, Video messaging, High-end mobile
conferencing, Web access, gaming, Mobile cloud
Mobile TV, HDTV, Video computing, Interactive
Video games, conferencing, multimedia
Web-based IP telephony, applications, Mobile
applications High-end applications based on
mobile device-to-device
gaming, communication (IoT
Mobile cloud applications), etc. with
computing far better experience
than before.
Ref. Page 389 Chapter 17: Data Communications & Computer Networks Slide 76/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Distributed Computing
Systems
Ref. Page 390 Chapter 17: Data Communications & Computer Networks Slide 78/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Main Advantages of Distributed
Computing Systems
Inherently distributed applications
Information sharing among distributed users
Resource sharing
Better price-performance ratio
Shorter response times and higher throughput
Higher reliability
Extensibility and incremental growth
Better flexibility in meeting users’ needs
Ref. Page 390 Chapter 17: Data Communications & Computer Networks Slide 79/81
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Keywords/Phrases
1G technology Completely connected network
2G technology Computer network
3G technology Data-link layer
4G technology Demodulation
5G technology Dial-up line
Amplifier Distributed Computing System
Amplitude Modulation (AM) Ethernet
Application layer Fax modem
ARPANET File Transfer Protocol (FTP)
Asynchronous transmission Frequency Modulation (FM)
Bandwidth Frequency-Division Multiplexing (FDM)
Baud Full duplex
Bridge Gateway
Broadband Half duplex
Broadcast Hop-by-hop routing
Campus Area Network (CAN) Hybrid network
C-band transmission Internet Protocol (IP)
Circuit switching Internetworking
Coaxial cable ISDN (Integrated Services Digital Network)
Common Carriers Ku-band transmission
Communication protocol Leased line
Communications satellite Local Area Network (LAN)
(Continued on next slide)
Keywords/Phrases
Message switching Ring network
Metropolitan Area Network (MAN) Router
Microwave system Session layer
Mobile computing Simplex
Modem Source routing
Modulation Star network
Multi-access Bus network Store-and-forward
Multiplexer Synchronous transmission
Narrowband Time-Division Multiplexing (TDM)
Network Interface Card (NIC) Transport Control Protocol (TCP)
Network layer Transport layer
Network topology Twisted-pair
Nomadic computing Unshielded twisted-pair (UTP)
Optical fibers User Datagram Protocol (UDP)
OSI Model Value Added Network (VAN)
Packet switching Voiceband
Phase Modulation (PM) VSAT (Very Small Aperture Terminals)
Physical layer Wireless Application Protocol (WAP)
POTS (Plain Old Telephone Service) Wide Area Network (WAN)
Presentation layer WiMax
Protocol family Wireless LAN
Protocol stack Wireless Local Loop (WLL)
Protocol suite Wireless network
Repeater
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 18
Learning Objectives
Ref. Page 397 Chapter 18: The Internet and Internet of Things Slide 7/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Electronic Mail
Ref. Page 397 Chapter 18: The Internet and Internet of Things Slide 8/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 397 Chapter 18: The Internet and Internet of Things Slide 9/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Telnet
Ref. Page 398 Chapter 18: The Internet and Internet of Things Slide 10/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Usenet News
Several usenet news groups exist on the Internet and
are called newsgroups
In a moderated newsgroup only selected members have
the right to directly post (write) a message to the virtual
notice board. Other members can only read the posted
messages
In a nonmoderated newsgroup any member can directly
post a message to the virtual notice board
A moderated newsgroup ensures quality of posted
messages
Netiquette (network etiquette) deals with rules of
framing messages that will not hurt others
Ref. Page 398 Chapter 18: The Internet and Internet of Things Slide 11/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 399 Chapter 18: The Internet and Internet of Things Slide 15/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
WWW Browsers
To use a computer as a web client, a user needs to load on it
a special software tool known as WWW browser (browser)
Browsers provide following navigation facilities:
Do not require a user to log in to a server computer
Enable a user to visit a server computer’s site directly and
access information on it by specifying its URL (Uniform
Resource Locator)
Enable a user to create and maintain a personal hotlist of
favorite URL
Maintain a history of server computers visited by a user in a
surfing session
Enable a user to download information in various formats
Google (www.google.com)
Yahoo (www.yahoo.com)
Lycos (www.lycos.com)
Infoseek (www.infoseek.com)
HotBot (www.hotbot.com)
Inference Find (www.infind.com)
Ixquick (www.ixquick.com)
Ref. Page 401 Chapter 18: The Internet and Internet of Things Slide 22/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Internet of Things
What It Is?
Ref. Page 403 Chapter 18: The Internet and Internet of Things Slide 24/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Things in IoT?
Ref. Page 403 Chapter 18: The Internet and Internet of Things Slide 25/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Benefits of IoT
• Increased accuracy
• Increased efficiency
• Reduced wastage
Ref. Page 403 Chapter 18: The Internet and Internet of Things Slide 26/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 404 Chapter 18: The Internet and Internet of Things Slide 27/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
1. Interoperability issue
5. Reliability issue
Ref. Page 407 Chapter 18: The Internet and Internet of Things Slide 28/29
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Keywords/Phrases
Anonymous ftp site Smart healthcare
Browser Smart home
Download Smart manufacturing
Electronic mail (e-mail) Smart objects
File Transfer Protocol (FTP) Smart transportation system
Hypertext Standard Generalized Markup
Hypertext Transport Protocol (HTTP) Language (SGML)
Industry 4.0 Telnet
Internet Things
Internet of Things (IoT) Uniform Resource Locator (URL)
Internet search engine Upload
Netiquette Usenet
Newsgroup Video conferencing
On-line shopping Web casting
Publicly accessible sites Web client
Smart agriculture/farming Web crawler
Smart city Web Server
Smart energy management World Wide Web (WWW)
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 19
Multimedia
Chapter 19: Multimedia Slide 1/36
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
What is Multimedia?
Multimedia
Common Media
Common media for storage, access, and transmission of
information are:
Text (alphanumeric characters)
Graphics (line drawings and images)
Animation (moving images)
Audio (sound)
Video (Videographed real-life events)
Multimedia in information technology refers to use of more
than one of these media for information presentation to
users
Multimedia Components
Text Media
Alphanumeric characters are used to present information
in text form. Computers are widely used for text
processing
Keyboards, electronic writing pads, OCRs, terminal
screens, and printers are some commonly used
hardware devices for processing text media
Text editing, text searching, hypertext, and text
importing/exporting are some highly desirable features
of a multimedia computer system for better presentation
and use of text information
Graphics
Graphics Types
Line drawings
Drawings are illustrations in the form of 2D and 3D pictures
created from mathematical representation of simple objects like
lines, circles, arcs, etc.
Area of computer graphics that deals with this type of pictures is
known as generative graphics
Images
Computers store pixels of an image as a two-dimensional matrix
This two-dimensional representation is called image resolution
Each pixel is composed of three components: red (R), green (G),
blue (B)
On a display screen, each component of a pixel corresponds to a
phosphor
(Continued on next slide…)
Graphics Types
An Image Composition
R G
Animation Media
Computer animation deals with generation, sequencing,
and display (at a specified rate) of a set of images
(called frames) to create an effect of visual change or
motion, similar to a movie film (video)
Animation is commonly used in those instances where
videography is not possible or animation can better
illustrate the concept than video
Animation deals with displaying a sequence of images at
a reasonable speed to create an impression of
movement. For a jerk-free full motion animation, 25 to
30 frames per second is required
Animation-creation software
Screen-capture software
Animation clips
Animation file importing
Software support for high resolution
Recording and playback capability
Transition effects
Virtual Reality
Audio
Secondary Network
Memory
storage I/O
D
Data in analog form
D/A
converter Analog data
Data in digital form
A output device
Audio Processing
Audio clips
Audio file importing
Software support for high quality sound
Recording and playback capability
Text-to-speech conversion software
Speech-to-text conversion software
Voice recognition software
Video
Video camera
Video monitor
Video board with A/D and D/A converters, and
connectors for video camera and video monitor
Video editors
Video clips
It is a library of video clips
A user can import a video clip directly from this library for
use in a multimedia application
Recording and playback capability
Enables users to control recording and display of a video
sequence
Multimedia Applications
Multimedia Applications
Multimedia books and e-Books
Digital library
Multimedia presentation
Foreign language learning
Video games
Special effects in movies
Animation films
Animated advertisements
Multimedia kiosk
Virtual shops and shopping malls
Multimedia conferencing
Smart/Interactive TV
A Video-on-Demand System
Disks
Set-top box
Remote
control
Tapes
TV monitor
Video server
Customer’s home
Mouse
Keyboard
Keywords/Phrases
Animation
Audio
Clip art
Cognitive graphics
Computer Aided Design (CAD)
Computer Aided Manufacturing (CAM)
Digital library
Frames
Generative graphics
Graphics
Interactive TV
Multimedia
Media Center Computer
Pixel
Refresh rate
Text
Transducer
Transition effects
Unimedia presentation
Video
Virtual reality
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 20
Classification of
Computers
Chapter 20: Classification of Computers Slide 1/33
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
Classifications of computers
Common types of computers used today
Characteristic features of various types of
computers in use today
Computer Classification
Types of Computers
Notebook Computers
(Laptops)
Notebook Computers
Portable computers mainly meant for use by people who
need computing resource wherever they go
Approximately of the size of an 8½ x 11 inch notebook and
can easily fit inside a briefcase
Weigh only around 2 kg or less.
Comfortably placed on ones lap while being used. Hence,
they are also called laptop PCs.
Lid with display screen is foldable in a manner that when
not in use it can be folded to flush with keyboard to
convert the system into notebook form
Notebook Computers
Designed to operate with chargeable batteries
Mostly used for word processing, spreadsheet
computing, data entry, and power point presentations
Normally run MS-DOS, MS WINDOWS Mac OS, or Linux
operating system
Some manufacturers are also offering models with
GNU/Linux or its distributions
Each device of laptop is designed to use little power and
remain suspended if not used
Notebook Computers
Common PC Models
Monitor
System
Unit Mouse
Mouse
Keyboard
(a) Desktop model (b) Tower model
Workstations
Workstations
Powerful desktop computer designed to meet the
computing needs of engineers, architects, and other
professionals
Provides greater processing power, larger storage, and
better graphics display facility than PCs
Commonly used for computer-aided design, multimedia
applications, simulation of complex scientific and
engineering problems, and visualization
Generally run server version of Windows, Mc OS, Linux, or
UNIX operating system
Operating system is generally designed to support
multiuser environment
Mainframe Systems
Mainframe Systems
Mainly used by large organizations as banks, insurance
companies, hospitals, railways, etc.
Used for data handling and information processing
requirements
Used in such environments where a large number of
users need to share a common computing facility
Oriented to input/output-bound applications
Mainframe Systems
Host processor
Printer
Console
Front-end processor
Supercomputers
Supercomputers
Most powerful and most expensive computers available at
a given time.
Primarily used for processing complex scientific
applications that require enormous processing power
Well known supercomputing applications include:
Analysis of large volumes of seismic data
Simulation of airflow around an aircraft
Crash simulation of the design of an automobile
Solving complex structure engineering problems
Weather forecasting
Creating special effects for movies and TV programs
(Continued on next slide)
Supercomputers
Client-Server Computing
Involves splitting an application into tasks and putting
each task on computer where it can be handled most
efficiently
Computers and operating systems of a client and a
server may be different
Common for one server to use the services of another
server, and hence act both as client and server
Concept of client and server computers is purely role-
based and may change dynamically as the role of a
computer changes
PC (Client)
PC (Client) File
Server
LAN or WAN or an
Internet of Networks
PC (Client)
Database
Server
Workstation
(Client)
Workstation
(Client)
Handheld Computers
Handheld Computers
Handheld Computers
Key features
Super
Personal Mainframe
Notebook Workstation compute Client Server Handheld
Computer system
Types of r
computers
Size Very small Small Medium Large Large Generally Generally Very small (can
(can be (can be placed (Slightly larger (needs a (needs a small large be placed on
placed on an office than PC) large room) large (may be ones palm)
on ones lap) table) room) large if it
also plays
the role of a
server)
Processing power Low Low High Higher Highest Generally Generally high Low
low
Main memory Low Low High Higher Highest Generally Generally high Low
capacity low
Hard disk storage Low Low High Highest Higher Generally Generally high Low
capacity low
Has its own Yes Yes Yes Generally Generally Yes Generally no No
monitor, keyboard, no no
and mouse for
user interface
Key features
Super
Personal Mainframe
Notebook Workstation compute Client Server Handheld
Computer system
Types of r
computers
Display facility Foldable Medium size Large-screen Generally Generally Medium to Generally not Small display
flat screen display screen display that can not not large available
small display high- available available screen
display resolution display
graphics
Single/multiple Single Generally Generally multiple Multiple Multiple Generally Generally Single
processors single single multiple
Single/multiple Single Single Generally single Multiple Multiple Single Multiple Single
- User oriented
Popular MS-DOS, MS-DOS, Server version of A variant of A variant MS-DOS, Server MS-Wndows
operating MS- MS-Windows, Windows, Mac OS, Unix, or of Unix, MS- version of Mobile, iOS,
systems Windows, Windows-NT, Linux or Unix proprietary or Windows, Windows, Palm OS,
Mac OS, Mac OS, proprieta Windows- Mac OS, Symbian OS,
Linux Linux, ry NT, Linux or Unix Linux,
Unix Mac OS, Blackbery OS
Linux,
Unix
Key features
Popular usage Word Personal Computing needs Processing Large Provide Manage a Computing,
processing; computing of engineers, of I/O- processor- highly user- shared Personal
Spreadsheet; needs of architects, bound bound friendly resource Information
Data Entry; individuals designers; applications applica- interface in and Management
Preparing either at Simulation of tions like a client- provide a (PIM), cell
presentation their work complex scientific complex server set of phone, digital
materials; places or at and engineering scientific computing shared camera
and Making their homes; problems and simulations environment user
presentations and visualizing the services in
Education results of a client-
and simulation; and server
entertainme Multimedia computing
nt of applications environm
children and ent
adults
Major vendors IBM, IBM, Apple, Sun IBM, DEC Cray, IBM, Same as PC Same as Nokia, Sony,
Compaq, Compaq, Microsystems, Silicon and Workstati Apple,
Siemens, Dell, IBM, DEC, Graphics, Workstation on, Samsung,
Apple, Siemens, Hewlett-Packard, Fujitsu, vendors Mainframe Motorola, Dell,
Toshiba Toshiba, Silicon Graphics Intel, System, Hawlett-
Hewlett- C-DAC and Packard
Packard, Supercom
Lenovo puter
vendors
Key Words/Phrases
Back-end computer
Client computer
Client process
Front-end computer
Host computer
Handheld
I/O-bound application
Laptop PC
Mainframe system
Massively parallel processors
Minicomputer
Notebook computer
Parallel computers
Parallel processing system
Personal Computer (PC)
Processor-bound application
Server computer
Server process
Supercomputer
System board
Workstation
Computer Fundamentals
Pradeep K. Sinha
Priti Sinha
Chapter 21
Introduction to C
Programming
Language
Chapter 21: Introduction to C Programming Languages Slide 1/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Learning Objectives
Features of C
Ref. Page 442 Chapter 21: Introduction to C Programming Languages Slide 4/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
C Character Set
Uppercase alphabets A, B, C, …, Z 26
Lowercase alphabets a, b, c, …, z 26
Digits 0, 1, 2, …, 9 10
~ `! @ # % ^ & * ( ) _
Special characters 31
| \ {}[ ]:; " ' , . ? /
93
Ref. Page 443 Chapter 21: Introduction to C Programming Languages Slide 5/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Constants
Ref. Page 443 Chapter 21: Introduction to C Programming Languages Slide 6/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Rules for Constructing Integer
Constants
Must have at least one digit
+ or – sign is optional
No special characters (other than + and – sign) are
allowed
Allowable range is:
-32768 to 32767 for integer and short integer
constants (16 bits storage)
-2147483648 to 2147483647 for long integer
constants (32 bits storage)
Examples are: 8, +17, -6
Ref. Page 444 Chapter 21: Introduction to C Programming Languages Slide 7/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Rules for Constructing Real
Constants in Fractional Form
Ref. Page 444 Chapter 21: Introduction to C Programming Languages Slide 8/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Rules for Constructing Real Constants
in Exponential Form
Ref. Page 444 Chapter 21: Introduction to C Programming Languages Slide 9/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Rules for Constructing Character
Constants
Ref. Page 444 Chapter 21: Introduction to C Programming Languages Slide 10/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Variables
A C variable is an entity whose value may vary during
program execution
It has a name and type associated with it
Variable name specifies programmer given name to
the memory area allocated to a variable
Variable type specifies the type of values a variable
can contain
Example: In i = i + 5, i is a variable
Ref. Page 445 Chapter 21: Introduction to C Programming Languages Slide 11/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 445 Chapter 21: Introduction to C Programming Languages Slide 12/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Data Types Used for Variable Type
Declaration
Ref. Page 446 Chapter 21: Introduction to C Programming Languages Slide 13/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
int count;
short index;
long principle;
float area;
double radius;
char c;
Ref. Page 446 Chapter 21: Introduction to C Programming Languages Slide 14/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Standard Qualifiers in C
Sign signed + or –
unsigned + only
Ref. Page 446 Chapter 21: Introduction to C Programming Languages Slide 15/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Lifetime and Visibility Scopes of
Variables
Ref. Page 446 Chapter 21: Introduction to C Programming Languages Slide 16/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Keywords
Keywords (or reserved words) are predefined words whose
meanings are known to C compiler
C has 32 keywords
Keywords cannot be used as variable names
Ref. Page 447 Chapter 21: Introduction to C Programming Languages Slide 17/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Comments
Comments are enclosed within / and /
Comments are ignored by the compiler
Comment can also split over multiple lines
Example: / This is a comment statement /
Ref. Page 447 Chapter 21: Introduction to C Programming Languages Slide 18/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Operators
Operators
Operators in C are categorized into data access,
arithmetic, logical, bitwise, and miscellaneous
Associativity defines the order of evaluation when
operators of same precedence appear in an expression
a = b = c = 15, ‘=’ has R L associativity
First c = 15, then b = c, then a = b is evaluated
Precedence defines the order in which calculations
involving two or more operators is performed
x + y z , ‘’ is performed before ‘+’
Ref. Page 448 Chapter 21: Introduction to C Programming Languages Slide 20/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Arithmetic Operators
Operator Meaning with Example Associativity Precedence
Arithmetic Operators
+ Addition; x+y LR 4
- Subtraction; x-y LR 4
Multiplication; xy LR 3
/ Division; x/y LR 3
% Remainder (or Modulus); x%y LR 3
++ Increment;
x++ means post-increment (increment LR 1
the value of x by 1 after using its value);
Ref. Page 448 Chapter 21: Introduction to C Programming Languages Slide 21/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Arithmetic Operators
Associativit
Operator Meaning with Example Precedence
y
Arithmetic Operators
-- Decrement;
x-- means post-decrement (decrement LR 1
the value of x by 1 after using its value);
--x means pre-decrement (decrement RL 2
the value of x by 1 before using its value)
Ref. Page 448 Chapter 21: Introduction to C Programming Languages Slide 22/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Logical Operators
Operator Meaning with Example Associativity Precedence
Logical Operators
! Reverse the logical value of a single variable; RL 2
!x means if the value of x is non-zero, make it
zero; and if it is zero, make it one
> Greater than; x>y LR 6
< Less than; x<y LR 6
>= Greater than or equal to; x >= y LR 6
<= Less than or equal to; x <= y LR 6
== Equal to; x == y LR 7
!= Not equal to; x != y LR 7
&& AND; x && y means both x and y should be LR 11
true (non-zero) for result to be true
|| OR; x || y means either x or y should be true LR 12
(non-zero) for result to be true
Ref. Page 449 Chapter 21: Introduction to C Programming Languages Slide 23/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Bitwise Operators
Operator Meaning with Example Associativity Precedence
Bitwise Operators
~ Complement; ~x means RL 2
All 1s are changed to 0s and 0s to 1s
& AND; x & y means x AND y LR 8
| OR; x | y means x OR y LR 10
^ Exclusive OR; x ^ y means x y LR 9
<< Left shift; x << 4 means shift all bits in x LR 5
four places to the left
>> Right shift; x >> 3 means shift all bits LR 5
in x three places to the right
&= x &= y means x = x & y RL 14
|= x |= y means x = x | y RL 14
^= x ^= y means x = x ^ y RL 14
<<= x <<= 4 means shift all bits in x four places RL 14
to the left and assign the result to x
>>= x >>= 3 means shift all bits in x three RL 14
places to the right and assign the result to x
Ref. Page 449 Chapter 21: Introduction to C Programming Languages Slide 24/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 450 Chapter 21: Introduction to C Programming Languages Slide 25/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Miscellaneous Operators
Associativit Precedenc
Operator Meaning with Example
y e
Miscellaneous Operators
Ref. Page 450 Chapter 21: Introduction to C Programming Languages Slide 26/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Statements
Statements
C program is a combination of statements written
between { and } braces
Each statement performs a set of operations
Null statement, represented by “;” or empty {} braces,
does not perform any operation
A simple statement is terminated by a semicolon “;”
Compound statements, called statement block, perform
complex operations combining null, simple, and other
block statements
Ref. Page 450 Chapter 21: Introduction to C Programming Languages Slide 28/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Examples of Statements
Ref. Page 450 Chapter 21: Introduction to C Programming Languages Slide 29/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
I/O Operations
Ref. Page 451 Chapter 21: Introduction to C Programming Languages Slide 31/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Basic Library Functions for I/O
Operations
I/O Library
Meanings
Functions
getch() Inputs a single character (most recently typed) from standard input (usually
console).
getche() Inputs a single character from console and echoes (displays) it.
getchar() Inputs a single character from console and echoes it, but requires Enter key to be
typed after the character.
putchar() or Outputs a single character on console (screen).
putch()
scanf() Enables input of formatted data from console (keyboard). Formatted input data
means we can specify the data type expected as input. Format specifiers for
different data types are given in Figure 21.6.
printf() Enables obtaining an output in a form specified by programmer (formatted
output). Format specifiers are given in Figure 21.6. Newline character “\n” is
used in printf() to get the output split over separate lines.
gets() Enables input of a string from keyboard. Spaces are accepted as part of the input
string, and the input string is terminated when Enter key is hit. Note that although
scanf() enables input of a string of characters, it does not accept multi-word
strings (spaces in-between).
puts() Enables output of a multi-word string
Ref. Page 451 Chapter 21: Introduction to C Programming Languages Slide 32/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Basic Format Specifiers for
scanf() and printf()
Format
Data Types
Specifiers
%d integer (short signed)
%u integer (short unsigned)
%ld integer (long signed)
%lu integer (long unsigned)
%f real (float)
%lf real (double)
%c character
%s string
Ref. Page 452 Chapter 21: Introduction to C Programming Languages Slide 33/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 452 Chapter 21: Introduction to C Programming Languages Slide 34/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 452 Chapter 21: Introduction to C Programming Languages Slide 35/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Preprocessor Directives
Preprocessor Directives
Preprocessor is a program that prepares a program for
the C compiler
Examples of some common preprocessor directives in C
are:
Preprocessor
Use
directive
Used to look for a file and place its
#include contents at the location where this
preprocessor directives is used
Ref. Page 453 Chapter 21: Introduction to C Programming Languages Slide 37/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
#ifdef WINDOWS
.
.
.
Code specific to windows operating system
.
.
.
#else
.
.
.
Code specific to Linux operating system
.
.
.
#endif
.
.
.
Code common to both operating systems
Ref. Page 453 Chapter 21: Introduction to C Programming Languages Slide 38/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Standard Preprocessor
Directives in C
Preprocessor Directive Meaning Category
# Null directive
#error message Prints message when processed
Simple
#line linenum filename Used to update code line number and filename
#pragma name Compiler specific settings
#include filename Includes content of another file File
#define macro/string Define a macro or string substitution
#undef macro Removes a macro definition Macro
Ref. Page 454 Chapter 21: Introduction to C Programming Languages Slide 39/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Pointers
C pointers allow programmers to directly access
memory addresses where variables are stored
Pointer variable is declared by adding a ‘’ symbol
before the variable name while declaring it.
If p is a pointer to a variable (e.g. int i, *p = i;)
Using p means address of the storage location of
the pointed variable
Using p means value stored in the storage location
of the pointed variable
Operator ‘&’ is used with a variable to mean variable’s
address, e.g. &i gives address of variable i
Ref. Page 455 Chapter 21: Introduction to C Programming Languages Slide 41/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
1000 62 i
Address of i = 1000
Value of i = 62
int i = 62;
int p;
int j;
p = &i; / p becomes 1000 /
j = p; / j becomes 62 /
j = 0; / j becomes zero /
j = (&i) / j becomes 62 /
Ref. Page 455 Chapter 21: Introduction to C Programming Languages Slide 42/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Array
An array is a collection of fixed number of elements in
which all elements are of the same data type
It is a homogeneous, linear, and contiguous memory
structure
Its elements can be referred to by using their subscript
or index position that is monotonic in nature
First element is always denoted by subscript value of 0
(zero), increasing monotonically up to one less than
declared size of array
Before using an array, its type and dimension must be
declared
An array can also be declared as multi-dimensional such
as Matrix2D[10][10]
Ref. Page 456 Chapter 21: Introduction to C Programming Languages Slide 43/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 456 Chapter 21: Introduction to C Programming Languages Slide 44/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
String
A string is a one-dimensional array of characters
terminated by a null character (‘\0)’
It is initialized at declaration as
char name[] = “PRADEEP”;
Its individual elements can be accessed in the same way
as we access array elements such as name[3] = ‘D’
Strings are used for text processing
C provides a rich set of string handling library functions
Ref. Page 457 Chapter 21: Introduction to C Programming Languages Slide 45/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 458 Chapter 21: Introduction to C Programming Languages Slide 46/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 457 Chapter 21: Introduction to C Programming Languages Slide 48/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Structure
It is a UDT containing a number of data types grouped
together
Its constituents data types may or may not be of different
types
It has continuous memory allocation and its minimum size
is the sum of sizes of its constituent data types
All elements (member variable) of a structure are publicly
accessible
Each member variable can be accessed using “.” (dot)
operator or pointer (EmpRecord.EmpID or EmpRecord
EmpID)
It can have a pointer member variable of its own type,
which is useful in crating linked list and similar data
structures
Ref. Page 457 Chapter 21: Introduction to C Programming Languages Slide 49/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Structure (Examples)
struct Employee struct Employee
{ {
int EmpID; int EmpID;
char EmpName[20]; char EmpName[20];
}; } EmpRecord;
Ref. Page 458 Chapter 21: Introduction to C Programming Languages Slide 50/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Union
It is a UDT referring to same memory location using several
data types
It is a mathematical union of all constituent data types
Each data member begins at the same memory location
Minimum size of a union variable is the size of its largest
constituent data types
Each member variable can be accessed using “,” (dot)
operator
Section of memory can be treated as a variable of one type
on one occasion, and of another type on another occasion
Ref. Page 459 Chapter 21: Introduction to C Programming Languages Slide 51/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Union Example
unionNum
{
int intNum;
unsigned
unsNum’
};
union Num Number;
Ref. Page 459 Chapter 21: Introduction to C Programming Languages Slide 52/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Difference Between Structure and
Union
Both group a number of data types together
Structure allocates different memory space contiguously
to different data types in the group
Union allocates the same memory space to different
data types in the group
Ref. Page 460 Chapter 21: Introduction to C Programming Languages Slide 53/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Control Structures
Control Structures
Control structures (branch statements) are decision
points that control the flow of program execution based
on:
Some condition test (conditional branch)
Without condition test (unconditional branch)
They ensure execution of other statement/block or
cause skipping of some statement/block
Ref. Page 460 Chapter 21: Introduction to C Programming Languages Slide 55/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 460 Chapter 21: Introduction to C Programming Languages Slide 56/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
if (i <= 0) if (i <= 0)
i++; i++;
else if (i >= 0)
j++;
if (i <= 0) else
i++; k++;
else
j++;
Ref. Page 461 Chapter 21: Introduction to C Programming Languages Slide 57/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 461 Chapter 21: Introduction to C Programming Languages Slide 58/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 462 Chapter 21: Introduction to C Programming Languages Slide 59/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 462 Chapter 21: Introduction to C Programming Languages Slide 60/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Loop Structures
Loop Structures
Loop statements are used to repeat the execution of
statement or blocks
Two types of loop structures are:
Pretest: Condition is tested before each iteration to
check if loop should occur
Posttest: Condition is tested after each iteration to
check if loop should continue (at least, a single
iteration occurs)
Ref. Page 462 Chapter 21: Introduction to C Programming Languages Slide 62/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 462 Chapter 21: Introduction to C Programming Languages Slide 63/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Examples of “for” and “while”
Constructs
Ref. Page 462 Chapter 21: Introduction to C Programming Languages Slide 64/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Posttest Loop Construct
“do…while”
It has a loop condition only that is tested after each
iteration to decide whether to continue with next
iteration or terminate the loop
Example of do…while is:
do {
printf(“i = %d”, i);
i++;
} while (i < 10) ;
Ref. Page 463 Chapter 21: Introduction to C Programming Languages Slide 65/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Functions
Functions
Functions (or subprograms) are building blocks of a
program
All functions must be declared and defined before use
Function declaration requires function name, argument
list, and return type
Function definition requires coding the body or logic of
function
Every C program must have a main function. It is the
entry point of the program
Ref. Page 463 Chapter 21: Introduction to C Programming Languages Slide 67/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Example of a Function
int myfunc ( int Val, int ModVal )
{
unsigned temp;
temp = Val % ModVal;
return temp;
}
Ref. Page 464 Chapter 21: Introduction to C Programming Languages Slide 68/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
# include <stdio.h>
void main()
{
int number, remainder;
clrscr(); / clears the console screen /
printf (“Enter an integer: ”);
scanf (“%d”, &number);
remainder = number % 2;
if (remainder == 0)
printf (“\n The given number is even”);
else
printf (“\n The given number is odd”);
getch();
}
Ref. Page 464 Chapter 21: Introduction to C Programming Languages Slide 69/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
# include <stdio.h>
# include <conio.h>
void main()
{
int day;
clrscr();
printf (“Enter an integer in the range 1 to 7”);
scanf (“%d”, &day);
Ref. Page 465 Chapter 21: Introduction to C Programming Languages Slide 70/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 465 Chapter 21: Introduction to C Programming Languages Slide 71/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
# include <stdio.h>
# include <conio.h>
# define PI 3.1415
void main()
{
float radius, area, circum;
clrscr();
printf (“Enter the radius of the circle: ”);
scanf (“%f”, &radius);
area = PI radius radius;
circum = 2 PI radius;
printf (“\n Area and circumference of the circle are %f
and %f respectively”, area, circum);
getch();
}
(Continued on next slide)
Ref. Page 466 Chapter 21: Introduction to C Programming Languages Slide 72/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
# include <stdio.h>
# include <conio.h>
# include <string.h>
void main()
{
char input_string[50]; / maximum 50 characters /
int len;
int i = 0, cnt = 0;
clrscr();
printf (“Enter a string of less than 50 characters: \n”);
gets (input_string);
len = strlen (input_string);
for (i = 0; i < len; i++)
{
switch (input_string[i])
Ref. Page 466 Chapter 21: Introduction to C Programming Languages Slide 73/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Ref. Page 466 Chapter 21: Introduction to C Programming Languages Slide 74/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
#include <stdio.h>
#define SIZE 10
Ref. Page 467 Chapter 21: Introduction to C Programming Languages Slide 75/76
Computer Fundamentals : Pradeep K. Sinha & Priti Sinha
Key Words/Phrases
Arithmetic operators Main function
Arrays Member element
Assignment operators Null statement
Bit-level manipulation Operator associativity
Bitwise operators Operator precedence
Branch statement Pointer
Character set Posttest loop
Comment statement Preprocessor directives
Compound statement Pretest loop
Conditional branch Primitive data types
Conditional compilation Reserved words
Constants Simple statement
Control structures Statement block
Format specifiers Strings
Formatted I/O Structure data type
Function Unconditional branch
Keywords Union data type
Library functions User-defined data types
Logical operators Variable name
Loop structures Variable type declaration
Macro expansion Variables