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
Vladimir [108]
3 years ago
7

What does the following loop do?int[] a = {6, 1, 9, 5, 12, 3};int len = a.length;int x = 0;for (int i = 1; i < len; i++)if (a

[i] > a[x]) x = i;System.out.println(x);1. Finds the position of the largest value in a.2. Sums the elements in a.3. Finds the position of the smallest value in a.4. Counts the elements in a.
Computers and Technology
1 answer:
Marat540 [252]3 years ago
8 0

Answer:

Option 1: Finds the position of the largest value in a

Explanation:

Given the codes as follows:

  1.        int[] a = {6, 1, 9, 5, 12, 3};
  2.        int len = a.length;
  3.        int x = 0;
  4.        for (int i = 1; i < len; i++)
  5.        {
  6.            if (a[i] > a[x])
  7.                x = i;
  8.        }
  9.        System.out.println(x);

The code is intended to find a largest value in the array, a. The logic is as follows:

  • Define a variable to hold an index where largest value positioned. At the first beginning, just presume the largest value is held at index zero, x = 0. (Line 3)
  • Next, compare the value location in next index. If the value in the next index is larger, update the index-x to the next index value (Line 4 - 8). Please note the for-loop traverse the array starting from index 1. This is to enable the index-1 value can be compared with index-0 and then followed with index-2, index-3 etc.
  • After completion of the for-loop, the final x value will be the index where the largest value is positioned.
  • Print the position of the largest value (Line 10)

You might be interested in
you arrive at a scene where a computer must be seized as evidence. the computer is powered off and has an external usb hard driv
larisa [96]

The first thing that must be done is Thoroughly documenting the state of equipment before it is hidden is critical to adhere to chain-of-custody procedures. Failure to do so will render collected evidence inadmissible.

Security+ can be defined as the entry-level cybersecurity credential offered by the CompTIA non-profit trade association. This is usually the first certification in information security that an IT professional obtains. By having this, you may get more job opportunities, because you are judged as a more competitive candidate.

The CompTIA Security+ exam (SY0-601) is a test that tests an applicant that he or she has the basic knowledge to perform tasks in IT security and work in cybersecurity. The CompTIA Security+ exam is a vendor-neutral exam that tests applicants' knowledge of IT security materials and their ability to perform core security functions.

You can learn more about Security+ here brainly.com/question/17109203

#SPJ4

7 0
1 year ago
If you increase or decrease the font size of one shape, the font size in other shapes will not be affected. True False
const2013 [10]
When you change the size of an individual shape in a SmartArt graphic, the remaining shapes may adjust their sizes and positions, depending upon the layout of your SmartArt graphic and the amount of available space. In some cases, only the individual shape that you resize will change. In others cases, corresponding shapes will change their size as well.
8 0
3 years ago
My Sony flatscreen tv's remote won't work. I can't turn up the volume or use buttons other than turning it on. I can't open the
sashaice [31]
Get a universal remote, maybe you spilt something
4 0
3 years ago
A metallic reflector provides what kind of bounced light
katen-ka-za [31]
<span>a reflector is an improvised or specialised reflective ... Also known as plane reflectors, "flats" or bounce boards, this kind of reflector is located independent of a light source; ... Hence bounce lighting may provide either the primary or secondary (fill) light source, depending on its intensity.</span>
5 0
3 years ago
Structural Styles
Eva8 [605]

Solution :

For Structural Styles the browser's background color.  

html {

background-color: rgb(151, 151, 151);

}

For creating style rule for the background color and setting the body text

body {

background-color: rgb(180,180,223);

font-family: Verdana, Geneva, sans-serif;  

}

For displaying all the h1 as well as h2 headings with the normal weight.

h1, h2 {

font-weight: normal;

}

For create the style rule for all the hypertext link that is nested within the  navigation list  

nav a {

text-decoration: none;

}

For creating style rule for footer element which sets the color of the text to color white and the color of the background to as rgb(101, 101, 101). Also setting the font size to 0.8em. Placing the footer text to horizontally center , and setting the top/bottom of the padding space to 1 pixel.

footer {

background-color: rgb(101, 101, 101);

font-size: 0.8em;

text-align: center;

color: white;

padding: 1px 0;

}

/* Structural Styles At one place*/

html {

background-color: rgb(151, 151, 151);

}

body {

background-color: rgb(180,180,223);

font-family: Verdana, Geneva, sans-serif;  

}

h1, h2 {

font-weight: normal;

}

nav a {

text-decoration: none;

}

footer {

background-color: rgb(101, 101, 101);

font-size: 0.8em;

text-align: center;

color: white;

padding: 1px 0;

}

3 0
3 years ago
Other questions:
  • Which of these definitions BEST explains what plagiarism is:
    14·2 answers
  • The processing of data in a computer involves the interplay between its various hardware components.
    9·1 answer
  • This is in government
    15·1 answer
  • ​Client/server computing is​ a: A. network that connects sensors to desktop computers. B. distributed computing model where clie
    12·1 answer
  • As technology advances, does technology become more of less complex?
    14·1 answer
  • Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, the
    15·1 answer
  • Http://moomoo.io/?server=8:16:0
    6·2 answers
  • 3. Choose the statement that best describes a ray. A ray extends forever in both directions. B ray is a part of a line with two
    10·1 answer
  • What lets you do many things, like write book reports and stories?
    14·2 answers
  • Which of the following is the system of rules and structure governing
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!