Ask Question
19 November, 15:09

Suppose you wish to write a method that returns the sum of the elements in partially filled array. Which is the best choice for a method header? Group of answer choices public int sum () public int sum (int[] values, int currSize) public int sum (int[] values) public int sum (int[] values, int size, int currSize)

+5
Answers (1)
  1. 19 November, 15:40
    0
    The Method header to this question is "int sum (int[] values, int currSize) ".

    Explanation:

    According to the question, It is defined that choose the correct option which creates a method header sum and returns the sum of the array element. In given options, we choose option second because in this option method return type is int and use an integer variable that is "currSize" which calculate the sum and return its value and other option are not correct that can be described as:

    In the first option, we create a method but we do not pass any parameter so it will not calculate the sum of array elements. In the third option, we create a method but we pass only one parameter that is an array. So, it will not calculate the sum of array elements correctly. In the fourth option, In this method, we pass three parameters that are "values, size and currSize" in which the size parameter not use.

    That's why the answer to this question is option second which is "int sum (int[] values, int currSize) ".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose you wish to write a method that returns the sum of the elements in partially filled array. Which is the best choice for a method ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers