Lesson 8 – Binary Numbers Computer Programming 12
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
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’
Base 10 vs. Base !!!!!!!! !!!!!!!!!!
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 X X X X 10 0 OR 10,
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
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… can be written as: 1 X X X X X 2 0 OR OR 31
Note the pattern… = = = = = = = = = = = = = = = = 15
Place Values – 8 digit binary number Bit Location EighthSeventhSixthFifthFourthThirdSecondFirst Power Value
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
Units for Computer Memory PrefixMetric MeaningMemory Usage Number of Bytes Integer Equivalent Kilo-1,000Kilobyte (K) Mega-1,000,000Megabyte (MB) ,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
Sample Questions 1) What is the decimal equivalent of ? 2) Rewrite 199 as a binary number
1) is equal to 87 2) 199 is equal to