Solved

Which Set of Statements Totals the Items in Each Row

Question 6

Multiple Choice

Which set of statements totals the items in each row of two-dimensional array items, and displays each row's total?


A) for (int row = 0; row < items.length; row++) {
Int total = 0;
For (int column = 0; column < items[row].length; column++) {
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total) ;
}
B) int total = 0;
For (int row = 0; row < items.length; row++) {
For (int column = 0; column < items[row].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total) ;
}
C) int total = 0;
For (int row = 0; row < items.length; row++) {
For (int column = 0; column < items[column].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total) ;
}
D) for (int row = 0; row < items.length; row++) {
Int total = 0;
For (int column = 0; column < items[column].length; column++) {
Total += items[row][column];
}
System.out.printf("Row %d's total is %d%n", row, total) ;
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions