**INTRODUCTION TO **

**COMPUTERS**

**LECTURE 10 : WEEK 10**

### TEXT AND REF. BOOKS

**Text Book:**

Peter Norton (2011), **Introduction to Computers**, 7 /e,
McGraw-Hill

**Reference Book:**

Gary B (2012), **Discovering Computers**, 1/e, South
Western

Deborah (2013), **Understanding Computers**, 14/e,
Cengage Learning

June P & Dan O (2014), **New Perspective on Computer**,
16/e

**MOBILE ALERT**

### Kindly

**Switch Off **

### your Mobile/Cell Phone

### OR

### Switch it to

**Silent Mode**

** Please**

Presented by: Asma Khan

**NUMBER SYSTEM**

### Learning Outcome

◻ 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

### What is a Number System ?

◻ 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

◻ 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

◻ 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 }

### How Data Represented in Computer

◻ **Computers Are Electronic Machines**

◻ 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

◻ Electricity can flow through switches

◻ If the switch is closed, the electricity flows

◻ If the switch is open, the electricity does not flow

◻ We need a way to represent the data in switches

◻ Computers do this representation using a *binary *
*coding system*

### How Data Represented in Computer

◻ **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

◻ **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

◻ **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)

### How Data Represented in Computer

◻ **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 minicomputers and microcomputers

### Binary Number System

◻ **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

### Binary Number System

◻ **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
The number of bits in a word is called the **word length. **

Different computers have different word lengths, with 8, 16, or 32 bits
Half a byte (4 bits) is called a N*ibble.*

*A kilobyte *(Kbyte or KB) is 1024 (2100) bytes

*A megabyte *(MByte or MB) is 1,048,575 (2200) bytes.

### Binary Number System

◻ **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

■ 110

2

Similarly, a decimal number that may be mistaken for binary is often written with a subscript 10, as in

■ 110

10

### Binary Number System

◻ 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 M*ost significant bit (MSB). *

◻ The bit at the extreme right of the number is the
*low-order *or *Least significant bit (LSB).*

### Binary Number System

◻ **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

◻ The place values in the binary number system are

### Binary Number System

◻ Expanded Notation

◻ Example :

◻ The binary number 1011 can be expressed as

### Converting Binary Numbers to Decimal

◻ 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

### Converting Decimal Integers to Binary

◻ 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

◻ 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

◻ Our binary number then consists of the digits in the remainders

◻ Thus

59

### Converting Decimal Fraction to Binary

◻ 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

◻ **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.546875_{10} = 0.1000 11_{2}

### Converting Decimal to Binary

◻ 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.546875

10 to binary.

◻ **Solution: **From the preceding examples,

◻ 59_{10} = 111011_{2}

◻ 0.546875

10 = 0.1000 112

◻ So, 59.546875 = 11 1011.1000 11

### Exercise

**32**

◻ Convert each binary number to decimal.

◻ Convert each decimal number to binary.

1001 0110 1111

0111.111 1100.001 1101 0010.1011

21 64 93