0% found this document useful (0 votes)
10 views

Lecture-5

The lecture covers the fundamentals of number systems, focusing on the decimal and binary systems, and how data is represented in computers using bits and bytes. It explains the conversion processes between binary and decimal numbers, including both integers and fractions. Students will gain a clear understanding of these concepts and their applications in computing.

Uploaded by

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

Lecture-5

The lecture covers the fundamentals of number systems, focusing on the decimal and binary systems, and how data is represented in computers using bits and bytes. It explains the conversion processes between binary and decimal numbers, including both integers and fractions. Students will gain a clear understanding of these concepts and their applications in computing.

Uploaded by

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

LECTURE 5 : WEEK 5

CSC-110
MOBILE ALERT
2

Kindly Switch Off your Mobile/Cell Phone

OR

Switch it to Silent Mode Please


Learning Objectives
3

 We will be looking,
 What is a Number System
 Decimal & Binary Number System
 How Data Represented in Computer
 Binary & Switches, Bits & Bytes
 Binary Number System Explained
 Writing Binary Numbers, Expanded Notation
 Conversions
 Binary to Decimal
 Decimal to Binary
 Exercise
How Data Represented in Computer
4
How Data Represented in Computer
5

 Computers Are Electronic Devices


 The computer uses electricity (CPU, RAM, MB etc)
not mechanical parts
 Electricity moves very fast through wires
 Electrical parts fail less frequently than mechanical
parts
 Internal data processing and storage is electronic
How Data Represented in Computer
6

 Binary and Switches. Binary is a mathematical


number system, a way of counting
 The computer has switches to represent data
 Switches have only two states: ON and OFF
 Binary has two digits to do the counting: two states
of a switch (0 = OFF, 1 = ON).
How Data Represented in Computer
7

 Bits and Bytes One binary


digit (0 or 1) is referred to as
a bit, which is short for binary
digit. Thus, one bit can be
implemented by one switch

Implementing a Byte
How Data Represented in Computer
8

 Representing Data In Bytes


 A single byte can represent many different kinds of data.
What data it actually represents depends on how the
computer uses the byte.
 For instance, the byte: 01000011
 Can represent the integer 67 (to ALU)
 The character ‘C’ (to Monitor)
 The 67th decibel level for a part of a sound (to Speaker)
 The 67th level of darkness for a dot in a picture (to Graphics)
 An instruction to the computer like "move to memory“ (to CPU)
How Data Represented in Computer
9

 Characters. The computer also uses a single byte to


represent a single character
 American Standard Code for Information Interchange
ASCII-8, also called extended ASCII
 Uses 8 bits per character and can represent 256
different characters
 ASCII representation has been adopted as a
standard particularly in minicomputers and
microcomputers
ASCII-8 Code Example
10
What is a Number System ?
11

 A number system is a way to represent numbers


 Any system using a range of digits organized in a
series of columns or "places" that represents a
specific quantity.
 The most common numbering systems are decimal,
binary, octal, and hexadecimal.
Decimal Number System : Base 10
12

 The decimal numeral system (also called base 10 or


occasionally denary) has Ten as its base. It is
the numerical base most widely used by modern
civilizations.
 The decimal number system consists of ten single-
digit numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

 (28)10 = (011100)2 48-D = 110000-B


Binary Number System : Base 2
13

 Also called as base-2 number system. This system uses


only 0s and 1s to represent letters, numbers and other
characters and it is used by almost all modern
computers.
 Numbering system that represents numeric values using
two unique digits (0 and 1).
 (1100)2 = (12)10 (0101)2 = (5)10
 (1010)2 = (10)10 (1111)2 = (15)10
Binary Number System
14

 Binary Numbers
 A binary number is a sequence of the digits 0 and 1, such as
 1101001
 The number shown has no fractional part and so is called a
binary integer.
 A binary number having a fractional part contains a binary
point (also called a radix point), as in the number
 1001.01
Binary Number System
15

 Base or Radix
 The base of a number system (also called the radix) is equal to the number of
digits used in the system.

 Bits, Bytes, and Words


 Each of the digits is called a bit, from binary digit. A byte is a group of 8 bits
 A word is the largest string of bits that a computer can handle in one operation
 Different computers have different word lengths, with 8, 16, 32 or 64 bits
 Half a byte (4 bits) is called a Nibble.
 A kilobyte (Kbyte or KB) is 1024 (210 ) bytes
0

 A megabyte (MByte or MB) is 1,048,575 (220 ) bytes.


0
Binary Number System
16

 Writing Binary Numbers


 A binary number is sometimes written with a subscript 2
when there is a chance that the binary number would
otherwise be mistaken for a decimal number.
 Example: The binary number 110 could easily be mistaken
for the decimal number 110, unless we write it
 1102
 Similarly, a decimal number that may be mistaken for
binary is often written with a subscript 10, as in
 11010
Binary Number System
17

 The number 100100010100.001001 is easier to


read when written as
 1001 0001 0100.0010 01
 The leftmost bit in a binary number is called the
high-order or Most significant bit (MSB).
 The bit at the extreme right of the number is the
low-order or Least significant bit (LSB).
Binary Number System
18

 Place Value
 A positional number system is one in which the
position of a digit determines its value,
 And each position in a number has a place value
equal to the base of the number system raised to
the position number.
Converting Binary Numbers to Decimal
19

 The place values in the binary number system are


Binary Number System
20

 Expanded Notation
 Example :
 The binary number 1011 can be
expressed as
Converting Binary Numbers to Decimal
21

 To convert a binary number to decimal, simply write


the binary number in expanded notation (omitting
those where the bit is 0), and add the resulting
values.
 Example : Convert the binary number
 1001.011to decimal.
Converting Binary Numbers to Decimal
22
Converting Decimal Integers to Binary
23

 To convert a decimal integer to binary


 First divide it by 2, obtaining a Quotient and a
Remainder.
 Write down the remainder and divide the quotient
by 2, getting a new quotient and remainder
 Repeat this process until the quotient is zero.
Converting Decimal Integers to Binary
24

 Example : Convert the decimal integer 59 to binary.


 Solution:We divide 59 by 2, getting a quotient of 29
and a remainder of 1. Then
 Dividing 29 by 2 gives a quotient of 14 and a
remainder of 1.
 These calculations, can be arranged in a table, as
follows:
Converting Decimal Integers to Binary
25

 Our binary number then


consists of the digits in the
remainders
 Thus
 5910 = 1110112
Converting Decimal Fraction to Binary
26

 To convert a decimal fraction to binary, we first


multiply it by 2, remove the integer part of the
product, and multiply by 2 again.
 We then repeat the procedure
 Example : Convert the decimal fraction 0.546875
to binary.
Converting Decimal Fraction to Binary
27

 Solution: We multiply the given


number by 2, getting 1.09375.
 We remove the integer part, 1,
leaving 0.09375, which we again
multiply by 2, getting 0.1875.
 We repeat the computation until we
get a product that has a fractional
part of zero (Not possible always), as
shown on R.H.S, so

 0.54687510 = 0.1000 112


Converting Decimal to Binary
28

 To convert a decimal number having both an integer part


and a fractional part to binary, convert each part
separately, and then combine
 Example : Convert the number 59.54687510 to binary.
 Solution: From the preceding examples,
 5910 = 1110112
 0.54687510 = 0.1000 112
 So, 59.546875 = 11 1011.1000 11
Class Exercise
29

 Convert each binary number to decimal.


1001 0110 1111
0111.111 1100.001 1101 0010.1011

21 64 93
274.25 128.12 256.0005

 Convert each decimal number to binary.


Home Exercise
30

 Convert each binary number to decimal.


1100 0110.11 1111 1111 11.001 1100 00.110011

 Convert each decimal number to binary.


333.125 928.78 12351.999
Home Exercise
31

 Convert each binary number to decimal.


1100 0110.11= 1111 1111 11.001= 1100 00.110011=
198.7510 1023.12510 48.79687510

 Convert each decimal number to binary.


333.125 = 928.78 = 12351.999 =
101001101.0012 001110100000.11000112 0011000000111111.11111112
Learning Outcome
32

 After this lecture students must have clear understanding of the


following,
 What is a Number System
 Decimal & Binary Number System
 How Data Represented in Computer
 Binary & Switches, Bits & Bytes
 Binary Number System Explained
 Writing Binary Numbers, Expanded Notation
 Conversions
 Binary to Decimal
 Decimal to Binary

You might also like