quiz 6 review

Ace your homework & exams now with Quizwiz!

Given the following function definition: void calc (int a, int& b) { int c; c = a + 2; a = a * 3; b = c + a; } What is the output of the following code fragment that invokes calc? int x = 1; int y = 2; int z = 3; calc(x, y); cout << x << " " << y << " " << z << endl;

1,6,3

What is the output of the following program? #include using namespace std; void doSomething(int&); int main() { int x = 2; cout << x << endl; doSomething(x); cout << x << endl; return 0; } void doSomething(int& num) { num = 0; cout << num << endl; }

2 0 0

What is the output of the following program? #include using namespace std; void doSomething(int); int main() { int x = 2; cout << x << endl; doSomething(x); cout << x << endl; return 0; } void doSomething(int num) { num = 0; cout << num << endl; }

2 0 2

A function ________ contains the statements that make up the function.

definition

A function can have zero to many parameters, and it can return this many values.

only one

If a function is called more than once in a program, the values stored in the function's local variables do not ________ between function calls.

persist

When used as parameters, these types of variables allow a function to access the parameter's original argument.

reference


Related study sets

ATI Fundamentals for Nursing Edition 11.0

View Set

CSCI 301 10/17/2023 - Testing Oracle & Testing Coverage

View Set

APUSH FINAL 1st Semester (Packets of Practice Questions)

View Set

PHR FLASHCARDS ONWARD OPPORTUNITY

View Set