Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2007 Test 1 Review: What Happen? Questions

Post questions here.
um...is this supposed to be multiple questions? It's really not very clear...
Yes. Treat them all as separate sub-questions. Colin Potts

hmmm.. okay, so i think:

1) prints red as '300' ?!?!
2) pretty sure it'll print jREMOVEDt '2'.. but don't know why it rounds down?!
3) it'll print '2.5' for sure
4) this'll retrieve a list of pixels in a should already be defined 'pic'
5) print '0' for false
6) and i think this one will still be white?!?! maybe?!
I thought #6 would be green....
For number two, since five and two are integers, I think Python "rounds down" becaREMOVEDe the result mREMOVEDt also be an integer. For number six, I think that it will green. The initial color is white. Then, red is cleared (setRed(p,0)). Next, blue is cleared (setBlue(p,getRed(p)) becaREMOVEDe getRed(p) = 0. So, the color of the pixel is green since both red and blue are zero. Student5295
  1. 1 would be 255 by the way. you can't have red 300.
I don't think it would go to green in 6.... jREMOVEDt becuase red and blue are cleared, there is still no green added to the white.
Doesn't it wrap around though? (for number 1) So wouldn't red be 45? BecaREMOVEDe 300 - 45 = 255?

I think number six is green becaREMOVEDe the value of white is (255, 255, 255) and you are setting both the red and the blue values to zero, so the remaining value is (0, 255, 0), which is green.
I believe that the answer for number 1 is 44. According to the book, when you set a value for over 255, it wraps around, but it starts the 'wrap around' at 0. So in order to account for this you would do 300 - 255 - 1 = 44. Student5379
1. is 255...i tried it in JES and it printed out 255
If this comes up in the test, either 44 or 255 would be graded correct. Which one you get is the result of changing the JES preference setting I showed in class. In the later versions of JES, it gives 255 for any value you attempt to set above 255. For version 2 (as documented in the book) it wraps around and gives 256%value. Colin Potts




Link to this Page