Filters
Question type

Study Flashcards

Given the following header for a function named computeValue, which of the following is a valid call to the function? Void computeValue(int value)


A) computeValue(10)
B) computeValue(10) ;
C) void computeValue(10) ;
D) void computeValue(int x) ;

Correct Answer

verifed

verified

Local variables are initialized to zero by default.

Correct Answer

verifed

verified

A __________ argument is passed to a parameter when the actual argument is left out of the function.


A) False
B) true
C) null
D) default
E) None of these

Correct Answer

verifed

verified

D

What will the following code display? #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; return 0; } void doSomething(int num) { \quad num = 0; \quad cout << num << endl; }


A) 2
0
2
B) 2
2
2
C) 0
0
0
D) 2
0
0

Correct Answer

verifed

verified

A

This statement causes a function to end.


A) end
B) terminate
C) return
D) release
E) None of these

Correct Answer

verifed

verified

In the following function prototype, how many parameter variables does this function have? Int myFunction(double, double, double) ;


A) 1
B) 2
C) 3
D) cannot tell from the prototype

Correct Answer

verifed

verified

What will the following code display? #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; }


A) 2
0
2
B) 2
2
2
C) 0
0
0
D) 2
0
0

Correct Answer

verifed

verified

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


A) header
B) prototype
C) argument
D) parameter
E) None of these

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

What is the data type of the following function prototype's return value? Int myFunction(double) ;


A) int
B) double
C) void
D) cannot tell from the prototype

Correct Answer

verifed

verified

A

You must always furnish an argument with a function call.

Correct Answer

verifed

verified

Select all that apply. Which of the following statement(s) about global variables is(are) true?


A) A global variable is accessible only to the main function.
B) A global variable is declared in the highest-level block in which it is used.
C) A global variable can have the same name as a variable that is declared locally within a function.
D) A global variable is the same as a named constant.
E) If a function contains a local variable with the same name as a global variable, the global variable's name takes precedence within the function.

Correct Answer

verifed

verified

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


A) call
B) append
C) define
D) declare
E) None of these

Correct Answer

verifed

verified

What will the following code display? #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; }


A) 5
B) 2
C) 7
D) getValue(x)

Correct Answer

verifed

verified

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


A) main
B) stub
C) a driver
D) an overloaded function

Correct Answer

verifed

verified

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


A) global
B) internal
C) static
D) dynamic
E) None of these

Correct Answer

verifed

verified

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


A) function call, function header
B) parameter, argument
C) argument, parameter
D) prototype, header
E) None of these

Correct Answer

verifed

verified

A collection of statements that performs a specific task is a(n)


A) infinite loop
B) variable
C) constant
D) function
E) decision

Correct Answer

verifed

verified

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.


A) persist
B) execute
C) communicate
D) change
E) None of these

Correct Answer

verifed

verified

Showing 1 - 20 of 49

Related Exams

Show Answer