Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Which of the following could be a method heading for a member method that return

ID: 3788253 • Letter: W

Question

Which of the following could be a method heading for a member method that returns an array? int [] void DoSomething() int [] DoSomething() void int [] DoSomething() void DoSomething[] If an array is to be sent to a method, which of the following is a valid heading for a method? void DisplayOutput(double [] anArray) void DisplayOutput(double anArray) void DisplayOutput(double [10] anArray) void DisplayOutput(double anArray [10]) Which of the following is a valid example of calling a method and sending it an array argument? DisplayArrayContents(int [] anArray); DisplayArrayContents(anArray[10]); DisplayAirayContcnts(anArray); DisplayArrayContcnts(int [10] anArray); If you do not know the size of the array needed, you can create an array large enough to hold any number entries and tell users to enter a predetermined sentinel value after they enter the last value. Using this approach: requires that you increment a counter as values are entered so that you know how many elements are stored in your array is preferred to defining a static sized array. requires that you dimension the array to hold at least 100 entries. requires the array be defined to hold string elements.

Explanation / Answer

Q1.
Collection can be divided into two parts:
linear and non-linear

List is linear collection
Set, Map are non-linear

Q2.
Ans: a. Object

Object class is the baase class of all other classes in Java

Q3.
Ans: b. 99
Array index starts from 0 to n-1, n is the size of an array

Q4. Ans: b. num[2] = 11
index of third element is (3-1) = 2

Q5.
Ans: b. 88

Loop starts from i = anArray.length-1 = 5, and anArray[5] = 88

Q6.
Ans: c. int[] DoSomething()

Q7.
Ans: a. void DisplayOutput(double[] anArray)

Q8. Ans: b. DisplayArrayContent(anArray)

Q9. Ans: a. requires hat an increment a counter value

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote