Filters
Question type

Study Flashcards

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


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

Correct Answer

verifed

verified

B

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

Correct Answer

verifed

verified

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; }


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

Correct Answer

verifed

verified

Local variables are initialized to zero by default.

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

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;


A) 1 2 3
B) 1 6 3
C) 3 6 3
D) 1 14 9
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

True

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


A) infinite loop
B) variable
C) constant
D) function
E) None of these

Correct Answer

verifed

verified

D

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


A) zero to many
B) no
C) only one
D) a maximum of ten
E) None of these

Correct Answer

verifed

verified

A function is executed when it is


A) defined
B) prototyped
C) declared
D) called
E) None of these

Correct Answer

verifed

verified

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


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

Correct Answer

verifed

verified

This statement causes a function to end.


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

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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


A) int
B) double
C) void
D) Can't tell from the prototype

Correct Answer

verifed

verified

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


A) Only two
B) Two or more
C) Zero
D) Un-prototyped
E) None of these

Correct Answer

verifed

verified

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; }


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

Correct Answer

verifed

verified

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


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

Correct Answer

verifed

verified

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


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

Correct Answer

verifed

verified

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


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

Correct Answer

verifed

verified

Showing 1 - 20 of 49

Related Exams

Show Answer