1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mars1129 [50]
3 years ago
14

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}}
Computers and Technology
1 answer:
Lena [83]3 years ago
8 0

Answer:

Option C: {{4, 1, 7}, {-10, -11, -12}}

Explanation:

There is a logical error in the inner loop.

for (int j = 0; j < num.length; j++)

It shouldn't be "j < num.length" as the iteration of the inner loop will be based on the length of the row number of the two dimensional array. The inner loop is expected to traverse through the every column of the same row in the two dimensional array and sum up the number. To fix this error, we can change it to

for (int j = 0; j < r.length; j++)

You might be interested in
Arun is 5 years older than Anu. five years ago, the ratio of their ages was 3:2 . find their present age​
vagabundo [1.1K]

Answer: Arun is 15 years old and Anu is 10 year old

Explanation:

Multiple 5 by 3, Multiple 5 by 2 there goes you answer please give 5 stars and Thanks

3 0
4 years ago
Read 2 more answers
What has the dogo argentino been bred to do?​
Law Incorporation [45]

Answer:

it was bred for big-game hunting. the bred is known for its bravery and is willingness to protect its human companion.

3 0
4 years ago
If a user’s current directory is /home/mary/project1, which command could she use to move to the etc directory directly under th
kykrilka [37]

Answer:

Option 4 is the correct answer to the above question.

Explanation:

In the Linux operating system, The etc folder is listed on the root directory. When any user wants to go in the root directory of the Linux operating system from anywhere, then he needs to follow the command of the name of the folder where he wants to go with the '/' symbols. The above question states that the user wants to go to the etc folder of the root directory, then he needs to press the command '/etc' with the help of cd command because cd command is used to open any folder. So the option 4 is the correct, while the other is not because--

  • Option 1 states about cd which gives the error.
  • Option 2 states about cd /home/mary/etc which take the user to the etc folder which is in the mary folder.
  • Option 3 states about the cd etc which is used to take the user on the etc folder which is in the current folder.
  • Option 5 states about the cd\etc which gives the error.
8 0
3 years ago
Write three guidelines to help you keep track of your behavior as you use different apps with
Gala2k [10]

Answer:

A basic guideline plan to help me track my behavior consist of the following:

How much time do I use each element?

Have I experienced anxiety after using them?

Have I experienced anxiety while using them?

Have I changed my day to day routine by using them?

Explanation:

The reasons to back my answer are the following. First of all, dependency can be measured in time spent and anxiety developed after the use of the element. Thus, we need to explore if the source of media has originated anxiety while using it or after using t to spot if we are suffering an addictive pattern. Also, generally addictive elements create anxiety while using it and it increases after stop using them. Therefore, if we find that we have experienced both types of anxiety we are in an addictive cycle.

4 0
3 years ago
Which of the following policy guidelines specifies the restrictions on user access
Levart [38]

The policy guidelines that specifies such restrictions on user access can be referred to as: A. Least privilege.

<h3>What is the Least Privilege Principle?</h3>

The least privilege principle can be described as a concept in information security and policy guidelines that gives a user minimum permission or levels of access that they are needed to execute a tasks.

Therefore, the policy guidelines that specifies such restrictions on user access can be referred to as: A. Least privilege.

Learn more about least privilege on:

brainly.com/question/4365850

6 0
3 years ago
Other questions:
  • About how many people live in mexico city A. 9M B. 5M C. 11M
    7·1 answer
  • Write a Java program that generates a random number between 0 and 50. Then, the program prompts for guesses until the user is co
    14·1 answer
  • Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically
    14·1 answer
  • _____ can analyze the content of social media communications within the context of a specific brand or product and determine wha
    13·1 answer
  • Write a script that will read from a file x and y data points in thefollowing format:
    9·1 answer
  • Write a function that receives an integer (n) argument and then computes the following based on the value of the integer: While
    13·1 answer
  • Which sentence indicates that Jeff is mentioning the visual synopsis in his proposal while planning a media project?
    10·1 answer
  • Where are my files shortcut in documents folder.
    14·1 answer
  • Which coding manual contains three to seven character codes with a decimal after the third character
    11·1 answer
  • What should you implement to leverage power, cooling, and networking capabilities independent from other datacenters in a region
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!