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
Olin [163]
3 years ago
15

The following procedure is intended to return the number of times the value val appears in the list nylist. The procedure does n

ot work as intended, Line 1: PROCEDURE countNumoccurences (mylist, val) Line 2: Line 3: FOR EACH item IN mylist Line 4: Line 5: count = 0 Line 6: IF(item = val) Line 7: tine 8: count count + 1 tine 9: Line 10: Eine 11: RETURN (count) Line 12:) Which of the following changes can be made so that the procedure will work as intended?
A. Changing line 6 to IF(item = count)
B. Changing line 6 to IF(myList[item) - val)
C. Moving the statement in line 5 so that it appears between lines 2 and 3
D. Moving the statement in line 11 so that it appears between lines 9 and 10 ->
Computers and Technology
2 answers:
Charra [1.4K]3 years ago
8 0

Answer:

option C is the answer....

allochka39001 [22]3 years ago
3 0

Answer:

C. Moving the statement in line 5 so that it appears between lines 2 and 3

Explanation:

Given

The attached procedure

Required

What should be modified

The problem in the procedure is on line 5

i.e. count = 0

This line is within the loop, and this means that the count variable is initialized to 0 each time the loop is repeated.

To solve this, the count variable has to be removed from the loop to somewhere before the loop.

<em>Hence, option (c) is correct</em>

You might be interested in
Your friend is an intern at the local Department of Health and needs to prepare a report about the recent activity of the influe
Butoxors [25]

Answer:

#include<bits/stdc++.h>

using namespace std;

int main(){

  // Defining Variables

  int no_of_weeks;

  int total_cases = 0;

  //Declaring Vector of Pair of Integer and string

  std::vector<pair<int,string>> data;

  // Taking Input for the Number of Weeks

  cout<<"Enter No. of Weeks\n";

  cin >> no_of_weeks;

  // Running the Loop for no_of_weeks times

  for(int i = 0; i < no_of_weeks ; i++){

      int A,B,C;

      // Taking Input for different types of flus

      cout<<"Enter No. of Cases of Flu A, B, C for week" << i + 1 << " seperated by space : \n";

      cin >> A >> B >>C;

      // Adding all the cases in a week

      int cases_in_a_week = A + B + C;

      // Updating total cases

      total_cases += cases_in_a_week;

      // Declaring the level variable

      string level;

      // Updating the level of the week corresponding to each case

      if(cases_in_a_week < 500) level = "Low";

      else if(cases_in_a_week >= 500 && cases_in_a_week < 2000) level = "Moderate";

      else level = "Widespread";

      // Storing the Week's information by using a vector of pairs

      // in which pair's first is the number of cases which is of type int

      // while the second is the level of the flu which is of the type string

      data.push_back(make_pair(cases_in_a_week,level));

  }

  // Linking the stdoutput to the flu_report.txt file

  // this also creates the file with the same name if it doesn't exists

  freopen("flu_report.txt", "w", stdout);

  // Printing the respective output data with Bar Chart of stars for each level

  for(int i = 0;i < no_of_weeks ; i++){

      //printing the week no. and number of cases

      cout<<i+1<<" "<<data[i].first<<" "<<data[i].second<<" |";

      //calculating the number of stars

      int stars = data[i].first/250;

      //printing the stars of the bar chart

      for(int j = 0; j < stars ; j++) cout<<"*";

      cout<<endl;

  }

  //printing the total number of cases

  cout<<total_cases;

}

Explanation:

3 0
3 years ago
Read 2 more answers
Why does my Chromebook keep on turning my new tabs into clever tabs?
Alina [70]

Answer:

Ok, so it's not letting me submit a text response, so I'll attach an image of my answer.

Explanation:

6 0
2 years ago
Read 2 more answers
During an interview, your non-verbal communication (body language, gestures, tone of voice, speed of talking,
kompoz [17]

Answer:

True

Explanation:

People will judge you based upon your non-verbal communication. If your non-verbal communication is bad then you might not get the job.

8 0
4 years ago
In popular usage and in the media, the term ________ often describes someone who breaks into a computer system without authoriza
ch4aika [34]
The answer here is hacker
6 0
3 years ago
Adam, a flower shop owner, wants to drive phone calls to his store. Which Adwords tool should he use to track how many calls res
Kipish [7]

Answer:D)Conversion tracking

Explanation:Conversion tracking is the tool that helps the user to know about the interaction of the ad given by him with customer. It helps in the tracking in the ways like calls from ads, call conversion importing,mobile website gaining the number of clicks etc.

Thus,  Adam needs to use the conversion tracking tool which for driving the calls towards his store.He can track the effectiveness of the ad which drives the calls.

Other options given are incorrect because they cannot keep the record of the  ads seen by the customer with the help of tracking. Thus the correct option is option(D).

8 0
3 years ago
Other questions:
  • Like this post if u hate edhesive
    6·1 answer
  • Write a statement that computes the square root of a variable called discriminant
    11·1 answer
  • A mobile device is freezing almost daily. The device remains powered on and the screen illuminated. The user restarts the device
    13·1 answer
  • In which encryption strategy is the plaintext encrypted one character at a time and each encrypted character depends on that sin
    14·1 answer
  • In a stream channel what is deposited first?
    7·1 answer
  • If an individual receives 1.8 mGy while standing 4 ft from a source of radiation for 2 minutes, which of the following option(s)
    9·1 answer
  • Write an Assembly program in MIPS that does the following:
    7·1 answer
  • WOULD SOMEONE PLEASE ANSWER THIS IVE ASKED TWICE ALREADY!
    6·1 answer
  • An articulated robot has a T-type wrist axis that can be rotated a total of 2 rotations (each rotation is a full 3600 ). It is d
    15·1 answer
  • Draw a flowchart for an algorithm which calculates how much money a student will need per week to buy a meal and two drinks each
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!