Solved

If Numbers Is a Two-Dimensional Int Array That Has Been

Question 53

Multiple Choice

If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?


A) for (int row = 1; row < numbers.length; row++)
{
For (int col = 1; col < numbers.length; col++)
Total += numbers[row][col];
}
B) for (int row = 0; row < numbers.length; row++)
{
For (int col = 0; col < numbers.length; col++)
Total += numbers[row][col];
}
C) for (int row = 0; row < numbers[row].length; row++)
{
For (int col = 0; col < numbers.length; col++)
Total += numbers[row][col];
}
D) for (int row = 0; row < numbers.length; row++)
{
For (int col = 0; col < numbers[row].length; col++)
Total += numbers[row][col];
}

Correct Answer:

verifed

Verified

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents