Chapter 6 Flashcards

(30 cards)

1
Q

What does the power function look like?

A
pow(2.0, 3.0) = 2^3 = 8
Raises a (first) number to a (second) power.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Of what type is the power function?

A

Double

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

What does the square root function look like?

A

sqrt(4) = 2

Takes the square root of a function

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

Of what type is the square root function?

A

Double

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

What does the floor function?

A

This function calculates the largest whole number that is less than or equal to X.
floor(48.79) = 48.0 (Or it rounds down)

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

Of what type is the floor function?

A

Double

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

What libraries do all functions need to use?

A

include

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

What are the two categories of user-defined functions?

A

Value returning functions and Void functions

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

What is a value returning function?

A

Functions that have a return type. These functions return the value of a certain data type using the return statement.

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

What is a void function?

A

Functions that do not have a return type. These functions do not use a return statement to return a value.

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

What are the three ways to use value returning functions?

A
  1. Save for further calculation.
  2. Use the value in some calculation.
  3. Print the value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is suggested about the value returning statement?

A

The returning function is used in an assignment statement as the parameter in a function call, and in an output statement.

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

What are the first 4 properties that form the function header?

A
  1. The names of the function
  2. The number of parameters is any
  3. The data type of each parameter
  4. The data type of the value returned by the function.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the 5th property of the function called?

A

The body.

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

What is the body?

A

the code within the function needed to do the task.

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

What are these five properties called together?

A

Definition of the function

17
Q

A variable declared in the function heading is called?

A

Formal parameter

18
Q

A variable or expression listed in a function call?

A

Actual parameter

19
Q

What is the syntax of a value-returning function?

A
functionType functionName(formal parameter list) 
{
Statements or code;
}
20
Q

What is another name for function type?

21
Q

What is the syntax to call a value-returning function?

A

functionName (actual paramenter list)

22
Q

What is a value returning function called?

A

An expression?

23
Q

What is the syntax of the return statement?

A

return expression;

24
Q

In C++ return is a reserved word true or false?

25
What is local declaration?
Declaration of a variable within a block of code for use ONLY within that block.
26
What is a function prototype?
A function heading without any body for that function
27
Is the function prototype a definition?
NO
28
What does a function prototype promise?
That a full definition will appear later in the function.
29
What happens if you do not write a definition?
May compile but will not execute
30
What is a function prototype syntax?
functioType functionNames (paramenter list);