CS173: Intro to Computer Science - Number Systems
Activity Goals
The goals of this activity are:- To identify the number systems that represent common data types
- To model colors according to their RGB encoding
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 take notes for the group, and appoint another member to discuss your findings with the class. After class, think about the questions in the reflective prompt and respond to those individually. 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
Questions
- What is the decimal representation for the character
'A'
? How about the newline character\n
? - What is the decimal representation for the character
'B'
? How about the character'b'
? What is the difference between them? - What is the difference between each corresponding capital and lowercase letter?
- Write out the representation for the character
'B'
in binary, and also the character'b'
. How does their binary differ? - How do you think a
boolean isLowerCase(char x)
function might work?
Model 2: RGB Colors
Visit this page: https://www.rapidtables.com/web/color/RGB_Color.html
Questions
- What three colors are used to define all colors on the color wheel?
- What does every greyscale color have in common?
- 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?
- What is the largest and smallest value of red, green, and blue that you can have?
- Given the number of possible reds, greens, and blues, how many total colors can we represent?
- Including black and white, how many possible pure greyscale colors can we represent?