CS173: Intro to Computer Science - Number Systems


Activity Goals

The goals of this activity are:
  1. To identify the number systems that represent common data types
  2. To model colors according to their RGB encoding

Warmup

What is the value of 255 in binary, and in hexadecimal? How about 256?

The Activity

Directions

Consider the activity models and answer the questions provided. First reflect on these questions on your own briefly, before discussing and comparing your thoughts with your group. Appoint one member of your group to discuss your findings with the class, and the rest of the group should help that member prepare their response. Answer each question individually from the activity, and compare with your group to prepare for our whole-class discussion. After class, think about the questions in the reflective prompt and respond to those individually in your notebook. Report out on areas of disagreement or items for which you and your group identified alternative approaches. Write down and report out questions you encountered along the way for group discussion.

Model 1: ASCII Table

ASCII Table from Wikipedia

Questions

  1. What is the decimal representation for the character 'A'? How about the newline character \n?
  2. What is the decimal representation for the character 'B'? How about the character 'b'? What is the difference between them?
  3. What is the difference between each corresponding capital and lowercase letter?
  4. What is your name in ASCII decimal representation? What is this in binary?
  5. Write out the representation for the character 'B' in binary, and also the character 'b'. How does their binary differ?
  6. How do you think a boolean isLowerCase(char x) function might work?
  7. How large is an int variable in bits? How does this compare to a String?
  8. What are some ways we could specify the size of a String? In other words, how can we know when the String is finished?

Model 2: RGB Colors

Visit this page: https://www.rapidtables.com/web/color/RGB_Color.html

Questions

  1. What three colors are used to define all colors on the color wheel?
  2. What does every greyscale color have in common?
  3. If you have one, what is the RGB value of your favorite color (or choose any color!)? What is the value of the red, green, and blue components in hexadecimal? What is the value in the "#" box for this color?
  4. What is the largest and smallest value of red, green, and blue that you can have?
  5. Given the number of possible reds, greens, and blues, how many total colors can we represent?
  6. Including black and white, how many possible pure greyscale colors can we represent?
  7. The complement of a color is the color computed whose red, green, and blue values would create white light when combined with the original color. What mathematical expressions might compute the complement of a color defined in RGB?

Embedded Video

You can play the following video right here from your browser!

Submission

I encourage you to submit your answers to the questions (and ask your own questions!) using the Class Activity Questions discussion board. You may also respond to questions or comments made by others, or ask follow-up questions there. Answer any reflective prompt questions in the Reflective Journal section of your OneNote Classroom personal section. You can find the link to the class notebook on the syllabus.