Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 8 – Binary Numbers Computer Programming 12.

Similar presentations


Presentation on theme: "Lesson 8 – Binary Numbers Computer Programming 12."— Presentation transcript:

1 Lesson 8 – Binary Numbers Computer Programming 12

2 The Binary System Computers store and retrieve many types of information (text files, graphics files, sound files, games, etc.) They need to use a code to represent the information being processed We use various codes all the time Letters of the alphabet to represent words/pronunciations 10 digits (0-9) to represent quantities

3 Computers know only 2 basic code values 0 and 1 off/on negative/positive Ex. Floppy disks covered with thin layer of ferromagnetic material cells are polarized as ‘positive’ or ‘negative’ sequence of cells creates a code that the computer interprets We call this code binary code Prefix ‘bi’ means ‘two’

4 Base 10 vs. Base 2 1 2 3 4 5 6 7 8 9 !!!!!!!! 1011011 1100101 1111001 !!!!!!!!!!

5 Decimal (or base 10) system Most commonly used number system Uses numbers 0 – 9 Each place value represents a power of 10 11,111 can be written as: 1 X 10 4 + 1 X 10 3 + 1 X 10 2 + 1 X 10 1 + 1 X 10 0 OR 10,000 + 1000 + 100 + 10 + 1

6 Binary (or base 2) system Only uses 0 and 1 When writing binary numbers we must include a subscript 2 at the end of the number (if no subscript it is assumed that we are working in base 10) Ex. 11111 2

7 11111 2 is not the same as 11,111 Each place value represents a power of 2 (or is twice as great as the place to its right) 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024… 11111 2 can be written as: 1 X 2 4 + 1 X 2 3 + 1 X 2 2 + 1 X 2 1 + 1 X 2 0 OR 16 + 8 + 4 + 2 + 1 OR 31

8 Note the pattern… 0000 2 = 01000 2 = 8 0001 2 = 11001 2 = 9 0010 2 = 21010 2 = 10 0011 2 = 31011 2 = 11 0100 2 = 41100 2 = 12 0101 2 = 51101 2 = 13 0110 2 = 61110 2 = 14 0111 2 = 71111 2 = 15

9 Place Values – 8 digit binary number Bit Location EighthSeventhSixthFifthFourthThirdSecondFirst Power 2727 2626 2525 2424 23232 2121 2020 Value 1286432168421

10 Bits & Bytes We often refer to numbers as digits A binary digit can be referred to as bit Bits are usually arranged in groups of eight A group of eight bits is called a byte Larger numbers are made up of two or more bytes combined Ex. 2 bytes required to make 512

11 Units for Computer Memory PrefixMetric MeaningMemory Usage Number of Bytes Integer Equivalent Kilo-1,000Kilobyte (K)2 10 1024 Mega-1,000,000Megabyte (MB) 2 20 1,048,576 Giga-1,000,000,000Gigabyte (GB)2 30 1,073,741,824 Tera-1,000,000,000,000Terabyte (TB)2 40 1,099,511,627,776

12 Sample Questions 1) What is the decimal equivalent of 01010111 2 ? 2) Rewrite 199 as a binary number

13 1) 01010111 2 is equal to 87 2) 199 is equal to 11000111 2


Download ppt "Lesson 8 – Binary Numbers Computer Programming 12."

Similar presentations


Ads by Google