Question: If you have to iterate through an image, looking at each column, and then while you are in a particular column, looking at the pixel

If you have to iterate through an image, looking at each column, and then while you are in a particular column, looking at the pixel in each row, what would be the appropriate for loop setup?

Group of answer choices

for (int x=0; x< getWidth(); x++) {

for (int y = 0;y < getHeight(); y++) { ...

for (int y = 0; y < getHeight(); y++) {

for (int x = 0; x < getWidth(); x++) {....

for (int i = 0; i < pixelArray.length; i ++) { ....

for (int x = 0; x < getHeight(); x++) {

for (int y = 0; y < getWidth(); y++) {...

for (int m = 0; m < getHeight(); m++) {

for (int n = 0; n < getWidth(); n++) {...

If you have to make the same change to every single pixel in an image (such as darken it), which code below will get you access to all the pixels you need?

Group of answer choices

for (int x = 0; x < getWidth(); x++) {

for (int y = 0; y < getHeight(); y++) {...

for (int y = 0; y < getHeight(); y++) {

for (int x = 0; x < getWidth(); x++) {...

for (int i = 0; i < pixelArray.length; i++) { ...

int index = 0;

while (index < pixelArray.length) {...

index = index + 1;

}

for (Pixel pixelObj : pixelArray) { ...

All the above

If you had to make a change to the bottom right quadrant of an image, how would you get access to only those pixels?

Group of answer choices

for (int x = getWidth()/2; x < getWidth(); x++) {

for (int y = getHeight()/2; y < getHeight(); y++) {

pixelObj = getPixel(x, y);...

for (int x = 0; x < getWidth()/2; x++) {

for (int y = 0; y < getHeight()/2; y++) {

pixelObj = getPixel(x, y);...

for (int i = (int)(pixelArray.length*0.75); i <

pixelArray.length; i++) {

pixelObj = pixelArray[i];...

int index = (int)(pixelArray.length*0.75);

while (index < pixelArray.length) {

pixelObj = pixelArray[i];

index++;...

C & D

How many times will the following code print out "ITSC 1212"?

for (int i = 0; i < 25; i++) {

for (int j = 0; j < 10; j++) {

System.out.println(i + ", " + j);

System.out.println("ITSC 1212");

}

}

Group of answer choices

25

10

35

250

Forever, it's an infinite loop

How many times will the following code print out "ITSC 1212"?

for (int i = 0; i < 25; i++) {

for (int j = 0; j < 10; ) {

System.out.println(i + ", " + j);

System.out.println("ITSC 1212");

}

}

Group of answer choices

25

10

35

250

Forever, it's an infinite loop

How many times will the following code print out "ITSC 1212"?

for (int i = 0; i < 25; i++) {

for (int j = 0; j < 10; j++ ) {

System.out.println(i + ", " + j);

}

System.out.println("ITSC 1212");

}

Group of answer choices

25

10

35

250

Forever, it's an infinite loop

How many times will the following code print out "ITSC 1212"?

for (int i = 0; i < 25; i++) {

for (int j = 0; j < 10; j++ ) {

for (int k = 0; k < 4; k++) {

System.out.println(i+","+j+","+k);

System.out.println("ITSC 1212");

}

}

}

Group of answer choices

25

10

4

250

1000

Forever, it's an infinite loop

Assuming the same code from the last question:String[][] bestActressAANominees = new String[5][2];bestActressAANominees[0][0] = "Jessica";bestActressAANominees[0][1] = "Chastain";...How would you get a count of the number of nominees whose last name is shorter than their first name? (Hint:the length() method tells you how many characters are in a String).

Group of answer choices

int numLastNameShorter = 0;for (int i = 0; i < 5; i++) {if (bestActressAANominees[i][0].length() > bestActressAANominees[i][1].length()) {numLastNameShorter =numLastNameShorter + 1;}}

int numLastNameShorter = 0;for (int i = 0; i < 5; i++) {if (bestActressAANominees[i][0].length() < bestActressAANominees[i][1].length()) {numLastNameShorter =numLastNameShorter + 1;}}

int numLastNameShorter = 0;for (int i = 0; i < 5; i++) {if (bestActressAANominees[0][i].length() > bestActressAANominees[1][i].length()) {numLastNameShorter =numLastNameShorter + 1;}}

int numLastNameShorter = 0;for (int i = 0; i < 5; i++) {if (bestActressAANominees[i][0].length() > bestActressAANominees[1][i].length()) {numLastNameShorter =numLastNameShorter + 1;}}

How would you initialize a 2D array of doubles called heightWeight that represents the height and weight of the 25 members of the UNC Charlotte football team?(you can have multiple answers)

Group of answer choices

double[][] heightWeight = new double[25][25];

double[][] heightWeight = new double[25][2];

double[] heightWeight = new double[50];

double heightWeight[] = new double[25,2];

Assuming you have initialized the heightWeight array from the previous question like this:

double[][] heightWeight = new double[25][2];

heightWeight[0][0] = 6.4; //height

heightWeight[0][1] = 270.0; // weight

...

How would you find out which player is the tallest?

Group of answer choices

int tallest_index = 0;

for (int i = 1; i < 25; i++) {

if (heightWeight[i][0] > heightWeight[tallest_index][0])

tallest_index = i;

}

System.out.println("The tallest player is at index " + tallest_index);

int tallest_index = 0;

for (int i = 1; i <= 25; i++) {

if (heightWeight[i][0] > heightWeight[tallest_index][0])

tallest_index = i;

}

System.out.println("The tallest player is at index " + tallest_index);

int tallest_index = 0;

for (int i = 1; i < 25; i++) {

if (heightWeight[i][0] > heightWeight[i-1][0])

tallest_index = i;

}

System.out.println("The tallest player is at index " + tallest_index);

int tallest_index = 0;

for (int i = 1; i < 2; i++) {

for (int j = 0; j < 25; j++) {

if (heightWeight[i][j] > heightWeight[tallest_index][j])

tallest_index = i;

}

}

System.out.println("The tallest player is at index " + tallest_index);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!