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

03 Programming Foundations - Binary System

Programmation

Uploaded by

Hammami Salah
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)
48 views

03 Programming Foundations - Binary System

Programmation

Uploaded by

Hammami Salah
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/ 49

ProgrammingAdvices.

com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

How to represent
data in computer?

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
hundreds of millions or
even billions of transistors
CPU

How Computer Works? Transistor

• Computer is an electronic device. Transistor is a binary switch

• It deals with electricity On/Off


prevents or allows electricity.

• It only understands 0’s (Off) and 1’s (On).


• Everything you see, hear and read on the screen reaches you
as the result of “on” or “off” billions of times.
• Computer uses Binary System to represent numbers,
letters, commands, images and sounds.

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

Binary System

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Decimal vs Binary?

9 8 7 6 5 4 3 2 1 0

Decimal System

1 0

Binary System

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

What is Bit?

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
What is “Bit”?
Remember! .. Computer is an electronic device…it deals with electricity only.

Bit A bit is a binary digit,


0 the smallest increment
of data on a computer

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

What is Byte?

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
What is Byte?

MSB
65 Bit

LSB

0 1 0 0 0 0 0 1

27 26 25 24 23 22 21 20 Base 2

128 64 32 16 8 4 2 1 Doubling

8 Bits = 1 Byte

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

Decimal to Binary.

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…

0 0 0 0 0 0 1 1

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

00000011
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…

0 0 0 0 1 0 0 0

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

00001000
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…

0 0 0 0 0 1 0 1

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

00000101
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…

0 0 0 1 0 1 0 0

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

00010100
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…
Only one way
to represent Data

0 0 0 1 0 1 0 1

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

00010101
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

Binary to Decimal.

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in decimal…

0 0 0 0 0 0 1 1

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

00000011
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in decimal…

0 0 0 0 1 0 0 0

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

00001000
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in decimal…

0 0 0 0 0 1 0 1

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

00000101
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in decimal…

0 0 0 1 0 1 0 0

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

00010100
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…

0 0 0 1 0 1 0 1

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

00010101
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

Largest number in
a byte?

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
What is the largest number in byte?

1 1 1 1 1 1 1 1

27 26 25 24 23 22 21 20
128 + + + + + + +
64 32 16 8 4 2 1
=
11111111
ProgrammingAdvices.com Mohammed Abu-Hadhoud
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
What if I have larger number such as 257?!!

1 1 1 1 1 1 1 1

27 26 25 24 23 22 21 20
128 + + + + + + +
64 32 16 8 4 2 1
=
8 Bits = 1 Byte

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Represent this in binary…

0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1

215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20


32,768 16,384 8,192 4,096 2,048 1,024 512 256 128 64 32 16 8 4 2 1

Second Byte 100000001 First Byte

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
What is the largest number in 2 bytes?

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20


32,768 16,384 8,192 4,096 2,048 1,024 512 256 128 64 32 16 8 4 2 1

Second Byte
11111111 11111111 First Byte

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
But!
How to represent letters?

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

ASCII & Unicode

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
ASCII

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
How to represent letters?
65 Or A??

0 1 0 0 0 0 0 1

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

8 Bits = 1 Byte

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
This is my name in binary:

Mohammed Abu-Hadhoud
01001101 01101111 01101000 01100001 01101101 01101101
01100101 01100100 00100000 01000001 01100010 01110101
00101101 01001000 01100001 01100100 01101000 01101111
01110101 01100100

Machine Language

Mohammed Abu-Hadhoud
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
What does this mean?
01001001 00100000 01001100 01101111 01110110 01100101
00100000 01011001 01101111 01110101 00100001

I Love You!

Mohammed Abu-Hadhoud
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
But!

How to represent Arabic letters?

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Computer Foundations

Unicode

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
ASCII

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Problem:
‫محمد‬

□□□□ ‫؟؟؟؟‬

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
UNICODE
Unicode is an International
character encoding standard

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
ASCII UNICODE
VS

American Standard Code for Information Interchange Universal Coding System

Supports specific characters (less space) Large number of characters (large space)

It has 3 standards:
Has 2 standards: Diffrences UTF 8 – 256 characters
7-bit ASCII – 128 characters
UTF 16 – 65,536 characters
8-bit ASCII – 256 characters
UTF 32 – 4,294,967,296 characters

Only one language Any combination of languages

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1

64 Bits = 8 Bytes 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1

ProgrammingAdvices.com Mohammed Abu-Hadhoud


Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
128 64 32 16 8 4 2 1

32,768 16,384 8,192 4,096 2,048 1,024 512 256

8,388,608 4,194,304 2,097,152 1,048,576 524,288 262,144 131,072 65,536

2,147,483,648 1,073,741,824 536,870,912 268,435,456 134,217,728 67,108,864 33,554,432 16,777,216

5.49756E+11 2.74878E+11 1.37439E+11 68,719,476,736 34,359,738,368 17,179,869,184 8,589,934,592 4,294,967,296

??

Mohammed Abu-Hadhoud
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
9,223,372,036,854,780,000

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
128 64 32 16 8 4 2 1

32,768 16,384 8,192 4,096 2,048 1,024 512 256

8,388,608 4,194,304 2,097,152 1,048,576 524,288 262,144 131,072 65,536

2,147,483,648 1,073,741,824 536,870,912 268,435,456 134,217,728 67,108,864 33,554,432 16,777,216

5.49756E+11 2.74878E+11 1.37439E+11 68,719,476,736 34,359,738,368 17,179,869,184 8,589,934,592 4,294,967,296

??

Mohammed Abu-Hadhoud
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
18,446,744,073,709,600,000

www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
1- Represent those numbers in binary…
• 512
• 44
• 129
• 717
• 999

Mohammed Abu-Hadhoud
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
2- Write your name in binary and put it
in the comments.

Thank you 
01010100 01101000 01100001 01101110 01101011 00100000
01111001 01101111 01110101 00100000 00111010 00101001
00001010

Mohammed Abu-Hadhoud
www.ProgrammingAdvices.com
ProgrammingAdvices.com
Copyright© 2022 MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience

You might also like