AP Computer Science A Question of the Day

Test your knowledge with a hand-picked multiple-choice question.

Consider the following code:

public static void main(String<u></u> args) {

double<u></u><u></u> matrix = {{1,6,7},{1,4,5}};

graphics(matrix);

}

private static double graphics(double<u></u><u></u> x) {

double r = 0;

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

for(int j = 0; j < x<u>i</u>.length; j++) {

r += x<u>i</u><u>j</u> * (i + 1);

}

}

return r;

}

What is the return value for graphics in the code below:

double<u></u><u></u> matrix = {{1,6,7},{1,4,5}};

graphics(matrix);

Select an answer and click Check.