Chapter 6 Flashcards

(24 cards)

1
Q

a function definition must include 1, 2, 3, 4

A

return type, name, parameter list, and body

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

fcn can send a value to part of program that executed it; is data type of value that’s sent from fcn

A

return type

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

you give each fcn a descriptive __ (rules are same as for variables)

A

name

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

prgm can send data to a fcn; is a list of variables that holds values being passed to fcn

A

parameter list

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

set of statements that perform fcn’s operation; enclosed in a set of braces

A

body

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

contains return type, fcn name, and parameter list; not terminated by semicolon

A

function header

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

fcn that doesn’t return a value; simply performs statements

A

void function

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

name of fcn followed by a set of ()s and a semicolon; executes the fcn and is terminated by semicolon; return type is not listed; ()s are empty if data isn’t being passed to fcn; may be used in control structures (loops, if statements, switch statements); after executing fcn, program returns to point of call

A

function call

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

looks sim to fcn header except there’s a semicolon at the end; aka fcn declaration

A

function prototype

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

values sent into a function; aka actual

A

arguments

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

special variable that holds a value being passed into a fcn; aka formal

A

parameter

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

when a copy of an argument is passed to a fcn; fcn cannot change original argument

A

passed by value

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

causes fcn to immediately terminate and give control of program back to statement that called the function

A

return statement

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

fcn that returns a value back to statement that called it; can use this value any where you can use a regular value of same data type

A

value-returning fcn

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

named constant that is available to every function in a program; can’t be changed during program’s execution; typically used to represent unchanging values that are needed throughout a program

A

global constant

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

passed to parameter when actual argument is left out of function call, usually listed in fcn prototype; are literal values or constants with an = operator in front of them, appearing after the data types listed in a fcn prototype; are only used when argument is left out of a function call; must be defined last

A

default argument

17
Q

allows access to original argument; any change made to the ___ variable are actually performed on variable for which it’s an alias; can be used to allow a function to change a variable in another function; can only be done w/ variables

A

reference variable / passed by reference

18
Q

when fcns have same name and dif parameter lists; convenient when there are sim functions that use a dif # of parameters or parameters of dif data types

A

overloaded functions

19
Q

name of function and date types of fcn’s parameter’s in proper orderl used by C++ to distinguish it from other functions with the same name; does NOT include the fcn’s return value

A

function signature

20
Q

causes program to stop, regardless of which function contains the call; requires header file cstdlib; takes an integer arg (exit code you wish program to pass back to comp’s OS and is smtms used outside of prgm to indicate whether program ended successfully or as result of failure

A

exit function

21
Q

termination code that commonly represents an unsuccessful exit under current operating sys

22
Q

termination code that commonly represents a successful exit under current operating system

23
Q

dummy function that’s called instead of actual function it represents; usually displays a test message acknowledging that it was called and nothing more; allows you to concentrate your testing efforts on parts of program that call the fcn; allows you to det whether program is calling a fcn when you expect it to, and to confirm that valid values are being passed to function and that the return value is being handled properly; when this debugged, move on

24
Q

prgm that tests a fcn by simply calling it; if fcn accepts args, this passes test data; if has return value, displays the return value (allows you to see how fcn performs in isolation from the rest of the program it will eventually be part of); can be used to thoroughly test a program; when fcn performs as desired, it can placed into actual program it will be part of