Quiz 3 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

All arguments pass by value to functions in C++. True or false?

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A function can be re-used multiple times throughout your program. True or false?

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

C++ allows you to have multiple functions with the same name provided their function signatures are different. True or false?

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

void B(int a)

The variable a is defined as a(n) \_\_\_\_\_\_\_.

A

value parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

void A(int &b)

The variable b is defined as a(n) \_\_\_\_\_\_\_.

A

reference parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A function can be used even if it has not been defined/declared. True or false?

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A local variable cannot be accessed in another function by name and must be passed into the function as an argument. True or false?

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Many functions may have local variables with the same name. True or false?

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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; }

A

value parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

This statement causes a function to end and optionally send a value back to the part of the program that called the function.

A

return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Static local variables are not destroyed when the function returns. True or false?

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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.

A

argument

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In C++ it is possible for a function to return multiple independent values in a single return statement. True or false?

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In a function prototype, the names of the parameter variables can be left out. True or false?

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly