Lecture 02: Components of Computer CS 101: Introduction to Computing
Components of Computer
and
Data Representation
Shahab Haider
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Parts of a Computer
• There are two main parts of computers, hardware and software
– Hardware is all of the parts of the computer you can see ( ? ) and touch.
E.g.,
• Monitor, Keyboard, Processor, Memory, Circuits, Cables
etc
– Software refers to parts of the computer which do not have a material
form. E.g.,
• Data, Programs, Protocols etc
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer :
An External Look
• Casing [with components inside]
– Next slide
• Monitor
– Lets the user see how the computer is
responding to their command
• Keyboard
– For entering text commands
• Mouse
– Point-and-Click interface for
interacting with graphical
environment
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Internal Components (-1-)
• Inside the casing, we have a built-in power supply along with:
– Motherboard
• It is the central printed circuit board (PCB) where the
core components of your computer reside
– provides slots to host microprocessor, memory, driver controllers,
graphics card, modem, network card etc
– also provides electrical connections by which these hosted components
communicate
– Hard Disk Drive
• Permanent storage for data and programs. Also,
normally, your operating system is installed here.
– CD-ROM / DVD Player
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Internal Components (-2-)
Power Supply
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Motherboard:
Internal Components (-3-)
Connectors &
Ports
HDMI (High-Definition
Multimedia Interface) is a
compact audio/video interface
for transferring uncompressed
video data and
compressed/uncompressed
digital audio data from a HDMI-
compliant device to a
compatible computer monitor,
video projector etc.
RJ=Registered Jack
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Internal Components (-3-)
PCI Slot AGP Slot
[sound, network, [Graphics
modem] ]
IDE / ATA Connector
[hard disk, CD-ROM]
DRAM
Power Memory Slot for
Connector Slot Microprocesso
r
Motherboard: Sockets & Slots
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Internal Components (-4-)
Microprocessor
Graphics Card
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Internal Components (-5-)
RAM Network Card
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Internal Components (-6-)
Hard Disk Drive DVD RW
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Computer:
Peripherals
• A peripheral device is an equipment that might be
added to a computer system to enhance its
functionality
– Printer
– Digital camera
– Scanner
– Projector
– Joystick
– Graphics tablet
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Data Representation
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Data Representation
• Modern computers are digital devices
– A digital device works with discrete data, such as the digits
1 and 0
– An analog device works with continuous data
• Just as a standard light switch is a simpler technology
than a dimmer, so is digital when compared to analog
digital analog
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Number System
• We use decimal number system [base 10] when representing
numeric values in our daily life
– E.g., consider the number 123
• 123 = 100 + 20 + 3 = 1*102 + 2 * 101 + 3*100
• Most modern computer systems do not use the decimal
system to represent numeric values.
– Instead, they use a binary numbering system [base 2]
• Consisting of only two digits: 1 and 0
• Uses powers of 2 rather than 10
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
1
5
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Binary to Decimal
What is the decimal equivalent of the binary
number 1101110?
1 x 26 = 1 x 64 = 64
+ 1 x 25 = 1 x 32 = 32
+ 0 x 24 = 0 x 16 =0
+ 1 x 23 = 1x8 =8
+ 1 x 22 = 1x4 =4
+ 1 x 21 = 1x2 =2
+ 0 x 2º = 0x1 =0
= 110 in base 10
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 13
1
6
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Binary to Octal
• Mark groups of three (from right)
• Convert each group
10101011 10 101 011
2 5 3
10101011 is 253 in base 8
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 17
1
7
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Binary to Hexadecimal
• Mark groups of four (from right)
• Convert each group
10101011 1010 1011
A B
10101011 is AB in base 16
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 18
1
8
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Decimal to Other Bases
Algorithm for converting number in base 10 to
other bases
While (the quotient is not zero)
Divide the decimal number by the new base
Make the remainder the next digit to the left in the
answer
Replace the original decimal number with the quotient
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 19
Lecture 02: Components of Computer CS 101: Introduction to Computing
Conversions
• Conversion from binary to decimal:
– (1011)2 = 1*23 + 0*22 + 1*21 + 1*20 = (11)10
• Conversion from decimal to binary:
2 125
2 62 – 1 2 16
2 31 – 0 2 8 – 0
2 15 – 1 (125)10 2 4 – 0
(16)10
2 7 – 1 = (1111101)2 2 2 – 0 = (10000)2
2 3 – 1 2 1 – 0
2 1 – 1
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Decimal to Octal
Converting Decimal to Hexadecimal
• How ???
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
2
1
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Octal to Decimal
What is the decimal equivalent of the octal
number 642?
6 x 82 = 6 x 64 = 384
+ 4 x 81 = 4 x 8 = 32
+ 2 x 8º = 2 x 1 = 2
= 418 in base 10
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 11
2
2
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Hexadecimal to Decimal
What is the decimal equivalent of the
hexadecimal number DEF?
D x 162 = 13 x 256 = 3328
+ E x 161 = 14 x 16 = 224
+ F x 16º = 15 x 1 = 15
= 3567 in base 10
Remember, the digit symbols in base 16 are
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
2
3
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Decimal to Octal
What is 1988 (base 10) in base 8?
Try it!
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
2
4
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Decimal to Octal
248 31 3 0
8 1988 8 248 8 31 8 3
16 24 24 0
38 08 7 3
32 8
68 0
64
4
Answer is : 3 7 0 4
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
2
5
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Decimal to Hexadecimal
What is 3567 (base 10) in base 16?
Try it!
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 20
2
6
Lecture 02: Components of Computer CS 101: Introduction to Computing
Converting Decimal to Hexadecimal
222 13 0
16 3567 16 222 16 13
32 16 0
36 62 13
32 48
47 14
32
15
DEF
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi 21
2
7
Lecture 02: Components of Computer CS 101: Introduction to Computing
Exercise
• Convert the following numbers from Octal to Decimal
200 , 657 , 757
• Convert the following from Hexadecimal to Decimal
201 , 171 , 39F
• Convert the following from Binary to Decimal
101000001 , 101011001 , 100111001
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
2
8
Lecture 02: Components of Computer CS 101: Introduction to Computing
Exercise …
• Convert the following from Binary to Octal
1100111101 , 100111011, 110010100
• Convert the following from Binary to Hexadecimal
110010011 , 1110010001 , 110110111
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
2
9
Lecture 02: Components of Computer CS 101: Introduction to Computing
Exercise…
• Convert the following from Decimal to Octal
310 , 1221 , 1364
• Convert the following from Decimal to Hexa Decimal
513 , 369 , 927
• Convert the following from Decimal to Binary
321 , 345 , 313
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Representing
Non-Numeric Data
• Some decimal values & their binary equivalents
• In addition to numeric data, computers also
manipulate character data
• numbers, symbols, numerals that are not used
in arithmetic operations
– To represent them, codes have been developed
that specify binary equivalent for each character
• ASCII – 7 bits [Example table given ]
• Unicode – 16 bits Char Decimal Binary
A 65 100 0001
• Sounds and pictures must be transformed
B 66 100 0010
into a format the computer can understand
– A computer must digitize colors, notes, and 0 48 011 0000
instrument sounds into 1s and 0s 1 49 011 0001
$ 36 010 0100
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Quantifying Bits and Bytes
• A bit is one binary digit (b):
– can have value either 0 or 1
• A byte is 8 bits (B)
– 0010 0100
• Kilo- means a 1000; Mega- means million; Giga -means billion
– Kilobit (Kb) is 1,024 bits
– Kilobyte (KB) is 1,024 bytes
– Megabyte (MB) is 1,048,576 bytes
– Gigabyte (GB) is 1,073,741,824 bytes
• Bits take the form of electrical pulses that can travel over
circuits
– Almost the same way as electricity flows over a wire when you turn on
a light switch
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 02: Components of Computer CS 101: Introduction to Computing
Link to the course material
• https://drive.google.com/open?
id=1r9MYaH8XYvWjVPpLjHe0zo_76nImf3zZ
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi