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
horrorfan [7]
3 years ago
8

Given the following function definition, what modifications need to be made to the search function so that it finds all occurren

ces of target in the array? int search(const int array[], int target, int numElements) { int index=0; bool found=false; while((!found) && (index < numElements)) { if(array[index] == target) found=true; else index++; } if(found==true) return index; else return -1; } a. Add another parameter to indicate where to stop searching b. Add another parameter to indicate where to start searching c. This already can find all occurrences of a given target d. Have the function return the whole array
Computers and Technology
1 answer:
Naddika [18.5K]3 years ago
7 0

Answer:

The answer is "Option b".

Explanation:

In the given question, a function "search" is defined. That searches element that is passed in the function by parameter. To search more quickly we must add another parameter in the function. and other options are not correct that can be described as:

  • In option a, We add another element in parameter to start searching not to stop.
  • In option c, The function can not find an element that occurs in the array target.
  • In option d, Function will not return array it will return only index value.

You might be interested in
A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields
Alex Ar [27]

Answer:

Written in Python:

dollars = int(input("Amount: "))

numFive = int(dollars/5)

numOnes = dollars%5

print(str(dollars)+" yields "+str(numFive)+" fives and "+str(numOnes)+" ones.")

Explanation:

This line prompts user for input

dollars = int(input("Amount: "))

This line calculates the number of 5 that can be gotten from the input. This is done using integer division

numFive = int(dollars/5)

This line gets the remaining ones. This is done by using the modulo sign to get the remainder when input is divided by 5

numOnes = dollars%5

This line prints the required output

print(str(dollars)+" yields "+str(numFive)+" fives and "+str(numOnes)+" ones.")

4 0
3 years ago
How do you know a resource is credible
Alisiya [41]

Answer:

There are several main criteria for determining whether a source is reliable or not.

1) Accuracy. Verify the information you already know against the information found in the source

2) Authority. Make sure the source is written by a trustworthy author and/or institution

3) Currency

4) Coverage

Explanation:

5 0
3 years ago
When one makes a social media post, what happens on other devices with the same app?
victus00 [196]

Answer:

An alert appears on the other devices

Explanation:

On social media platforms, whenever some one make a post, all the person who are using that social media app and present in the friend circle of that particular person receive an alert containing the information of the post.

The alert that received by different users on a social media platform is known as Notification. This notification is a type of text, in which the activity performed by post creator is mentioned, this text is received with the tone called notification tone.

The purpose of the alert is to informs the friends who are using that social media platform that a post has been published by someone.  

8 0
4 years ago
Part A [10 points] Create a class named Case that represents a small bookbag/handbag type object. It should contain: Fields to r
Dafna11 [192]

Answer:

class Case //Case class

{

String owner_name,color; //members to store information name and color

Case(String name,String color) //constrictor with two parameters

{

this.owner_name = name; //members initialization

this.color = color;

}

public String getName() //to get name

{

return owner_name;

}

public String getColor() //to get color

{

return color;

}

public String toString()//override string method

{

return "Case Owner: " + owner_name + ", " + "Color: "+ color;

}

}

class Main //test class

{

public static void main(String args[])

{

String na,color;

Case c = new Case("Joy","Green"); //create instance of class Case and set constructor parameters

na = c.getName();

color = c.getColor();

System.out.println(c);//print statement tp print instance of a class

System.out.println(c.toString()); //print with override toString

}

}

Explanation:

5 0
3 years ago
Programmers use an Integrated Development Environment (IDE) to write software programs, because:
Natali [406]

Answer:

A) It simplifies the process by providing a single user interface for multiple software tools.

Explanation:

6 0
3 years ago
Other questions:
  • The Hazard Communication Standard, commonly called the “Right-to-Know” law, gives you the right to know what information?
    10·1 answer
  • Which employees work directly with customers, helping them make deposits and withdrawals?
    14·2 answers
  • Which pattern is produced by the following code? for (int i = 1; i &lt;= 6; i++) { for (int j = 6; j &gt;= 1; j--) System.out.pr
    6·1 answer
  • Can you see it now ivy97? I've posted it again.
    8·1 answer
  • To use an imported image, simply drag it from the desktop onto the stage. true or false
    15·2 answers
  • If you are signed into a Microsoft account and need to sign into another one, click ____ on the list arrow next to Your Name in
    8·1 answer
  • Which of these terms is a design principle?
    7·1 answer
  • Which of the following is true of a procedure? Check all that apply.
    10·2 answers
  • Un comerciante de régimen código para comprar mercancías gravadas a un comerciante de régimen simplificado precio de venta al pú
    5·1 answer
  • Answer pleaseeeeeeeeeee!
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!