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
Arlecino [84]
3 years ago
8

Consider the following method, which is intended to return an array of integers that contains the elements of the parameter arr

arranged in reverse order. For example array containing (-5, 3, 2, 7) then a new array (-5, 3, 2, 7) contains should be returned and the parameter are should be left unchanged .
public static int[] reverse(int) arr)
Intl new new intarr.length);
for (int k = 0; K arr.length: )
* Bissing statement / return newer;

Write down the statements that can be used to replace / Missing statement so that the method works as intended?
Computers and Technology
1 answer:
Gennadij [26K]3 years ago
6 0

Code:

public static int[] reverse(int [] arr){

Int [] newArr = new int[arr.length];

for (int k = 0; k<arr.length;k++){

/*Missing statement */

}

return newArr;

Answer:

Replace the comment with:

newArr[k] = arr[arr.length-k];

Explanation:

Required

Complete the code

In the given code:

The first line of the given code defines the method

public static int[] reverse(int [] arr){

The next line declares array newArr withe same length as array arr

Int [] newArr = new int[arr.length];

The next line iterates through the elements of array arr

for (int k = 0; k<arr.length;k++){

The /* Missing statement */ is then replaced with:

newArr[k] = arr[arr.length-k];

The above statement gets the elements of array arr in reversed order.

This is so because, as the iteration iterates through array arr in ascending order, arr.length-k gets the element in reversed order

You might be interested in
Things stored in a computer ram __________.
kirza4 [7]
B.cannot be accessed from the GUI
8 0
3 years ago
What are the advantages and drawbacks of using solar energy
Ray Of Light [21]

upfront price, but dependent on how long you use it you will save money, also the power it provides per square inch is low but that will be solved with time.

5 0
3 years ago
How to transfer audio files from computer to android?
fenix001 [56]
U can use Bluetooth connect your computer to the android. <span />
5 0
4 years ago
I need to calculate the % of Grand Total on Microsoft Excel, but can't for the life of me remember how to do that. Help would be
vagabundo [1.1K]

Answer:

You need to first use the Sum function to add up all the costs of September.

Then divide each September cost by the grand total that you got. After that format the last column to be percentages.

Look at the attached file for the formulas used.

Download xlsx
4 0
3 years ago
Using the flowchart below, what value when entered for Y will generate a mathematical error and prevent our flowchart from being
nexus9112 [7]

Answer:

The answer is the last choice that is "None of these values will produce a mathematical error".

Explanation:

In this question, the above given choice correct because neither of the flowchart procedures could trigger a mathematical error. This error could not be induced by multiplication, addition and subtraction, and the only division by 15. It is the only divide by 0, that's why the above flowchart will produce a mathematical error.

4 0
4 years ago
Other questions:
  • What are the two houses in Congress?
    5·1 answer
  • What features do you think that a smart fridge should have? Please give me a quick answer! And in detail.
    13·1 answer
  • How do you access the dark web? What are the negatives of doing this?
    14·1 answer
  • Do you think cyber-bulling is more damaging, as damaging, or less damaging than in-person bullying? Why?
    11·2 answers
  • Which is the most used operating system? A. Windows B.Linux C.Leopard D. DOS
    14·2 answers
  • We have stressed the need for an operating system to make efficient use of the computing hardware. When is it appropriate for th
    11·1 answer
  • Free 35 points!!!
    11·2 answers
  • What department is cyber security
    6·2 answers
  • Why is it essential for every person living in the 21st century to have a computer​
    9·1 answer
  • What are three ways digital identity is created and kept up? (open answer)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!