A1
- How many bits does it take to represent the values from 0 to 255?
- How many bytes does it take to represent a color in the RBG color model?
- How many pixels are in a picture that is 640 pixels wide and 480 pixels high?
- 307,200 pixels (640 * 480)
A2
- Pink:
r=255 g=192 b=202
- Yellow:
r=255 g=255 b=0
- Purple:
r=128 g=0 b=125
- White:
r=255 g=255 b=255
- Dark Gray:
r=169 g=169 b=169
A3
- Top left row index? 0.
- Top left column index? 0.
- Right most column index (width 640)? 639.
- Bottom most row index (height 480)? 479.
- Row index increase direction? Top to bottom.
- Column index increase direction? Left to right.
- Zoom 500%, see squares (pixelation)? Yes.
A5
- getPixels2D in Picture.java? No (it’s inherited).
- getPixels2D in SimplePicture.java? Yes.
- DigitalPicture p = new DigitalPicture(); compiles? No (interface).
- DigitalPicture p = new SimplePicture(); compiles? Yes (polymorphism).
- DigitalPicture p = new Picture(); compiles? Yes (polymorphism).
- SimplePicture p = new Picture(); compiles? Yes (polymorphism).
- Picture p = new SimplePicture(); compiles? No (cannot assign superclass to subclass variable directly).
- (Implicit) What good is an interface method without a body? Defines a contract for implementing classes.
A7
- Body executions (row 7-16, col 6-14)? 90 times.
- Body executions (row 5-11, col 3-18)? 112 times.