Chapter 6 Quiz - Functions

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

A(n) _________ is information that is passed to a function, and a(n) _________ is information that is received by a function.

argument, parameter

A function is executed when it is

called

Here is the header for a function named computeValue: void computeValue(int value) Which of the following is a valid call to the function?

computeValue(10);

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

int

Look at the following function prototype. int myFunction(double, double, double); How many parameter variables does this function have?

3

What is the output of the following program? #include <iostream> using namespace std; void showDub(int); int main() { int x = 2; showDub(x); cout << x << endl; return 0; } void showDub(int num) { cout << (num * 2) << endl; }

4 2

What is the output of the following program? #include <iostream> using namespace std; int getValue(int); int main() { int x = 2; cout << getValue(x) << endl; return 0; } int getValue(int num) { return num + 5; }

7

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

False

A parameter is a special-purpose variable that is declared inside the parentheses of a function definition.

True

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

True


Conjuntos de estudio relacionados

Get ready quiz + revision: week 1

View Set

Module 1: Information Literacy in the Digital Age

View Set

College Biology Chapter 28 and 29

View Set

Natural Hazards and Disasters: Chapter 10 - HURRICANES AND EXTRATROPICAL CYCLONES

View Set

Займенник як частина мови 4 клас

View Set

Chapter 46: Nursing Care of the Child With an Alteration in Cellular Regulation/Hematologic or Neoplastic Disorder

View Set