c++ chp 6

¡Supera tus tareas y exámenes ahora con Quizwiz!

What are the two parts of a function signature?

- function name - parameter list

In a function header, you must furnish:

- the names of all of the parameters - the name of function - the data type of the return value - the data types of the parameters

In C++, parameters are passed to functions in three different ways. These three ways are:

- value - pointer - reference

Which line in the following program contains the header for the showDub function? 1 #include <iostream> 2 using namespace std; 3 4 void showDub(int); 5 6 int main( ) 7 { 8 int x = 2; 9 10 showDub(x); 11 cout << x << endl; 12 return 0; 13 } 14 15 void showDub(int num) 16 { 17 cout << (num * 2) << endl; 18 }

15

Consider the function prototype int myFunction(double, double, double, double); How many parameters does this function have?

4

A function's return data type must be the same as the function's parameter(s).

False

Arguments are passed to a function in the order in which they appear in the function call.

True

Function prototypes are terminated with a semicolon.

True

One reason for using functions is to break programs into manageable units, or modules.

True

You may use the exit( ) function to terminate a program, regardless of which control mechanism is executing.

True

A function ________ contains the statements that make up the function.

body

A function is executed when it is:

called

These types of arguments are passed to parameters automatically if no argument is provided in the function call.

default

It is a good programming practice to ________ your functions by writing comments that describe what they do.

document

A named collection of statements that performs a specific task is a

function

If a function does not have a prototype, default arguments may be specified in the function ________.

header

Look at the following function prototype. int myFunction(double); What is the data type of the function's return value?

int

This type of variable is defined inside a function and is not accessible outside the function.

local

A function ________ eliminates the need to place a function definition before all calls to the function.

prototype

This statement causes a function to end.

return


Conjuntos de estudio relacionados

Ross Immunology True/False Practice Exam 2

View Set

Final Exam Review for Chapters 1-5

View Set

NUR 410 PEDS PREPU, interv week 6 peds, PN108 PrepU Chapter 39, Ricci Chapter 43: Nursing Care of the Child With an Alteration in Urinary Elimination/Genitourinary Disorder

View Set

Nursing 112 (Pharmacology) test 1

View Set