subject

Consider the following method, sumRows, which is intended to traverse all the rows in the two-dimensional (2D) integer array num and print the sum of all the elements in each row. public static void sumRows(int[][] num)
{
for (int[] r : num)
{
int sum = 0;
for (int j = 0; j < num. length; j++)
{
sum += r[j];
}
System. out. print(sum + " ");
}
}
For example, if num contains {{3, 5}, {6, 8}}, then sumRows(num) should print "8 14 ".
The method does not always work as intended. For which of the following two-dimensional array input values does sumRows NOT work as intended?
A. {{10, -18}, {48, 17}}
B. {{-5, 2, 0}, {4, 11, 0}}
C. {{4, 1, 7}, {-10, -11, -12}}
D. {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
E. {{0, 1}, {2, 3}}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
What are the different parts of computer
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
You know the right answer?
Consider the following method, sumRows, which is intended to traverse all the rows in the two-dimens...
Questions
question
Mathematics, 20.09.2021 06:40
question
Mathematics, 20.09.2021 06:40
question
Mathematics, 20.09.2021 06:40
question
Mathematics, 20.09.2021 06:40
question
Mathematics, 20.09.2021 06:40
question
Mathematics, 20.09.2021 06:50
Questions on the website: 13722363