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]
3 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]3 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]3 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
If an application written for an earlier version of Windows doesn't run correctly the operating system can emulate its own older
n200080 [17]

Answer:

The answer is b) Right-clicking the program icon, clicking Properties, and then applying the required settings on the Compatibility tab.

Explanation:

If you have to run an application on a specific operating system, you have to configure the compatibility by accessing in its Properties, then Compatibility tab, and configure the operating system properly.

7 0
3 years ago
Transparency is an important concept in policies related to the handling and use of customer data. Organizations should be trans
Tpy6a [65]

Answer: (C) Response controls

Explanation:

  According to the given question, the response control is not the necessary element while handling the users or customer data as compared to all the other given options that is individual participation, data minimization and the purpose specification.

  • The response control is basically used for exchange the data or any information in an organization but the main disadvantage is that they share all the response and information as they not wait for the request from the users.
  • The all the three other given options expect response control are the important element for handling the customer data as it helps in maintaining the Personal information.  

 Therefore, Option (C) is correct answer.  

6 0
3 years ago
You must lower your high beams when within how many feet of an approaching vehicle?
drek231 [11]

2000 feet of any vehicle

7 0
3 years ago
Who was the first president
Firlakuza [10]
George Washington was the first president of the United States that is your answer
4 0
3 years ago
Read 2 more answers
Both successors to C++, _____ , by Sun Microsystems, and _______, by rival MicroSoft, are very similar.
Tanzania [10]

Answer: Java and Forth

Explanation:

   C ++ and Java are comparatively similar language which are composed statically, unequivocally, and obviously. Both language are the object-oriented and planned with the semi-interpretation and run-time during the compilation of the time.

Both uses the curly braces and also they are very similar language as compared with c# and c. Both the successors in the C++ , java and sun micro-system are similar in terms of Microsoft.

 

8 0
3 years ago
Other questions:
  • what tool can a student use to make sure his or her work paper does not take credit for someone else's work ?
    5·1 answer
  • Choose two browsers and compare their security features.
    5·1 answer
  • What are the different ways to represent compounds? Check all that apply. a structural formula a ball model a space-filling mode
    13·2 answers
  • What are the consequences of plagiarism?
    7·2 answers
  • State why hexadecimal is used to display the error code
    11·1 answer
  • You should always assign the Needs Met rating before assigning the Page Quality rating, T or F ?
    6·2 answers
  • When Adobe Photoshop was released for the first time? A: 1984 B: 1990 C: 1991 D: 1992
    8·1 answer
  • Arrange the binary number in increasing order of their arithmetic output in the decimal number system ?
    9·1 answer
  • What are the steps for creating a bookmark? 1. Place the insertion point where the bookmark should appear. 2. Click the tab. 3.
    12·1 answer
  • What action should you take if you become aware that sensitive compartmented information has been compromised
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!