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
In this problem you will test and analyze the following sorting algorithms: Selection, Bubble, Insertion, Merge, and Quick. You
Tpy6a [65]

Answer:

1) Selection, bubble and insertion sort requires no moves in the sorted array because there will be n comparisons in the array and no swapping would take place after each comparison so zero moves.

2) Bubble and insertion sort result in 999 comparisons as we are required to iterate only one time over the array. this can be easily explained from the diagram as in bubble sort all the elements will be in their sorted position so each element will be encountered only once.

3) In selection sort, any element is compared with all the elements and accordingly smaller is paced first so in the reverse sorted array there will be at least n^2 comparisons so n^2 moves.

4) in merge sort an array is always divided into n nos of parts and then sorted so in worst case as well as best case the array will be divided so same numbers of moves.

5 0
3 years ago
True or False: In Google Cloud IAM: if a policy applied at the project level gives you Owner permissions, your access to an indi
vekshin1

Answer:

The following statement is False.

Explanation:

When any user or person using IAM platform of the Google Cloud that give permission to the user for the particular granular access. It provides user control by setting IAM policies of what access to which services.

That's why it not restricted to view if the user applies for the restrictive rules to that resources.

8 0
3 years ago
The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two prec
vlabodo [156]

Answer:

In Python:

def fib(nterms):

   n1, n2 = 1, 1

   count = 0

   while count < nterms:

       term = n1

       nth = n1 + n2

       n1 = n2

       n2 = nth

       count += 1

   return term

Explanation:

This line defines the function

def fib(nterms):

This line initializes the first and second terms to 1

   n1, n2 = 1, 1

This line initializes the Fibonacci count to 0

   count = 0

The following while loops gets the number at the position of nterms

<em>   while count < nterms: </em>

<em>        term = n1 </em>

<em>        nth = n1 + n2 </em>

<em>        n1 = n2 </em>

<em>        n2 = nth </em>

<em>        count += 1 </em>

This returns the Fibonnaci term

   return term

7 0
3 years ago
A company has a network printer that is utilzed by several departments. Although the printer shows online and other departments
Aloiza [94]

Answer: c. The security settings for the print spooler need to be modified to include the department.

Explanation:

The print spooler makes Windows computer enable to interact with the printer, and to commands the printer for print jobs .

If all the other departments can access the printer,  but not the accounting group, then the technician should check the security settings for the print spooler and modify it accordingly to include the accounting group  .

Hence, the correct answer is c. The security settings for the print spooler need to be modified to include the department.

4 0
4 years ago
Which key on a laptop keyboard is often used to help pair a mobile device with another device for communication purposes?
Nonamiya [84]

Bluetooth on a laptop is often used to help pair a mobile device with another device for communication purposes.

  • Bluetooth

<u>Explanation:</u>

A Bluetooth gadget works by utilizing radio waves rather than wires or links to associate with your mobile phone, cell phone or PC. Bluetooth is a remote innovation standard utilized for trading information among fixed and cell phones over short separations utilizing short-wavelength UHF radio waves in the modern, logical and restorative radio groups, from 2.400 to 2.485 GHz, and building individual zone systems. For instance, on Windows, either right-click the Bluetooth symbol in the notice zone or go to the Control Panel to discover the Hardware and Sound > Devices and Printers page. At the point when the gadget shows up in the rundown of Bluetooth and different gadgets, select it to associate (pair) it to the workstation.

7 0
4 years ago
Other questions:
  • A newspaper publishes a negative editorial on how local politicians are dragging their feet in building a new bridge. Select the
    5·2 answers
  • A _______ is a piece of computer hardware used for the modulation and demodulation of data between digital and analog formats.
    10·1 answer
  • What is a organisation in office technology
    7·1 answer
  • Match the terms related to the web with their explanations
    6·1 answer
  • Write an application that displays a series of at least five student ID numbers (that you have stored in an array) and asks the
    5·1 answer
  • What are the reasons why is it necessary to evaluate online sources and content?
    6·1 answer
  • On the Excel Ribbon, click the Data tab in the Sort &amp; Filter Group, and then click the Sort button to conduct a _____ sort.
    8·1 answer
  • Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he o
    10·1 answer
  • Which sentence is an example of an I-statement?
    6·1 answer
  • How can touch typing increase productivity of a business?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!