Quiz 3 Flashcards
All arguments pass by value to functions in C++. True or false?
False.
A function can be re-used multiple times throughout your program. True or false?
True.
C++ allows you to have multiple functions with the same name provided their function signatures are different. True or false?
True.
void B(int a)
The variable a
is defined as a(n) \_\_\_\_\_\_\_
.
value parameter
void A(int &b)
The variable b
is defined as a(n) \_\_\_\_\_\_\_
.
reference parameter
A function can be used even if it has not been defined/declared. True or false?
False.
A local variable cannot be accessed in another function by name and must be passed into the function as an argument. True or false?
True.
Many functions may have local variables with the same name. True or false?
True.
In the function definition below, the bolded red variables are known as what kind of variable?
int somefunction(
int value1, int value2, int value3) {
result = value1 * (value2 + value3) % value2;
result *= 7;
return result + 3;
}
value parameters
This statement causes a function to end and optionally send a value back to the part of the program that called the function.
return
Static local variables are not destroyed when the function returns. True or false?
True.
int main(){
int sum = 0;
CalculateSum(
sum);
std::cout << sum << std::endl;
}
The bolded variable sum is best referred to as a(n) \_\_\_\_\_\_\_\_
when it is used as input to a function.
argument
In C++ it is possible for a function to return multiple independent values in a single return statement. True or false?
False.
In a function prototype, the names of the parameter variables can be left out. True or false?
True.