Functions and Headers Flashcards

1
Q

arguments, return values, and function prototypes are all parts of a blank

A

function

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

multiple source files, the C preprocessor, include guards all require blank

A

headers

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

blank are named units of code that can be called upon to perform a task

A

functions

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

examples of functions include

A
getline( )
swap( )
strlen( ) 
pow( ) 
replace ( ) 
sort ( ) 
toupper( )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

sometimes functions are called from an object such as .size( ) from a vector or string
these are member functions also called

A
methods
some other methods are 
.begin( )
.end( )  
.open( ) 
.close( ) 
.second( ) 
.first( )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

to call a function, we supply it with the information that it needs, called blank

A

arguments

for example, pow( ) needs two arguments: base and exponent

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

blank supplied by listing them in order, separated by commas, in the parentheses after the function’s name

A

arguments

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

functions have the following general form

A
return_type function_name(argument_type 1 argument_name 1, ...)
{
  //code body;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

the blank is any valid data type such as int or string

A

return type

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

the function’s blank follows the same rules as variable’s blank

A

name(s)

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

the blank is a comma-separated list of type and variable names

A

arguments list

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

a blank is a value handed back from a function to be used where the function was called

A

return value

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

a function call is effectively replaced by its blank

A

return value

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

cout &laquo_space;repeat_string(“Hello! “,5);

What does this mean?

A

cout &laquo_space;“Hello! Hello! Hello! Hello! Hello! “;

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

functions make code blank

A

reusable
more organized
more readable

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

what happens if you put the other functions in your program below main instead of above main?

A

the program won’t compile because main( ) can’t see the other functions

17
Q

blank has to be declared above where we use it

A

a variable or a function

18
Q

to have the ability to place functions below main( ) and still have main( ) recognize them, use blank above the main( ) functions

A

function prototypes

19
Q

vector common_letters(string a, string b):

What is common_letters’s return type and what does it accept as arguments?

A

return type: vector of char

arguments: two strings

20
Q

having multiple source files helps keep your programs blank

A

clean and easy to read

21
Q

it is important to prototype functions in blank source files, because functions might call each other

A

all

22
Q

blank uses the .hpp extension instead of the .cpp extension

A

header files