"Spar 7" for CPSC 1375
A _____________ __________________ is a variable declared in the function declaration:
Function Parameter ~or Formal Parameter
If you need to do something more than once, you should consider how to modify your code to remove as much redundancy as possible
True
An ____________ is the value that is passed to the function by the caller:
Argument ~or~ Actual Parameter
All functions require a return value
False
C++ allows you to explicitly call the main funciton
False
pass by value when passing structs or classes (including std::array, std::vector, and std::string).
False
Match the term to its definition 1. a reusable sequence of statements designed to do a particular job. 2. a reusable sequence of statements designed to do a particular job. 3. where the statements that are part of your function will go 4. The function initiating the function call
1. Function 2. Function Call 3. Function Body 4. Caller
Match the term to its definition 1. the type that is defined before the function's name 2. indicates the specific value being returned to the caller 3. The specific value returned from a function 4. the return value is copied from the function back to the caller
1. Return Type 2. Return Statement 3. Return Value 4. Return by Value
A ______________ is a statement that tells the compiler about the existence of an identifier and its type information.
Declaration
______________ ___________________work almost identically to variables defined inside the function, but with one difference: they are always initialized with a value provided by the caller of the function.
Function Parameters ~or~ Function Parameter
The ______________ ________________ consists of the function's return type, name, parameters, but no function body (the curly braces and everything in between them), terminated with a semicolon.
Function Prototype
an object's ______________ is defined to be the time between its creation and destruction
Lifetime
Function parameters, as well as variables defined inside the function body, are called ______ ___________
Local Variables
When a function is called, all of the parameters of the function are created as variables, and the value of each of the arguments is copied into the matching parameter. This process is called ______ ____ _______.
Pass by value ~or~ pass-by-value
When an argument is ________ ___ ________, the argument's value is copied into the value of the corresponding function parameter.
Passed by Value ~or passed-by-value
An identifier's __________ determines where the identifier can be accessed within the source code
Scope
The return value from main is sometimes called a(n) __________ _______________
Status Code ~or~ Exit Code ~or~ Return Code
A local variable's scope begins at the point of variable definition, and stops at the end of the set of curly braces in which they are defined (or for function parameters, at the end of the function).
True
For pass by value arguments, arguments are never changed by the function being called, which prevents side effects.
True
Local variables are destroyed in the OPPOSITE order of creation at the end of the set of curly braces in which it is defined (or for a function parameter, at the end of the function).
True
Names used for function parameters or variables declared in a function body are only visible within the function that declares them. This means local variables within a function can be named without regard for the names of variables in other functions.
True
Reference parameters cannot accept arguments that are literals.
True
The C++ Specification does not define whether arguments are matched with parameters in left in right order or right to left order
True
When a return statement is executed, the function returns back to the caller immediately at that point. Any additional code in the function is ignored
True
When passing an argument by reference, you should always use a const reference unless you need to change the value of the argument.
True
You can use the return values of one function as an argument for another function!
True
a function can only return a single value back to the caller each time it is called
True
pass by value when passing fundamental data types and enumerators, and the function does not need to change the argument.
True