Can you anwser these C++ questions for me thanks, please make sure they are righ
ID: 3874648 • Letter: C
Question
Can you anwser these C++ questions for me thanks, please make sure they are right.
1) When parameters are passed between the calling code and the called function, parameters and arguments are matched by:
a. their relative positions in the parameter and argument lists
b.they are not matched up at all
c.their names
d. their data types
2)
In the function declaration shown, the mechanism used to call this function is known as:
double pow(double base, double exp);
a. pass by name
b. pass by name
c. call by name
d. pass by value
3) What is the value of choice after the following statements?
void getChoice(int& par_choice, in par_count);
int choice, count=3;
getChoice(choice, count);
void getChoice(int& par_choice, in par_count)
{
if(par_count<0)
par_choice =0;
if(par_count = 0)
par_choice=-1;
else
par_choice=99;
return;
}
a.-1
b. 99
c. 3
d. 0
Explanation / Answer
1. When parameters are passed between the calling function, parameters and arguments are matched by
a. Their relative positions in the parameter and arguments.
There is an one - one mapping between arguments passed and parameters present in the function.
2. Mechanism used to call teh function double pow(double base, double exp) is
d. Pass by value
If we use pointers instead, it is known as pass by reference
3. Since the second argument, par_count is greater than 0, par_choice is set to 99. So, choice is 99.
b. 99
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.