Reading Quiz Questions
These are the questions that will appear on the reading quizzes in week 3. Remember these quizzes take place at the start of class, and you get points for correctness, not just participation. These will be the exact questions we ask you. They will be multiple choice clicker questions, but we do not provide the answer choice here. If you can answer them without the answer choices, you'll have no problems answering them when you see the choices. These are not designed to be overly tricky.
Monday, Jan 21st
Holiday: No Class
Wednesday, Jan 23rd
(1) What should go in the blank so that the while loop changes the color of ALL the pixels to black?
Pixel[]pixelArray=this.getPixels();
int index = 0;
Pixel pixel = null;
while(index<pixelArray.length)
{
pixel = pixelArray[index];
pixel.setColor(Color.black);
____________
}
(2) To create a for loop to modify all the pixels in pixelArray what would go in the blank area?
Pixel[]pixelArray=this.getPixels();
Pixel pixel = null;
for(int index = 0; ____________; index++)
{
pixel = pixelArray[index];
pixel.setColor(Color.black);
}
Pixel[]pixelArray=this.getPixels();
int index = 0;
Pixel pixel = null;
while(index<pixelArray.length)
{
pixel = pixelArray[index];
pixel.setColor(Color.black);
____________
}
(2) To create a for loop to modify all the pixels in pixelArray what would go in the blank area?
Pixel[]pixelArray=this.getPixels();
Pixel pixel = null;
for(int index = 0; ____________; index++)
{
pixel = pixelArray[index];
pixel.setColor(Color.black);
}
Friday, Jan 25th
(1) What line of code would I use to get a Pixel located at (50,50) from an already defined Picture object named pictObj?
(2) In the following code what update is done at the end of each loop iteration?
for (int index = 0; index < 5; index++)
{
//Some code here
}
(2) In the following code what update is done at the end of each loop iteration?
for (int index = 0; index < 5; index++)
{
//Some code here
}