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
A dual looped Fibre Channel drive system is theoretically capable of transferring data at a rate of _____.
Anna007 [38]

Answer:200 MBps

Explanation: Fibre channel are those channel that work with the data transfer protocol at the rate of high speed.They work on the connection that are based on the links and loops or share any other form of point to point connection.

It is measured that theoretically the speed of the dual looped FC is supposed to be 200 MBps rate having the two loop form connection.

4 0
3 years ago
45, 78, 23, 12, 63, 90, 38, 56, 88, 15 Using the sequential search as described in this chapter, how many comparisons are requir
Alecsey [184]

Explanation:

By using the sequential search we find the following results.

  • The first key is 90 and its comparison number is 6.
  • The second key is 14 and its comparison number is 10.
  • The third key is 45 and its comparison number is 1.
  • The fourth key is 23 and its comparison number is 3.
  • The fifth key is 5 and its comparison number is 10.
8 0
3 years ago
In the 2007/2010 version of Paint, which of the following tools are located in the View tab? (Select all that apply.)
zaharov [31]
The answers are full screen and gridlines.
7 0
4 years ago
Your first project as the new web designer at Smart Design is to increase web traffic to help boost web orders. Before you begin
Allushta [10]

Answer:

Looking at the website analytics helps you to optimize your content based on users’ interests, thus making your website more effective and also increasing your website traffic.

Explanation:

The website data analytics tools will provide me with a lot of information about the actual users of the site like their behaviors, age, demographics, gender. I will get to know:

  • What they do on the website
  • What they like about the site
  • Features they don't use on the website.

These will help me to further optimize the website to meet the taste of the users, which will help boost more traffic on the website.

7 0
3 years ago
Read 2 more answers
HELP ASAP- YOU GET BRAINLIEST!!
agasfer [191]

Answer:

BLOb

Explanation:

Binary Large Objects (BLOb) data is capable of storing data in the form of images, audio, and video clips.

3 0
4 years ago
Other questions:
  • Please answer quick:))))
    7·1 answer
  • Another important mode, XTS-AES, has been standardized by the __________ Security in Storage Working Group. a. IEEE b. ITIL c. N
    9·2 answers
  • Which of the following rules should be used to keep the appropriate distance between your vehicle and the vehicle in front of yo
    10·2 answers
  • Makes it possible to distribute both power and data using ethernet cabling. select one:
    12·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • What role/service is windows 2012 server backup part of?
    5·1 answer
  • Lập trình web truy vấn csdl và hienr thị ra màn hình danh sách các bản ghi
    15·1 answer
  • How do you change your grade level
    10·1 answer
  • CHALLENGE ACTIVITY
    6·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!