EOC STUDY GUIDE PT.2
Functions
1. A collection of statements that performs a specific task is a(n)
a. infinite loop
b. variable
c. constant
d. function
e. decision
2. A function __________ contains the statements that make up the function.
a. prototype
b. definition
c. call
d. expression
e. parameter list
3. A function can have no parameters, one parameter, or many parameters and can return
__________ value(s).
a. zero to many
b. no
c. only one
d. a maximum of ten
e. None of these
4. A function is executed when it is
a. defined
b. prototyped
c. declared
d. called
e. None of these
5. This type of variable is defined inside a function and is not accessible outside the
function.
a. global
b. reference
c. local
d. counter
, e. None of these
6. The value in this type of variable persists between function calls.
a. global
b. internal
c. static
d. dynamic
e. None of these
7. When used as parameters, these types of variables allow a function to access the
parameter's original argument:
a. reference
b. floating-point
c. counter
d. undeclared
e. None of these
8. __________ functions may have the same name as long as their parameter lists are
different.
a. Only two
b. Two or more
c. No
d. Un-prototyped
e. None of these
9. This statement causes a function to end.
a. end
b. terminate
c. return
d. release
e. None of these
10. A function _________ eliminates the need to place a function definition before all calls to
the function.
a. header
b. prototype
c. argument
d. parameter
e. None of these
, 11. 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.
a. persist
b. execute
c. communicate
d. change
e. None of these
12. If a function does not have a prototype, default arguments may be specified in the
__________.
a. function call
b. function header
c. execution
d. return type
e. None of these
13. Given the following function:
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 segment that invokes calc():
int x = 1;
int y = 2;
int z = 3;
calc(x, y);
cout << x << " " << y << " " << z << endl;
a. 1 2 3
b. 1 6 3
c. 3 6 3
d. 1 14 9
e. 2 3 4 5
14. What will the following code display?
#include <iostream>
using namespace std;
void showDub(int);
int main()
{int x = 2;
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller raccooncow. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $6.09. You're not tied to anything after your purchase.