Exam 6: Functions

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

It is possible for a function to have some parameters with default arguments and some without.

Free
(True/False)
4.8/5
(81)
Correct Answer:
Verified

True

This is a collection of statements that performs a specific task.

Free
(Multiple Choice)
4.8/5
(81)
Correct Answer:
Verified

D

This is a dummy function that is called instead of the actual function it represents.

Free
(Multiple Choice)
4.7/5
(78)
Correct Answer:
Verified

B

The value in this type of local variable persists between function calls.

(Multiple Choice)
4.7/5
(86)

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

(Multiple Choice)
4.7/5
(79)

Given the following function definition void calc (int a, int& b) { \quad int c; \quad c = a + 2; \quad a = a * 3; \quad b = c + a; } What is the output of the following code fragment that invokes calc? (All variables are of type int) x = 1; y = 2; z = 3; Calc(x, y); Cout << x << " " << y << " " << z << endl;

(Multiple Choice)
4.7/5
(73)

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

(Multiple Choice)
4.8/5
(80)

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

(True/False)
4.9/5
(78)

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

(Multiple Choice)
4.9/5
(71)

A function is executed when it is

(Multiple Choice)
4.8/5
(70)

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

(True/False)
4.8/5
(94)

A(n) _________ argument is passed to a parameter when the actual argument is left out of the function call.

(Multiple Choice)
4.9/5
(84)

Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.

(Multiple Choice)
4.7/5
(72)

Local variables are initialized to zero by default.

(True/False)
4.8/5
(69)

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

(Multiple Choice)
4.9/5
(83)

_________ functions may have the same name, as long as their parameter lists are different.

(Multiple Choice)
4.8/5
(73)

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

(True/False)
4.7/5
(80)

A function can have zero to many parameters, and it can return this many values.

(Multiple Choice)
4.9/5
(71)

This statement causes a function to end.

(Multiple Choice)
4.9/5
(81)

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.8/5
(69)
Showing 1 - 20 of 49
close modal

Filters

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