B CUSP 110C Digital Thinking

Homework 4: Colors and Binary Numbers

 

Colors And Binary Numbers

Goals: Reading color representations and Practice with Binary/Decimal number representations

Part 1: Color Representation

Dark Gray

Light

Gray

Black

White

Red-ish

Green-ish

Blue-ish

Which of the following color representation best describe the above colors?

 

1.      (180, 40, 40)

2.      (40, 180, 40)

3.      (40, 40, 180)

4.      (0, 0, 0)

5.      (180, 180, 180)

6.      (30, 30, 30)

7.      (255, 255, 255): White

 

Part 2: Decimal and Binary representations

A.    Convert decimal 125 to binary:

Num Being Converted

125

 

 

 

 

 

 

 

 

Place Value

256

128

64

32

16

8

4

2

1

Subtract

 

 

 

 

 

 

 

 

 

Binary Num

 

 

 

 

 

 

 

 

 

 

B.     Convert decimal 387 to binary

Num Being Converted

387

 

 

 

 

 

 

 

 

Place Value

256

128

64

32

16

8

4

2

1

Subtract

 

 

 

 

 

 

 

 

 

Binary Num

 

 

 

 

 

 

 

 

 

 

C.     In class we have seen that 11012 (read: 1101-base2) has a decimal value of 13. What is the decimal value of

 

a.       10012

b.      1001012

c.       11011012

 

D.    What are the sums for the following binary numbers (hint: convert to decimal to verify your answers), express your answers in binary.

a.       10012 + 10012

b.      10012 + 1001012

c.       1001012 + 11011012

 

To Turn In
Use a word processor, or, write neatly, your answers to Part-1 numbers 1 to 7 (answer to 7 is given to you) 1 to 14 (answers 6 and 14 are given to you), and Part-II A to D. Provide details and partial credits will be given. Print out and bring your assignment to submit in class. Warning: there is no electronic submission for this assignment! If you miss class, or forget to bring your work, you will receive a zero!

 

Wrap Up

In this homework assignment you have practice reading (RGB) color representation in both floating point and integer. You have also practiced decimal to binary conversion and performing addition with binary numbers.