Solved

Which Set of Statements Totals the Items in Each Row

Question 28

Multiple Choice

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


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

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