Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2

Similar presentations


Presentation on theme: "Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2"— Presentation transcript:

1 Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2
CMPT 120 Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2

2 Review – “Computers use 0 and 1 to represent everything“
Computer memory: integer floating point number colour character CPU instruction sound

3 Review - Decimal numeral system
Binary numeral system Decimal -> (Base 10) Ten symbols (digits): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary -> (Base 2) Two symbols (bits): 0, 1 (bits -> binary digits)

4 Review - Decimal numeral system
Binary numeral system Positional system When counting: Positional system When counting: 0 0 1 0 0 9 0 1 0 0 1 1 1 9 9 2 0 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 102 101 22 21 20 100

5 How computers represent integers
Which integer is this: bit byte A bit either contains a 0 or 1 A byte is 8 bits

6 How computers represent integers
Which integer is this :

7 You try it! Which integer is this?

8 Decimal numeral system
So far … Decimal numeral system Binary numeral system

9 Decimal numeral system
Let’s try … Decimal numeral system Binary numeral system

10 What is 106 as a binary number?

11 Can you convert these? 9 _ _ _ _ _ _ _ _ 10 _ _ _ _ _ _ _ _ 11 _ _ _ _ _ _ _ _ 12 _ _ _ _ _ _ _ _ 13 _ _ _ _ _ _ _ _ 14 _ _ _ _ _ _ _ _ 15 _ _ _ _ _ _ _ _ 64 _ _ _ _ _ _ _ _ 255 _ _ _ _ _ _ _ _ 256 _ _ _ _ _ _ _ _

12 How can we read/write long binary numbers easily?

13 Hexadecimal Numbers

14 ASCII and Unicode

15 How computers represent characters
We have already seen how computers deal with letters and characters … remember ASCII? Source: See ASCII Table:

16 Unicode UTF - 8 ASCII uses 8 bits (1 byte) to encode characters using 0’s and 1’s How many different characters can we represent in ASCII with 8 bits (1 byte)? To type in other languages than English, we may need a lot more than that Unicode uses up to 4 bytes to handle more characters Let’s have a look:

17 Other Character Encodings

18 I have a great idea! Let’s write a binary-decimal converter in Python
How would we go about solving this problem?

19 Next Lecture Practice speaking binary and hexadecimal and a lot more!
Bring your laptop! 


Download ppt "Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2"

Similar presentations


Ads by Google