Chapter 3

Chapter Sections
Section 3.1: Hardware (problems)
Section 3.2: Binary Code For Non-Negative Integers (problems)
Section 3.3: Hexadecimal Numbers (problems)
Section 3.4: Binary Code For Strings (problems)
Section 3.5: Representing Colors (problems)

Section 3.1: Hardware

Introduction

Computers are composed of many working parts. Some parts communicate directly to the user such as the screen and speakers. Other parts allow the user to communicate to the computer, such as the keyboard and mouse. Internally, a computer has many parts that we usually do not see, such as the central processor and main memory. These parts play important roles in the functioning of a computer.

Parts of a Computer

PartRoleDescription
ScreenOutputDisplays visual images, including text, pictures, and videos.
Speakers/HeadphonesOutputProduces sound, including music, voice, and sound effects.
KeyboardInputUsed for entering text.
MouseInputUsed for moving a cursor across a screen.
Central Processing Unit (CPU)InternalCarries out most of the calculations necessary for a computer to function.
CPU CoreInternalA component of a CPU that carries out single calculations - one at a time, billions of times a second.
Graphics Processing Unit (GPU)InternalCarries out most of the calculations necessary to display images. The GPU is designed to carry out many calculations simultaneously.
Random Access Memory (RAM)InternalOften just called "Main Memory", temporarily stores data used by computer programs while the program is running. When the computer is turned off, this data is lost if it is not saved to a the Hard Drive.
CacheInternalTemporary memory storage similar to RAM, but smaller and more closely integrated with the CPU. Much faster than RAM, but the Cache cannot store as much data as RAM. Data is lost when the power is shut off.

PartRoleDescription
MotherboardInternalA major part of the computer containing the CPU, Cache, RAM. The motherboard of a computer is connected to almost every part of a computer.
Video CardInternalAnother major part of the computer containing the GPU and memory used for graphics.
System BUSInternalThe system bus is responsible for transporting data between the different parts of a computer and is composed of multiple types of buses.
Hard DriveInternalBuilt into the computer. Used for long term storage of data. When the power is shut off to the computer, this data is not lost.
Portable Memory DriveInternal and ExternalAlthough not a permanent part of the computer, a portable memory drive, such as a usb drive, is an important tool for transporting data between computers. Data is not lost when the power is turned off.

Storing Data

As we have seen, computers can store information (data) in the form of numbers and strings (text). Computers can also store images and sound. All of this data is represented in a computer as binary code. Much of the rest of this chapter is about how these types of data are represented as binary code. For now, lets consider what binary code is and how it is physically stored in a computer.

Binary code is traditionally represented as a sequence of 1's and 0's. In reality, it is any sequence that alternates between two possibilities. A typical short sequence of binary code could look like:

1001011010111011000000001011101111111011001111
One consequence of storing data with a code such as this is that it is not very easy for a human being to understand. It is difficult to see all of the numbers and strings that may be represented in this sequence. However, it is much easier to design an electrical device that can store binary code compared with other ways of representing data. A device just needs to be able to represent one of two possibilities many times, like a series of on-off switches.

TechnologyExamplesDescription
Integrated CircuitCPU, GPU, RAMTypically a sequence of two voltages across a circuit is used to transmit data. One of the two possibilities is usually close to zero voltage, the other is usually a small, but detectable, voltage. All voltages go to zero when the power is off.
Compact DiskCD, DVDUses sequence of Microscopic Pits and Mirrors that either reflect lazor light or do not.
Magnetic RecordingMost Hard Drives, Cassettes, Magnetic StripsUses sequence of Microscopic Magnets that are aligned north-to-south or south-to-north. The alignment of the magnets remains when the power is turned off.
FlashUSB Drives, Some Hard DrivesThis technology is capable of holding electrical charges in many microscopic components even when the power is off.

Section 3.1 Name:____________________

Hardware


Score:      /5

Problems

  1. Output, Input, or Internal?
  2. PartRole
    Hard Drive
    CPU Core
    Cache
    Keyboard
    Video Card
    Central Processing Unit (CPU)
    Mouse
    Video Card
    Speakers/Headphones
    System BUS
  3. Vocabulary Matching: Computer Parts.
  4. Cache _____ Often just called "Main Memory", temporarily stores data used by computer programs while the program is running.
    Hard Drive_____ Displays visual images, including text, pictures, and videos.
    CPU Core_____ Produces sound, including music, voice, and sound effects.
    GPU _____ Used for moving a cursor across a screen.
    Video Card _____ Carries out most of the calculations necessary for a computer to function.
    Portable Memory Drive _____ A component of a CPU that carries out single calculations - one at a time.
    Mouse _____ Carries out most of the calculations necessary to display images.
    RAM _____ Used for entering text.
    Screen _____ Temporary memory storage similar to RAM, but smaller and more closely integrated with the CPU. Much faster than RAM.
    System BUS_____ Built into the computer. Used for long term storage of data. When the power is shut off to the computer data is not lost.
    CPU _____ Another major part of the computer containing the GPU and memory used for graphics.
    Motherboard _____ Is responsible for transporting data between the different parts of a computer.
    Speakers/Headphones _____ A major part of the computer containing the CPU, Cache, RAM.
    Keyboard _____ Not a permanent part of the computer and is an important tool for transporting data between computers.
  5. Vocabulary Matching: Technology.
  6. Flash____ Uses sequence of Microscopic Magnets that are aligned north-to-south or south-to-north.
    Compact Disk____ This technology is capable of holding electrical charges in many microscopic components even when the power is off.
    Magnetic Recording____ Typically a sequence of two voltages across a circuit is used to transmit data.
    Integrated Circuit ____ Uses sequence of Microscopic Pits and Mirrors that either reflect lazor light or do not.

Section 3.2: Binary Code For Non-Negative Integers

Introduction

Although it can take some getting used to, the way a non-negative integer (whole number) is represented with binary code is in many ways similar to the way an integer is represented in the decimal system. It should be noted that while this lesson focuses on non-negative integers, negative integers and floating point numbers are also represented with binary code.

The Decimal System (Base 10)

Almost everyone in the world learns the decimal system in their elementary school years. In the decimal system, a number is represented with a sequence of digits representing different quantities. The number 348 has a 3 in the hundred's place, a 4 in the ten's place and a 8 in the one's place. The 3 represents the quantity 300, the 4 represents the quantity 40, and the 8 represents the quantity 8.


348 = 3(100) + 4(10) + 8(1) @ 348 = 300 + 40 + 8

As we know, the decimal system uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 . It is important to keep in mind that 10 is not a digit, but 0 is a digit. This gives us 10 digits total, 0-9. For this reason the decimal system is sometimes called base-10.

The Binary Number System (Base 2)

The binary number system works by the same principles as the decimal system. The main difference is that in binary there are only two digits: 0, 1. In Python, binary is represented by typing 0b followed by the binary digits of that number. So 0b110 is actually the sequence of digits 1-1-0.

Because there are only two digits, instead of a ten's place there is a two's place. Instead of a hundred's place there is a four's place. However, just like the decimal system there is one's place. So the binary number 0b110 is:


0b110 = 1(4)+ 1(2) + 0(1) @ 0b110 = 4 + 2 @ 0b110 = 6

Place Value

In the decimal system, the different place values, such as the ten's place, the hundred's place, the thousand's place, and so on..., are all equal to 10 raised to different exponents. An important math fact: n0 = 1 for any number n, except 00 which is undefined.

Decimal Place Value
Place ValueExponential FormName
1100One's Place
10101Ten's Place
100102Hundred's Place
1000103Thousand's Place

The placement of a digit tells us the quantity that the digit represents. For example, the 3 in the number 30 represents 3 times 10 because the 3 is in the ten's place. The binary system has place values based on the powers of 2.

Binary Place Value
Place ValueExponential FormName
120One's Place
221Two's Place
422Four's Place
823Eight's Place
1624Sixteen's Place
3225Thirty Second's Place

Converting From Binary To Decimal

To convert from binary to decimal, the following steps can be used.

0b101101 = 1(32) + 0(16) + 1(8) + 1(4) + 0(2) + 1(1) @ 0b101101 = 32 + 0 + 8 + 4 + 0 + 1 @ 0b101101 = 45

Turning Decimal Numbers into Binary Numbers

It is a little tricker to turn a decimal number into a binary number. One approach is to take the number you wish to convert and repeatedly divide by two and find the remainder each time. When dividing by two the remainder is always 0 or 1. The remainders you find become the binary digits. However, the order we find the digits is in reverse. We will find the one's place first, then the two's place, and so on...

An Algorithm for Finding Binary Numbers
Convert 37 to Binary 37/2 = 18 + 1/2, remainder = 1 @ Digit: 1 @ 18/2 = 9 + 0/2, remainder = 0 @ Digits: 01 @ 9/2 = 4 + 1/2, remainder = 1 @ Digits: 101 @ 4/2 = 2 + 0/2, remainder = 0 @ Digits: 0101 @ 2/2 = 1 + 0/2, remainder = 0 @ Digits: 00101 @ 1/2 = 0 + 1/2, remainder = 1 @ Digits: 100101
Check 0b100101 = 1(32) + 0(16) + 0(8) + 1(4) + 0(2) + 1(1) @ 0b100101 = 32 + 0 + 0 + 4 + 0 + 1 @ 0b100101 = 37

Bits and Bytes

In almost all electrical devices, binary code is organized into units called bytes. You may have used terms like megabyte and gigabyte when discussing the sizes of files or how large a hard drive is. When we use these terms we are really discussing quantities of bytes.

Although it is much more common to use bytes to discuss an amount of binary code, a byte is not the smallest unit. A bit is actually the smallest unit and stands for binary digit. A bit is a single 1 or 0. A byte is 8 bits. A typical byte looks like: 01101001. If we are using a byte to represent an integer, such as 5, usually we will place 0s in front so that we have 8 bits. The byte representing the number 5 is 00000101.

Some Numbers As Bytes
NumberByte
500000101
1000001010
3200100000
9701100001
22511100001
25511111111

The largest integer that can be stored in a single byte is 255. That may seem like a strange number, but 255 is 1 less than 256 which is 28. The binary representation of 256 is 0b100000000, which is too big to store in a single byte. The number 256 is actually the smallest number that is too big to represent with a byte. The binary representation for 255 is 0b11111111 and it is the biggest number that is small enough to fit in a byte. It may also seem strange to learn that there are 256 possible numbers that can be stored in a byte since 255 is the biggest number, but this is because 0 is one of the possible numbers. There are 256 integers in the range 0-255.

Memory Units

To discuss the size of a file or the memory capacity of an electronic device, we typically use prefixes such as kilo-, mega-, giga- tera-. These prefixes stand for different quantities. Unfortunately the quantities that these prefixes stand for is not completely consistent. For example, the prefix kilo- can either stand for 1000 or 1024 (which is equal to 210). Frustratingly, the memory capacity of RAM is typically measured as multiples of 1024, while the memory capacity of a hard drive is measured in multiples of 1000. Because 1000 is close to 1024, the distinction is usually not very important. There are alternate naming conventions, however these are not very commonly used outside of the computer industry. Most people have probably never heard of a mebibyte or gibibyte, but these refer to prefixes using multiples of 1024.

PrefixValue Alternate Value
kilo10001024
mega(1000)2(1024)2
giga(1000)3(1024)3
tera(1000)4(1024)4
peta(1000)5(1024)5
How many bytes?
24 megabytes
= 24 * (1000)2 = 24,000,000 OR
= 24 * (1024)2 = 25,165,824

8 gigabytes
= 8 * (1000)3 = 8,000,000,000 OR
= 8 * (1024)3 = 8,589,934,592

Section 3.2 Name:____________________

Binary Code For Non-Negative Integers


Score:      /5

Problems

  1. Vocabulary Matching: Match each term with the best fitting description.
  2. Decimal System _____ Binary Digit
    Binary System _____ Unit of 8 individual 1's or 0's.
    Byte _____ Multiple of 1000 or 1024.
    Bit _____ Multiple of (1000)3 or (1024)3
    giga _____ Number system using 2 digits.
    kilo _____ Number system using 10 digits.
  3. Find the decimal value of the following binary numbers:
  4. BinaryDecimal
    0b1001
    0b10111
    0b100100
    0b100000100

    Workspace for Calculations:















  5. Find the binary number of the following decimal numbers:
  6. DecimalBinary
    55
    81
    64
    150

    Workspace for Calculations:













  7. Using your answers from the last problem, write down the digits for a single byte that would store these numbers in a computer.
  8. DecimalByte
    55
    81
    64
    150
  9. What is the smallest non-negative integer that can be stored in a single byte?


  10. What is the largest integer that can be stored in a single byte?


  11. How many bytes are stored in 64 megabytes of RAM? Recall RAM is usually measured in multiples of 1024.


  12. How many bits are stored in 64 megabytes of RAM?


Section 3.3: Hexadecimal Numbers

Introduction

The hexadecimal number system is another commonly used number system similar to the decimal and binary number systems. While the decimal system is base 10 and binary is base 2, the hexadecimal number system is base 16.

The main advantage of the hexadecimal number system is that it is easier to read than binary and hexadecimal numbers can be easily converted into binary and binary can be easily converted into hexadecimal. Hexadecimal to decimal and decimal to hexadecimal are trickier conversions. However, the algorithms we used for binary numbers are largely the same, but with a different base.

16 Digits

In any number system similar to the decimal system, such as binary and hexadecimal, every digit must be represented by a single symbol. The symbols we use for the decimal system are the familiar: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Recall that 10 is not represented by a single digit, despite the fact that this is the base 10 number system. The digits of binary are just: 0, 1. For hexadecimal we need 16 digits, however the only digits traditionally used are 0-9. So computer scientists and electrical engineers use the letters A-F to represent 10-15. In this way we have all of the 16 digits, 0-F, that we need.

6 More Digits
DigitsQuantity
A10
B11
C12
D13
E14
F15

A typical hexadecimal number looks like 0x1A2E, or 0xFF12. The 0x is the syntax Python uses to denote a hexadecimal number. The only purpose of the 0x in 0x1A2E is to inform Python, and the person reading the number, that it is a number represented with the hexadecimal number system.

Hexadecimal to Binary

As was mentioned, converting from hexadecimal to binary and binary to hexadecimal is relatively easy. This is one of the advantages of hexadecimal numbers. We do the conversion by converting the hexadecimal digits to binary first.

Hexadecimal Digits to Binary
DigitQuantityBinary DigitQuantityBinary
000000 881000
110001 991001
220010 A101010
330011 B111011
440100 C121100
550101 D131101
660110 E141110
770111 F151111

Now comes the easy part: to convert 0x3E to binary, simply replace the hexadecimal digit with the 4 digit binary number, one after the other. So 0x3E becomes 0011 1110.

Hexadecimal to Binary
HexadecimalBinary
0x70111
0xC1100
0xC711000111
0x1200010010
0xFFF111111111111
0xA01101000000001
0x1EE70001111011100111

Binary to Hexadecimal

First, break up the binary number into 4 digit segments, then look up the hexadecimal digit. Put 0's in front of the first segment if you need to in order to have 4 binary digits. So 11010 becomes 0001 1010, which becomes 0x1A

Binary to Hexadecimal
Binary4 Digit SegmentsHexadecimal
10101010x5
1001010010 01010x25
1001010110001 0010 10110x12B
11111111110011 1111 11110x3FF

Hexadecimal to Decimal

Converting to decimal numbers is not as straight forward. Like with binary and the decimal system, the hexadecimal system uses place value. For hexadecimal, the place values are 16 raised to different exponents.

Decimal Place Value
Place ValueExponential FormName
1100One's Place
10101Ten's Place
100102Hundred's Place
1000103Thousand's Place
Hexadecimal Place Value
Place ValueExponential FormName
1160One's Place
1616116's Place
256162256's Place
40961634096's Place

Recall, for the decimal number 348, we can decompose the number as follows:

Base 10 Representation of Numbers 348 = 300 + 40 + 8 @ 348 = 3(100) + 4(10) + 8

Hexadecimal works in the same way, except the base is 16. So the hexadecimal number 0x15AC is decomposed as follows:

Base 10 Representation of Numbers 0x15AC = 1(16**3)+5(16**2)+10(16**1)+12(16**0) @ 0x15AC = 1*4096+ 5*256 + 10*16 + 12 @ 0x15AC = 4096+1280+160+12 @ 0x15AC = 5548

Representing Colors with Hexadecimal

Hexadecimal is frequently used to represent the data stored in bytes. This includes colors. For example in HTML, the color red is represented by #FF0000. The first two digits are the hexadecimal digits for the color red. The next two, 00 in this case, are the digits for green and the last to digits are for blue. Orange happens to be #FF8000. This will be discussed in greater detail in section 3.5.


Section 3.3 Name:____________________

Hexadecimal Numbers


Score:      /5

Problems

  1. Vocabulary Matching: Technology.
  2. Hexadecimal____ A single symbol used to represent a quantity.
    Decimal ____ The base 2 number system.
    Binary____ The base 16 number system.
    Digit ____ The base 10 number system.
  3. Convert the following hexadecimal numbers to binary.
  4. HexadecimalBinary
    0xF
    0xEF
    0x111
    0xA0B00
  5. Convert the following binary numbers to hexadecimal.
  6. BinaryHexadecimal
    101
    100101
    10010011110
    1110110001011010
  7. Convert the following hexadecimal numbers to the decimal system.
  8. HexadecimalDecimal (Regular Numbers)
    0xA
    0x12
    0xF0F
    0x9900E

    Workspace for Calculations:















Section 3.4: Binary Code For Strings

Introduction

Recall that a string is really just a sequence or "string" of symbols, punctionation marks, blank spaces, and other formating markers. In order to represent this information inside of a computer, for example in RAM or in a Hard Drive, computer scientists have come up with a simple system: each symbol or marker is represented by a number (an integer) and that number is stored in binary code. All letters, symbols, punctionation marks, blank spaces, and other formating markers, which are generally called characters, are all stored as positive integers. So, in memory, strings are just sequences of numbers.

Every character has its own unique integer. There are two common conventions that are used in the English speaking world. The older convention is called ASCII and it has the Latin alphabet, the alphabet we use in English (a-z). There are also letters with accent marks, as well as punctuation marks, numberical symbols for digits (0, 1, 2,... ), and whitespace markers such as the space created by hitting the space bar or the tab key are also characters.

The newer and much larger set of symbols is called Unicode. Unicode has almost every symbol used in spoken languages around the world. If you can name a language, then it is overwhelming likely that the symbols used in that language are represented in Unicode. There are also other conventions used for character sets, such as for Chinese, Cyrillic, Arabic, and Greek. Many of these existed before Unicode was created.

ASCII

ASCII stands for American Standard Code for Information Interchange. In ASCII, every character is represented by a single byte, whether it is a letter, whitespace, etc. The byte for a given character can be converted to a number. The capital letters, A-Z, are represented by the numbers 65-90 and the lower case letters, a-z, are represented by the numbers 97-122. The digits, 0-9, are represented by the numbers 48-57.

ASCII Examples
CharacterNumberByte
"A"650b00100001
"B"660b00100010
"Z"900b01011010
"g"1030b01100111
"n"1100b01101110
"4"520b00110100
" "320b00100000
","440b00101100

It may seem strange to think that the digit 0 is represented by the number 48 and the byte 0b00110000, but keep in mind that the digit 0, inside of a string, is only a symbol. The ASCII code is only a numbering of useful symbols used in text. The meaning of the symbol does not correspond to the number.

Lets take a second to consider what is actually going on inside of a computer. Everytime text is typed by the user of a computer, then the corresponding number is stored somewhere in RAM. If using ASCII, everytime the user types the lower case letter g, then somewhere in RAM is the byte 01100111. Recall that these 1's and 0's represent small or zero voltages in the circuits of RAM. Lets call these voltages "on" and "off". Therefore, when g is typed, somewhere in RAM is the sequence of voltages off-on-on-off-off-on-on-on.

Unicode

The main difference between Unicode and ASCII is that the number of bytes used to store characters in Unicode is generally greater. Unicode was designed to be consistent with ASCII. So, Unicode uses the same numbers as ASCII to represent any characters that are also part of the ASCII system. However, because Unicode can represent so many more characters, some characters may take up to 4 bytes to store. For example, the Chinese character for the Moon is 月 and is represented by 26376, which takes at least 2 bytes to store. The two bytes are 01100111 00001000.

Fonts

Fonts contain the actual images that are shown on the screen or that appear on paper when text is printed. When text appears on the screen, a font must be used by whatever application is displaying the text (Word, Pages, Google Docs, Notepad, Gedit, etc.). Fonts are essentially lists of numbered images representing symbols. When an application is displaying text, it reads the list of numbers representing each of the characters. For each character, the application looks up which image to display in the font being used.

Fonts, at least normally, contain the correct image for the character that they are supposed to display. However, there is nothing about the hardware of a computer that prevents completely different images being displayed. For example, the Microsoft font Wingdings displays a variety of different symbols and images instead of the ordinary letters and digits.

Section 3.4 Name:____________________

Binary Code For Strings


Score:      /5

Problems

  1. Vocabulary Matching: Match each term with the best fitting description.
  2. Character _____ A numbered list of images usually of letters, punctuation marks or other symbols.
    ASCII _____ An individual symbol, including letters, punctuation marks, symbols used in other languages.
    Unicode _____ An newer and more complex system for assigning characters to numbers that includes a much larger list of characters.
    Font _____ An older and simpler system for assigning characters to numbers.
  3. Convert the following sequence of bytes to a string of text.
  4. BytesString
    01001000 01101001
    00110101 00110011 00111000
    01100110 00101000 01111000 00101001

    Workspace for Calculations:





















  5. Find the sequence of bytes used to represent the string "No Way!"

  6. Workspace for Calculations:















Section 3.5: Representing Colors

Introduction

Colors can be created on a computer screen in a way that is similar to creating colors with paint. You may have learned in an art class of the primary colors and of the color wheel. Just as with paint, colors on a computer screen can be combined to create new colors. One major difference is that the rules for combining colors on a computer screen are different than with paint. For example, if blue paint and yellow paint are mixed, green paint is produced. This does not happen with a computer screen. Instead if blue and yellow light are combined, white or gray would be produced.

The Primary Colors of Light

The primary colors of light are red, green, and blue. Yellow has been replaced by green. On a computer screen different amounts of the primary colors of light are shown at the same location on the screen. When two colors of light are combined, the resulting color is brighter because there is more light overall.

Paint absorbs colors other than the color of that paint. So when ordinary light containing all of the colors is shown on an object painted blue, all of the colors except blue are absorbed. The object appears blue because that is the color that reflects back. So when different colors of paint are combined more light is absorbed and the resulting color is darker.

Some of the rules for combining light may surprise you. Below, "half" refers to the color being at half brightness or intensity.

Color Combination Rules of Light
Mixed ColorsResulting Color
Red + GreenYellow
Half Green + RedOrange
Green + Half RedOlive
Red + BlueMagenta
Half Red + Half BluePurple
Green + BlueCyan
Half Green + Half BlueTeal
Red + Green + BlueWhite
Half Red + Half Green + Half BlueGray
No LightBlack

Opinions on some of the color names may vary. For example, some may say Olive is half green light and half red light. However, the colors Yellow, Magenta, and Cyan are very commonly considered to be mixtures of red, blue, and green at full intensity. White is the combination of all of the colors at full intensity. Gray is produced when all of the colors are combined with the same relative amount, but at lower intensity. Different shades of gray can be produced by varying the light intensity. Black is the absence of light. If a part of your computer screen is black, such as text, then your screen is not shining any light, as though your screen was turned off, at least at those spots.

The RGB System

The RGB system is a way of representing a color with different integer values for the different amounts of red, green, and blue light. Although there are different conventions, one very common convention is to use a single byte for each of the three primary colors of light. Recall that the largest integer that can be stored in a single byte is 255. So white could be represented by the 3 numbers (255, 255, 255). In the RGB system the order is always (RED, GREEN, BLUE). So red can be represented by (255,0,0), and blue by (0,0,255). When smaller numbers are used we can get colors such as orange, which is (255,128,0). The number 128 is about half of 255.

Color NameRGB Representation
Red(255,0,0)
Green(0,255,0)
Blue(0,0,255)
Yellow(255,255,0)
Magenta(255,0,255)
Cyan(0,255,255)
Orange(255,128,0)
White(255,255,255)
Light Gray(192,192,192)
Gray(128,128,128)
Dark Gray(64,64,64)
Black(0,0,0)

Of course many other combinations are possible. The bytes (111,45,0) create a color that looks like the color of my desk. The bytes (88,136,0) create a color that, to me, looks like it could be the color of grass.

Pixels

For an image that is displayed on a computer screen, the individual points of light that make up the image are called pixels. Even a relative small image can contain many pixels that make up that image. Pixels are laid out in a square grid. So the number of pixels contained in an image can be calculated by multiplying the width and the height measured in pixels. A common size for a small icon is 32 × 32 pixels. Even for such a small image there are 1024 individual points of light. Everyone of these pixels requires at least 3 bytes, one for each of the primary colors of light. So an icon of this size requires at least 3 × 32 × 32 = 3072 bytes, which is about 3 kilobytes.

Section 3.5 Name:____________________

Representing Colors


Score:      /5

Problems

  1. Vocabulary Matching: Technology.
  2. RGB System____ A single point of light on a computer screen.
    The primary colors of light. ____ The absence of any light.
    Black____ A way of representing colors by combining 3 main colors.
    White ____ Colors that can be combined to produce any visible color.
    Pixel ____ All primary colors of light at full intensity.
  3. What colors are produced when the following colors are combined?
  4. CombinationResult
    Red (255,0,0) and Dark Green (0,128,0)
    Dark Green (0,128,0) and Dark Blue (0,0,128)
    Dark Red (128,0,0) and Dark Green (0,128,0) and Dark Blue (0,0,128)
    Magenta (255,0,255) and Green (0,255,0)

  5. Assuming that 3 bytes are used to represent the color at each pixel in a picture, at minimum, how many bytes does it take to store a 300 × 200 pixel picture? How many kilobytes is this?

  6. Workspace for Calculations:







  7. A common computer screen resolution is 1366 × 768. Assuming that 3 bytes are used to represent the color at each pixel on a screen, at minimum, how many bytes does it take to represent an image taking up the entire computer screen for a screen this size? How many kilobytes is this? How many megabytes?

  8. Workspace for Calculations:











  9. Determine the following colors using the HTML system. Hint: in hexadecimal FF is 255 and 80 is 128.
  10. HTML ColorColor Word
    #00FF00
    #FF00FF
    #808080
    #FFC0C0