Exam 6: Functions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When used as parameters, these types of variables allow a function to access the parameter's original argument.

(Multiple Choice)
4.9/5
(89)

This is a statement that causes a function to execute.

(Multiple Choice)
4.7/5
(72)

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

(Multiple Choice)
4.9/5
(81)

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

(Multiple Choice)
4.8/5
(85)

If a function is called more than once in a program, the values stored in the function's local variables do not _________ between function calls.

(Multiple Choice)
4.9/5
(93)

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

(Multiple Choice)
4.9/5
(79)

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

(Multiple Choice)
4.8/5
(69)

It is not considered good programming practice to declare all of your variables globally.

(True/False)
4.9/5
(95)

A ___________ variable is declared outside all functions.

(Multiple Choice)
4.7/5
(85)

Global variables are initialized to zero by default.

(True/False)
4.9/5
(71)

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

(Multiple Choice)
4.7/5
(86)

You must furnish an argument with a function call.

(True/False)
4.8/5
(81)

When a function is called, flow of control moves to the function's prototype.

(True/False)
4.9/5
(81)

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

(Multiple Choice)
4.9/5
(89)

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

(True/False)
4.9/5
(76)

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

(Multiple Choice)
4.9/5
(84)

This function causes a program to terminate, regardless of which function or control mechanism is executing.

(Multiple Choice)
4.8/5
(72)

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

(Multiple Choice)
4.7/5
(80)

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

(Multiple Choice)
4.9/5
(75)

EXIT_FAILURE and __________ are named constants that may be used to indicate success or failure when the exit() function is called.

(Multiple Choice)
4.8/5
(87)
Showing 21 - 40 of 49
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)