Question
C++ questions Please help Match each of the function prototypes with the best description. 1-int sum(int& total, int n1, int n2); 2-int sum(int n1, int
C++ questions
Please help
Match each of the function prototypes with the best description.
1-int sum(int& total, int n1, int n2);
2-int sum(int n1, int n2);
3-nt genRand();
answers: A- pass by value B- pass by reference C- parameterless
-----------------------------------------------------------------------------
Which of the following are true for default arguments?
Select one or more:
a. They should be placed in both the prototype and function header.
b. They should be placed in the function header only if there is no prototype
c. Any of the function parameters may or may not have default arguments.
d. The parameters with default arguments must come last (to the right) of the ones that don't have default arguments.
e. Default arguments can be either variables or constants
------------------------------------------------------------
A reference variable is a variable that references the memeory location of another variable. Any change made to the reference variable....
(Choose the statement that best completes this sentence.)
Select one:
a. will just change the value stored in the reference variable
b. will be written to a file so it won't be lost
c. will be copied to the variable it references
d. will be lost when the function where it is defined returns
e. will actually be a change to the variable it references.
-------------------------------------------------------------
Select the two correct reasons for using pass by reference from the choices below:
Select one or more:
a. Allow multiple values to be passed back from a function
b. Allow the function to change the values stored in variables passed by reference
c. Reduce the number of arguments that need to be passed into a function
d. Allow multiple versions of a function that only differs in it's parameter list
e. Provide default values for some of the parameters
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started