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

Computer Science Chapter 1 - Binary Systems and Hexadecimal

Uploaded by

bud Mur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Computer Science Chapter 1 - Binary Systems and Hexadecimal

Uploaded by

bud Mur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Chapter ONE

Binary System

11
Date: _________________________________

Lesson (1)

Introduction to Binary System

1- The Binary System is based on the number 2.


2- It has only two symbols to represent data: 0 and 1.
3- Computer system can have millions of switches and circuits which can
be set off or on.
4- Off means 0 , on means 1.
5- Thus, only the two ‘values’ 0 and 1 are used in binary system.
6- The binary system shows us how can data stores in the storage units in
the computer.
7- Example for binary data: 011001 and 0011011010 and so on.
8- Example for using denary numbers: 56 – 102 – 480 and so on.
9- The smallest unit which used to store data inside the computer is called
Bit.
10- The Bit stores either 0 or 1 but never both of them.
11-The smallest number in binary to start counting is 20.
12-Let us try to represent the denary number 375

Hundred Ten
Thousands Hundreds Tens Ones
Thousands Thousands
100000 10000 1000 100 10 1
105 104 103 102 101 100
3 7 5
0 0 0
(300) (70) (5)

Let us analyze the number 375

3 × 210 + 7 × 110 + 5 × 010 =

3 × 100 + 7 × 10 + 5 × 1 =

375 = 5 + 70 + 300

11
13-Take the same idea to create a binary system:
14-For the base 2: take the number: 01101
15-The smallest number in binary to start counting is 20.

… 27 26 25 24 23 22 21 20
… 128 64 32 16 8 4 2 1
0 1 1 0 1

This is the representation of the binary number: 01101

So this is how it store in the storage unit, located in many bytes as follows:

0 1 1 0 1

Now what is the value of this number?

This is our next Lesson

Home Work

1- Why the binary system called like that?

………………………………………………………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………….………………………………………………………………………………………

2- What are the symbols which used to display the data in the binary
system numbers?

………………………………………………………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………….………………………………………………………………………………………

3- Define the Bit?

………………………………………………………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………….………………………………………………………………………………………

4- What's the smallest value in the binary system numbers?

………………………………………………………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………….………………………………………………………………………………………

Date: _________________________________

Lesson (2)
11
Convert from Binary to Denary Numbers

 To display the value of the stored data inside your computer.


 Steps of converting from binary to denary:
1- Start from right side.
2- Start from the smallest value (20).
3- multiply 20 to the first digit value (0 or 1).
4- Add.
5- go to the next digit: multiply (21) by the digit value (0 or 1).
6- Add.
7- go to the next digit: multiply (22) by the digit value (0 or 1).
8- Add.
9- go to the next digit: multiply (23) by the digit value (0 or 1).
10-Add.
11-then repeat until the last digit value (0 or 1).

Example (1):

Convert (011010) to denary number?

Solution

1- start from right (0)


2- 20 × 0
3- + add .. then do the same for the next …

0 1 1 0 1 0
25 X 0 + 24 X 1 + 23 X 1 + 22 X 0 + 21 X 1 + 20 X 0
0 × 32 + 1 × 16 + 1×8 + 0×4 + 1×2 + 0×1
32 × 0 + 16 × 1 + 8 × 1 + 4 × 0 + 2 × 1 + 1 × 0 =

26 = 0 + 16 + 8+ 0 + 2 + 0 =

Example (2):

Convert (1010111) to denary number?

11
Solution

1- start from right (1)


2- 20 × 1
3- add + then do the same for the next …

1 0 1 0 1 1 1
2 X1 + 2 X0 + 2 X1 + 2 X0 + 2 X1 + 2 X1 + 2 X1
6 5 4 3 2 1 0

64 × 1 + 0 × 32 + 1 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 1 × 1

64 × 1 + 0 × 32 + 1 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 1 × 1 =

87 = 64 + 0 + 16 + 0 + 4 + 2 + 1 =

11
Class Work

Convert the following binary numbers into denary:


a) 00110011

0 0 1 1 0 0 1 1

……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………

b) 01111111

0 1 1 1 1 1 1 1

……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………

c) 10011001

1 0 0 1 1 0 0 1

……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………

11
Home Work

Convert the following binary numbers into denary:


a) 01110100

b) 11111111

c) 00001111

d) 10001111

e) 11110000

f) 01110000

g) 11101110

11
Date: _________________________________

Lesson (3)

Convert from Denary to Binary

 This time we will convert our data to be inside the computer


 We have two methods to convert from denary to binary:
1- Method 1: positioning
2- Method 2: division by 2
1) Method 1: positioning:

Steps:

1- Create a table with 3 rows


2- Start counting your numbers from 20 (in first row)
3- Count until a suitable number (9 digits for example)
4- Get the values for each location in binary
5- Get the range of your given number
6- take the smallest number to your given number
7- Write 1 in the digit table
8- Subtract your denary number from the selected location to get
remainder.
9- Repeat step 5
10-Until you represent all the number locations by 1
11-Now fill the rest with 0

11
Example (1):

Convert the denary number 7 into binary number?

Solution
1- Create the table with 3 rows

2- Start counting your numbers from 20 (in first row)


3- Count until a suitable number (5 digits for example)

… 24 23 22 21 20

4- Get the values for each digit location in binary in the second row

… 24 23 22 21 20
16 8 4 2 1

11
1- Take the range of your number 7, it's 4 – 8

… 24 23 22 21 20
16 8 4 2 1

2- Take the smallest number which is less than your given number 7 ..
it's 4
3- Write 1 in the digit table.

… 24 23 22 21 20
16 8 4 2 1
1

4- Get the remainder by:

Remainder = given number – digit number

Remainder = 7 – 4 = 3

11
1- Take the new range of your new number 3, it's 2 – 4

… 24 23 22 21 20
16 8 4 2 1
1

2- Take the smallest number which is less than your new number 3 .. it's
2
3- Write 1 in the digit table.

… 24 23 22 21 20
16 8 4 2 1
1 1

4- Get the remainder by:

Remainder = given number – digit number

Remainder = 3 – 2 = 1

11
1- Now take the new only number which is 1.
2- Write 1 in the digit table.

… 24 23 22 21 20
16 8 4 2 1
1 1 1

3- Get the remainder by:

Now the Remainder will be zero = 1 – 1

4- Now fill all the rest of digits by zero

… 24 23 22 21 20
16 8 4 2 1
0 0 1 1 1

Now : 7 is ( 00111) in binary

Or you can write (111)

(7)10 = (111)2

11
Example (2):

Convert 87 into binary number?

Solution
5- Create the table with 3 rows

6- Start counting your numbers from 20 (in first row)


7- Count until a suitable number (9 digits for example)

… 28 27 26 25 24 23 22 21 20

8- Get the values for each digit location in binary in the second row

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1

11
9- Take the range of your number 87, it's 64 – 128

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1

10- Take the smallest number which is less than your given number
87 .. it's 64
11- Write 1 in the digit table.

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1

12- Get the remainder by:

Remainder = given number – digit number

Remainder = 87 – 64 = 23

11
13- Now take the range of your new number 23, it's 16 – 32

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1

14-Take the smallest number which is less than your new number 23 ..
it's 16
15- Write 1 in the digit table.

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1
16- Get the remainder by:

Remainder = new number – digit number

Remainder = 23 – 16 = 7

11
1- Now take the range of your new number 7, it's 4 – 8

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1 1
1. Take the smallest number which is less than your new number 7 .. it's
4
2. Write 1 in the digit table.

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1 1
1- Get the remainder by:

Remainder = new number – digit number

Remainder = 7 – 4 = 3

11
2- Now take the range of your new number 3, it's 2 – 4

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1 1
3. Take the smallest number which is less than your new number 3 .. it's
2
4. Write 1 in the digit table.

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1 1 1
2- Get the remainder by:

Remainder = new number – digit number

Remainder = 3 – 2 = 1

3- Now take the range of your new number 1, it's only 1

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1 1 1
5. Write 1 in the digit table.

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
1 1 1 1 1

4- Now you represent all the number locations by 1


5- Now fill the rest with 0

… 28 27 26 25 24 23 22 21 20
512 128 64 32 16 8 4 2 1
11
1 0 1 0 1 1 1
6- Now your number is converted

( 87 )10 = ( 1010111 )2

11
Class work

Convert the following denary numbers into binary:

Write the binary number in the table

41
… 28 27 26 25 24 23 22 21 20
… 512 128 64 32 16 8 4 2 1

67

… 28 27 26 25 24 23 22 21 20
… 512 128 64 32 16 8 4 2 1

86
… 28 27 26 25 24 23 22 21 20
… 512 128 64 32 16 8 4 2 1

11
Home work

Convert the following denary numbers into binary:

100=

111=

127=

144=

189=

200=

255=

11
Date: _________________________________

Lesson (4)

Convert from Denary to Binary

Method 2: division by 2:

Steps:

1) Divide your number by 2


2) For each division write the remainder if it 0 or 1
3) Stop when the number divided by 2 is zero
4) The remainders are then read from BOTTOM to TOP to give the binary
value.

Example (1): -
Convert the number 11 into binary?

11 = (1011)2

11
Example (2): -
Convert the number 107 into binary?

11
Class work

Convert the following denary numbers into binary:

………………………………………………… 67 41
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
………………………………………………… ………………………………………………… …………………………………………………
……. ………………………………………………… …………………………………………………
…………………………………………… ………………………………………………… …………………………………………………
86 …

11
Home work

Convert the following denary numbers into binary:

……………………………………………… ……………………………………………… 100


……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
………………………………. ……………………………………………… ………………………………………………
……………………………………………… ……………………………………………… ………………………………………………
……………………………………………… ……………………………….………….. ………………………………………………
……….. ……………………………………………..
111
127

Convert the following denary numbers into binary: -


Denar
Binary
y
144
189
200
255

Date: _________________________________

Lesson (5)

11
Measurement of the size of computer Memories

A binary digit is commonly referred to as a BIT.


A bit can store only either 0 or 1.
8 bits are usually referred to as a BYTE
The byte is the smallest unit of memory in a computer.
Some computers use larger bytes but they are always multiples of 8 (e.g.
16-bit systems and 32-bit systems).
Memory size is measured in the following multiples:

Name of memory size Number of bits Equivalent denary value


1 byte 23 8 bits
1 kilobyte (1 KB) 210 1 024 bytes
1 megabyte (1 MB) 220 1 048 576 bytes
1 gigabyte (1 GB) 230 1 073 741 824 bytes
1 terabyte (1 TB) 240 1 099 511 627 776 bytes
1 petabyte (1 PB) 250 1 125 899 906 842 624 bytes

As example to understand the scale of these numbers in sizes,


Take as example: a typical data transfer rate using
the internet is 32 bits per second:
that means: 32 ÷ 8 = 4 which will be 4 MB per second
so a 40 MB file would take 10 seconds to transfer.

11
Home Work
1- What is the Bit?
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………….
2- Define the byte?
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………….
3- Can larger computer use many bytes? give an example.
……………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………….

4- Fill the table to give memory sizes:

1 byte ………………………. bits

1 kilobyte ………………………. Byte

1 megabyte ………………………. Kilobyte

1 megabyte ………………………. bytes

11

You might also like