USER-DEFINED FUNCTIONS Flashcards
To use a predefined function in a program, you need to know only the name of the function and how to use it.
False
A value-returning function returns only one value.
True
Parameters allow you to use different values each time the function is called.
True
When a return statement executes in a user-defined function, the function immediately exits.
True
A value-returning function returns only integer values.
False
When a return statement executes in a user-defined function, the function immediately exits.
True
A value-returning function returns only integer values.
False
A variable name cannot be passed to a value parameter
False
If a C++ function does not use parameters, parentheses around the empty parameter list are still required.
True
In C++, the names of the corresponding formal and actual parameters must be the same.
False
A function that changes the value of a reference parameter also changes the value of the actual parameter
True
Whenever the value of a reference parameter changes, the value of the actual parameter changes.
True
In C++, function definitions can be nested; that is, the definition of one function can be enclosed in the body of another function.
False
Using global variables in a program is a better programming style than using local variables, because extra variables can be avoided.
False
In a program, global constants are as dangerous as global variables.
False
The memory for a static variable remains allocated between function calls.
True
The following is a valid C++ enumeration type:
enum romanNumerals {I, V, X, L, C, D, M}
True
Given the declaration: enum cars {FORD, GM, TOYOTA, HONDA}; cars domesticCars = FORD;
the statement: domesticCars = domesticCars + 1; sets the value of domesticCars to GM
False
The values in the domain of an enumeration type are called enumerators.
True
The only arithmetic operations allowed on the enumeration type are increment and decrement.
False
You can input the value of an enumeration type directly from a standard input device
False
A function can return a value of an enumeration type.
True
The following are legal C++ statements in the same block of a C++ program:
enum mathStudent {BILL, JOHN, LISA, RON, CINDY, SHELLY};
enum historyStudent {AMANDA, BOB, JACK, TOM, SUSAN};
True
The following statement creates an anonymous type: enum {A, B, C, D, F} studentGrade;
True