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
Kryger [21]
4 years ago
15

What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is

an int initialized to 0. for (int j = 0; j < list.length; j++) if (list[j] < temp) c++;
a. It finds the smallest value and stores it in temp
b. It finds the largest value and stores it in temp
c. It counts the number of elements equal to the smallest value in the list
d. It counts the number of elements in the list that are less than temp
Computers and Technology
2 answers:
BigorU [14]4 years ago
6 0

Answer:

Option D is correct.

Explanation:

Option D is correct because  when the condition  if (list[j] < temp) is tested it only gets true when element in list[] array at <em>jth</em> position is less than the value in <em>temp</em> and after that it increments the value of c by this statement: c++ and so c is incremented from 0 to as much times as much elements in list[] are lesser than temp.

neonofarm [45]4 years ago
4 0

Answer:

d) It counts the number of elements in list that are less than temp        

Explanation:

Lets have a look at the code fragment.

There is a loop variable j which starts from then moves through the array length.

This loop will continue to execute till it reaches the end of the list.

Also the value of j will be incremented by 1 at the end of every iteration.

The variable c will also be incremented by 1 every time the if condition evaluates to true.  

Lets say that temp= 5 c=0 and list has the following elements: 1 2 3 4 5 6

In the first iteration the value of j=0 which is less than array length as array length is 6.

So the control enters the loop body, if statement is checks if the jth index of array is less than value of temp?

   Here list[j]=list[0] = 1

As the value of j is 0 and the element at 0 th index of array is 1

So the condition is true because 1 is less than the value of temp i.e. 5

After this the statement c++ is executed which will increment value of c by 1 so c=1.

So this loop will iterate till the end of the list is reached.

At every iteration it will be checked if the element in the list is less than the value of temp and c will keep counting the number of times this condition evaluates to true.

So it is clear that this code counts the number of elements in the list that are less than temp.

You might be interested in
Which careers use web browsers
oksano4ka [1.4K]
All of the above. If that’s not an option if it’s multiple choice let me know. Everyone uses web browser/the internet no matter the career.
5 0
3 years ago
Points Possible: 6, Points Correct: 4
Pavel [41]

Answer:

Statement 4 is Incorrect

Statement 5 is Incorrect

Explanation:

  • 4 is Incorrect because Save is located in the File Menu
  • 5 is Incorrect because Saving once and making changes afterwards will not save the changes

7 0
3 years ago
Each interior angle of a regular polygon is 150°.how many sides has the polygon​
Digiron [165]

Answer:

12 sides

Explanation:

{(n-2)x180}÷n

150=\frac{(n-2)*180}{n}

150n=(n-2) x 180

150n= 180n-360

150n-180n=- 360

-30n= -360

n= 12

Sides of polygon is 12

4 0
3 years ago
A technician has installed an IPS appliance on the network. Which of the following is the purpose of that installation?
Scrat [10]

Answer:

B

Explanation:

Stands for "Intrusion Prevention System." An IPS is a network security system designed to prevent malicious activity within a network. It is often used in combination with a network detection system (IDS) and may also be called an intrusion detection and prevention system (IDPS).

Like an IDS, an IPS may include hardware, software, or both. It may also be configured for a network or a single system. However, unlike IDSes, intrusion prevention systems are designed to prevent malicious activity, rather than simply detecting it.

When an IDS detects suspicious activity, such as numerous failed login attempts, it may log the IP address. If it detects a suspicious data transfer, it may check the packets against a database of known viruses to see if any any malicious code is being transferred. When an intrusion detected, an IDS compares the activity to a set of rules designed to prevent malicious activities from taking place. For example, when an IDS detects numerous failed logins, it may block the IP address from accessing any network devices. If it detects a virus, the data may be quarantined or deleted before it reaches its destination.

Examples of hardware-based IPSes include Cisco's IPS 4500 Series, IBM's Security Network "GX" systems, and HP's TippingPoint "NX" devices. Software IPS solutions include Check Point's IPS Software Blade and McAfee's Host Intrusion for Desktop.

-techterms.com

5 0
3 years ago
Sandra wants to have her new technology up and running as soon as possible. She is looking for a tool that she can
Dvinal [7]

I would say Microsoft Excel but I am not sure and ms excel is the best way to organize large amounts of data into orderly, logical spreadsheets and charts.

3 0
3 years ago
Other questions:
  • What is working with others to find a mutually agreeable outcome?
    6·1 answer
  • How do you take a screenshot on an iPhone?
    8·2 answers
  • What’s good and bad about having social media?
    14·2 answers
  • Mason is part of a project team that is creating a television advertisement. List one risk the team faces and a strategy for min
    5·1 answer
  • Assume you have an Access database with five different tables, including various pieces of information about your client base. Y
    9·1 answer
  • 15
    9·2 answers
  • Describe the components of a CPU--the CU, ALU, and Cache--and explain how they interact to make the CPU function.
    13·1 answer
  • Define<br>output<br>devices<br>.<br>Give<br>any<br>three<br>examples<br>.<br>3.​
    8·2 answers
  • How did New York Governor Hugh Carey handle Sostre’s situation?
    9·2 answers
  • Describe a way that you can envision using the power of the computer through
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!