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
Practising some questions for board exams for class 12 python,pls help with detailed answer
poizon [28]
I do t know the answer to this but i think tou can firger it iut food luck
3 0
3 years ago
Whats the next lyric,i baked you a pie,pie,pie
eduard
“oh boy what flavor”
4 0
3 years ago
Read 2 more answers
________ is used to install and update software, backup, and restore mobile devices, wipe employer software and data from device
erastovalidia [21]

Answer: MDM softwares

Explanation:

Here MDM refers to mobile device management software which provides people with the facilities of updating, installing creating backup of various mobile devices within an organisation. Moreover these software's provides tools for proper monitoring and to report their usage across various independent mobile device users. MDM is often used or interconnected with the term BYOD(Bring your own device), whereby employees of an organisation bring their own mobile devices and they are being managed by a MDM software centrally.

8 0
3 years ago
Have you ever been told sensitive or confidential information that made you uncomfortable? How did you deal with the situation?
Korvikt [17]
I would tell said individual to stop what they’re trying to tell me because if it’s not stuff I should know about or want to hear about then I don’t wanna hear any of it
7 0
3 years ago
An array of strings , names , has been declared and initialized . write the statements needed to determine whether any of the th
OLEGan [10]
#Python

hasempty = False
for name in names:
   if ( not name ):
      hasempty = True
      break  # speed things up
3 0
3 years ago
Other questions:
  • What is a valence orbit?
    13·2 answers
  • Write a C program that has the following statements: int a, b; a = 10; b = a + fun(); printf("With the function call on the righ
    12·1 answer
  • A multiplicative inverse of 3 modulo 5 is any integer a such that 3 a ≡ 1 (mod 5) , hence for some a ∈ Z5 .
    12·1 answer
  • Proxy servers and ACLs on network devices are examples of non-security devices with security features, while firewalls and IDS/I
    8·1 answer
  • Graphic design includes typefaces, page layouts, corporate logos, and product packaging. Which modern graphic designer is best k
    14·2 answers
  • A trust domain is defined as Select one: a. The agreed upon, trusted third party b. A scenario where one user needs to validate
    5·2 answers
  • 1. Insert a Header that has the following in excel​
    14·1 answer
  • My game is telling me to "Press any key." Where is the "any" key?????
    13·1 answer
  • You need to install Windows on a new computer. You also need to replace a motherboard in another computer, and both tasks need t
    14·2 answers
  • List at least 5 disadvantages caused by computer viruses?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!