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
MAXImum [283]
3 years ago
6

Assume arr2 is declared as a two-dimensional array of integers. Which of the following segments of code successfully calculates

the sum of all elements arr2?
A.int sum = 0;for(int j = 0; j < arr2.length; j++){ for(int k = 0; k < arr2[j].length; k++) { sum += arr2[k][j]; }}
B.
int sum = 0;for(int j = arr2.length − 1; j >= 0; j−−){ for(int k = 0; k < arr2[j].length; k++) { sum += arr2[j][k]; }}
C.
int sum = 0;for(int[] m : arr2){ for(int n : m) { sum += n; }}
Computers and Technology
1 answer:
Delvig [45]3 years ago
3 0

Answer:

int sum = 0;for(int[] m : arr2){ for(int n : m) { sum += n; }}

Explanation:

Option A is wrong because it will throw an ArrayIndexOutOfBoundsException during the last iteration of the first and second loop.

the number of accessible element in the first dimension of arr2 is from 0 to arr2.length-1 but the loop specify 0 to arr2.length which will be the first cause of the error

while that of the second dimension specify 0 to arr2[j].length  instead of 0 to arr2[j].length-1

Option B is also wrong because the expression j-- will decrement the value of j instead of incrementing it and the second dimension specify 0 to arr2[j].length  instead of 0 to arr2[j].length-1 which will also cause an ArrayIndexOutOfBoundsException.

Option C will successfully calculates the sum of all elements arr2.

You might be interested in
What is the most important job of a web server?
attashe74 [19]

Answer:

Provide requested web pages to clients; the other tasks listed there are secondary to that.

6 0
3 years ago
Read 2 more answers
Clickstream tracking tools collect data on customer activities at web sites (true/false)?
Galina-37 [17]

Clickstream tracking tools collect data on customer activities at websites- true.

<h3>what is the website?</h3>
  • A website, often known as a website, is a collection of web pages and associated material that is published on at least one web server and given a shared domain name.
  • The World Wide Web is the aggregate name for all publicly accessible websites.
  • A company's internal website for its workers is an example of a private website that can only be viewed via a private network.
  • Most websites focus on a single subject or objective, including news, education, business, entertainment, or social networking.
  • The navigation of the website, which frequently begins with a home page, is aided by hyperlinks between web pages.

To learn more about website, refer to the following link:

brainly.com/question/9060926

#SPJ4

3 0
2 years ago
Usted repetir la pregunta?<br>O A. Es<br>B. Puede<br>C. Puedes<br>O D. Está​
puteri [66]

Answer:

I believe the answer is B. Puede

5 0
3 years ago
Read 2 more answers
____________improves the understandability of a website, by maintaining similar design elements throughout.
lora16 [44]

Simple and easy user interface design can help the users understand what they can do on the website, without confusion when they are loading on the website.

Best practice on the users experiences can help the users to visit the website easily and get what they want as fast as possible. It is the way to improve a website understandability.

4 0
3 years ago
If Mike saves $160 each month, how much will he save in 12 months? Enter your answer in the box.
denis-greek [22]

Answer:

$1,920

Explanation:

i think its that bc 160 x 12=1,920

im sorry if wrong but if right can i get brainlest?

7 0
2 years ago
Other questions:
  • If you want the date in your document to update each time the document is opened, _____.
    9·2 answers
  • Look at the following Python code:
    11·1 answer
  • What view is In a presentation program displays your slides in full screen mode
    6·1 answer
  • Why does the phrase "compatibility mode” appear when opening a workbook?
    6·2 answers
  • While software vendors generally provide evaluation or demonstration copies of their products, hardware vendors never provide ev
    15·1 answer
  • I need to know thr full number of pie
    8·1 answer
  • 1. Would it be possible for two people to have the same email address? Explain.
    9·2 answers
  • You upgrade a graphics workstation with a HyperThreading-enabled CPU core. You expect the programs on the desktop to run much fa
    12·1 answer
  • A company is completing research and development for software which it is planning to produce in approximately 2 years time. Whi
    7·1 answer
  • How bridges are built over water
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!