0% found this document useful (0 votes)
28 views18 pages

Introduction To Computing

The document discusses how computers represent data using binary numbers. It explains that computers use transistors that can be either on or off, represented by 1s and 0s. This allows them to use the binary number system, where numbers are represented by combinations of 1s and 0s. It also discusses how decimal numbers can be converted to binary, and vice versa, using place values. Finally, it briefly mentions other number systems like hexadecimal and octal, as well as text encoding standards like ASCII.

Uploaded by

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

Introduction To Computing

The document discusses how computers represent data using binary numbers. It explains that computers use transistors that can be either on or off, represented by 1s and 0s. This allows them to use the binary number system, where numbers are represented by combinations of 1s and 0s. It also discusses how decimal numbers can be converted to binary, and vice versa, using place values. Finally, it briefly mentions other number systems like hexadecimal and octal, as well as text encoding standards like ASCII.

Uploaded by

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

Introduction to Computing

Lecture 3

Instructor: Bushra Naz


How Computers Represent Data
 Number systems
 A manner of counting
 Several different number systems exist

 Decimal number system


 Used by humans to count
 Contains ten distinct digits
 Origin: Probably because human beings normally have 10
fingers
 Digits combine to make larger numbers

5A-2
How Computers Represent Data
 Clocks have 24 hours
 Each hour  60 minutes

 Each minute  60 seconds

 When we time something, we count in seconds,


minutes and hours

5A-3
How Computers Represent Data
 Computers use electronic switches called transistors
 A switch can either be ON or OFF

=1 =0

 Only two numeric values can be represented by one


switch, 0 and 1

5A-4
How Computers Represent Data
 Binary number system
 Used by computers to count
 Two distinct digits, 0 and 1
Do you know
 0 and 1 combine to make numbers
the bit pattern
representing
H?

The answer
is 01001000
How Computers Represent Data
 Bits and bytes
 Binary numbers are made of bits

 Bit (Binary Digit) represents a switch

 A byte is 8 bits

 Byte represents one character

5A-6
How Computers Represent Data
 Any number from the decimal number system can also be
written using binary number system

 Decimal to Binary conversion is required

 Each digit in the decimal number system has a place value

 Ones (100), Tens(101), Hundreds(102), Thousands(103)


How Computers Represent Data
The place value is expressed in powers of 10
 10 to the power of digit position
 10 is called the base of the Decimal number system

 In binary number system the base is 2


 Place value is 2 to the power of digit position
Conversion from Decimal to Binary
Lets count from 0 in both decimal and binary simultaneously and make
sure every binary number is used
• 010  02 • 810  10002 • 1610  100002
• 110  12 • 910  10012 • 1710  100012
• 210  102 • 1010  10102 • 1810  100102
And so on..
• 310  112 • 1110  10112 • 1910  100112
• 410  1002 • 1210  11002 • 2010  101002
• 510  1012 • 1310  11012 • 2110  101012
• 610  1102 • 1410  11102 • 2210  101102
• 710  1112 • 1510  11112 • 2310  101112
Conversion from Binary to Decimal
 Did You notice some pattern?

 All odd numbers in decimal end with 1 in binary

 All even numbers is decimal end with 0 in binary

 The bits pattern repeats itself after the addition of every 1 on


the Left Hand Side

 Same things happens in decimal


 E.g. digits 0-99 repeat after addition of digits 1-9 on the L.H.S
Conversion from Binary to Decimal
 How would you represent 24510 in binary??

 Some conversion procedure or formula is required so that


we can convert any number from decimal to binary without
having to count from 0 till that number
Conversion from Binary to Decimal
 First Consider Conversion to binary to decimal
 Binary number system has a base ‘2’
 For conversion calculate place value of each digit
position and multiply by the corresponding digit value
(0 or 1)
(1 1 0 0 1)2

24 23 22 21 20
=1x 24 + 1x 23 + 0x 22 + 0x 21 + 1x 20
= 1x16 + 1x8+ 0x4+ 0x2 + 1x1
= 16 + 8 + 0 + 0 + 1 = 2510
Other Number Systems
 Hexa-Decimal Number System
 16 possible values

 0,1,2,…9,A,B,..F

 Base 16

 Octal Number System


 8 possible values

 0,1,2,..7

 Base 8
Conversion between Binary and Hexadecimal
Binary to Hexadecimal Hexadecimal to Binary
 Make groups of 4 bits Write down binary equivalent
 Start from right code of every hexadecimal digit.
 Add zeroes to right if required.

 Find equivalent hexadecimal


DEC216 = 1101 1110 1100 00102
code of every group
10010110110010112 = 96CB16
1001 0110 1100 10112
9 6 C B
Conversion between Hexadecimal and Decimal
Hexadecimal to Decimal Decimal to Hexadecimal
 Multiply each hexadecimal  Divide decimal number with 16
number with 16 to the power and note down its remainder.
of its position 99910 = 3E716

Quotient Remainder
3AC16 = 3x162 + 10x161 + 12x160
999/16 62 7
= 768 + 160 + 12
62/16 3 14
= 94010
3/16 0 3
Boolean Algebra
Truth Table for AND operator Truth Table for OR operator
A B Y = A.B A B Y = A+B
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1

Truth Table for NOT operator


A Y = A’
0 1
1 0
How Computers Represent Data
 Text codes
 Converts letters into binary
 Standard codes necessary for data transfer
 ASCII – 8 bits
 Values 0-127
 American English symbols
 Extended ASCII – 16 bits
 Values 128-256
 Graphics and other symbols
 Unicode – 32 bits
 All languages on the planet

5A-17

You might also like