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
Effectus [21]
2 years ago
12

What are the benefits of writing functions that use parameters and return List 2 please and explain what is return

Computers and Technology
1 answer:
Ratling [72]2 years ago
3 0

<u>Answer and explanation:</u>

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

<em>public void showName(String name){</em>

<em>    System.out.println("Your name is " + name);</em>

<em>}</em>

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

<em>public String getDouble(int x){</em>

<em>    int y = x * 2</em>

<em>    return y;</em>

<em>}</em>

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.

You might be interested in
The ________ of the operating system enables users to communicate with the computer system. Select one: A. user interface B. mod
Mumz [18]
The user interface of the operating system
8 0
3 years ago
What is the process called that determines how bits are represented on the medium?
Bad White [126]
The process that determines how bits are represented on the medium is called encoding. It is the process of converting a certain data into a particular format that is required for a certain processing need like program execution, data transmission or file conversion.
3 0
3 years ago
Jessica has pinned her favorite applications as icons on her desktop. She always clicks on these icons to work on them. Which us
Hatshy [7]

Answer:

Graphical User Interface (GUI)

Explanation:

Graphical User Interface clicking on various icons to perform a certain functionality. GUI is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces or command line interface where you would have to type to run the program rather than just click it.

7 0
3 years ago
Which command group on the Slide Master tab is used to add headers, footers, and other placeholders to the slide
Vikki [24]

Answer:D

Explanation:

7 0
2 years ago
Read 2 more answers
1. Data in a smart card can be erased
Ostrovityanka [42]

Answer:

false

true

false

true

true

5 0
3 years ago
Read 2 more answers
Other questions:
  • In the process of benchmarking for a variable expense (such as payroll) the typical metrics used are "Total Dollars" and "Dollar
    8·1 answer
  • Why must an rodc be able to connect to at least one windows server 2008 or higher domain controller?
    5·1 answer
  • What is the result when you run the following program?
    12·1 answer
  • If you were setting up a network with 100 nodes and you wanted no more than 25 nodes per segment: what devices and connections w
    9·1 answer
  • Which statement best describes a transition in PowerPoint?
    12·1 answer
  • Which of the following is not a technology that can be used to conserve resources?
    8·2 answers
  • Which country was the first in the world to launch a mass media campaign in response to population growth?
    14·1 answer
  • Why is graphics important in multimedia application <br>​
    11·1 answer
  • What are the benefits of writing functions that use parameters and return? Try to list at least two.
    12·1 answer
  • What are the benefits of building redundancy into a network?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!