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
Bezzdna [24]
3 years ago
6

Exercises: Solve the following problems on paper and bring your sheet of paper to your section on Thursday: Consider the followi

ng method: public static void arrayMystery(int[] array) { for (int i = 0; i < array.length - 1; i++) { if (array[i] < array[i + 1]) { array[i] = array[i + 1]; } } } Indicate what values would be stored in the array after the method arrayMystery executes if each integer array below is passed as a parameter to it. a. input = {2, 4} b. input = {1, 3, 6} c. input = {7, 2, 8, 4} d. input = {5, 2, 7, 2, 4} e. input = {2, 4, 6, 3, 7, 9}
Computers and Technology
1 answer:
Volgvan3 years ago
4 0

Answer:

Hi Lzvcorri! Based on the inputs, we can expect the answers:

a. [4, 4]

b. [3, 6, 6]

c. [7, 8, 8, 4]

d. [5, 7, 7, 4, 4]

e. [4, 6, 6, 7, 9, 9]

Explanation:

For a, the input is {2,4} so the array length is 2, and the loop will run for array.length - 1. So the first run with this array will see if array[i] (i=0 as initially set in the for loop with the statement "for (i=0;)") is less than the value in the array after it, array[i+1]. Since 2, is less than 4, it will assign the value of 4 in the first array index as per this condition being met (array[i] = array[i + 1];). Similarly, if you trace the execution of the program with the remaining inputs b, c, d, and e, you should expect the resultant array as in the answer above.

You might be interested in
Tablets combine the features of which two types of devices?
VikaD [51]
A tablet<span> is a wireless, portable personal computer with a touchscreen interface. The </span>tablet<span> form factor is typically smaller than a notebook computer, but larger than a smartphone.
</span>
5 0
3 years ago
Que se trata el RUC<br>​
mariarad [96]
No se senor i no sure
7 0
3 years ago
Assume that an int variable counter has already been declared. Assume further a variable counterPointer of type "pointer to int"
Triss [41]

Answer:

Following are the statement:

counterPointer = &counter;

Explanation:

The following statement is correct because in the question it is given that there is an integer data type variable i.e., "counter" and there is another integer data type pointer variable i.e., "counterPointer" and finally we write a statement in which the pointer variable points to the integer variable.

5 0
3 years ago
Can you make a phone app with angular?.
emmainna [20.7K]

Answer:

yes

Explanation:

4 0
2 years ago
What are the values of the digital signal when sending in physical layer?
irina [24]

Answer:

A waveform that switches representing the two states of a Boolean value (0 and 1, or low and high, or false and true) is referred to as a digital signal or logic signal or binary signal when it is interpreted in terms of only two possible digits.

8 0
2 years ago
Other questions:
  • What class of attacks use innovative attack tools and once a system is infected it silently extracts data over an extended perio
    6·1 answer
  • Need help writing a program that reads a string if the option "E" (enter a string) is chosen, and checks if parentheses (), brac
    14·1 answer
  • Which type of chart is used to chart progress over time?
    10·1 answer
  • Routers do not forward broadcast packets.A. TrueB. False
    7·1 answer
  • Communication of a message between two processes implies which of the following? (A) Synchronization (B) Atomic operation (C) Bl
    11·1 answer
  • Help me with this, please. Are vacuum cleaners, Cd players, and telephones considered computers? Do they store any data or proce
    8·2 answers
  • Why is simplicity important in navigation design?
    13·1 answer
  • Whats the most popular social networking in the philippines?
    10·1 answer
  • The Review tab in Microsoft Publisher provides two groupings called _____. Proofing and Language Spell Check and Research Proofi
    6·1 answer
  • When converting text to a table, which feature should be used?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!