B CUSP 110B – Digital Thinking

Homework 6: 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?

 

Floating point representations:

1.      (0.3f, 0.3f, 0.3f)

2.      (0.8f, 0.8f, 0.8f)

3.      (0.2f, 0.2f, 0.9f)

4.      (0.2f, 0.9f, 0.2f)

5.      (0.9f, 0.2f, 0.2f)

6.      (0.0f, 0.0f, 0.0f): Black

7.      (1.0f, 1.0f, 1.0f)

 

Integer representations:

8.      (180, 40, 40)

9.      (40, 180, 40)

10.  (40, 40, 180)

11.  (0, 0, 0)

12.  (180, 180, 180)

13.  (30, 30, 30)

14.  (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 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 on Wednesday. Warning: there is no electronic submission for this assignment! If you miss class, or forget to bring your work on Wednesday, 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.