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, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
Aman travel 200m towards east< br /> from his house then takes left< br /> to turn and moves 200 m north< br /> find the displacement & distance.< br />
Answers: 3
question
Computers and Technology, 24.06.2019 20:20
Write python code that prompts the user to enter his or her favorite color and assigns the user’s input to a variable named color.
Answers: 1
question
Computers and Technology, 24.06.2019 20:30
How is energy expended in active transport
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
English, 18.05.2020 20:57
question
Mathematics, 18.05.2020 20:57
question
English, 18.05.2020 20:57