verified Answers |Already Graded A+|
2026 Brand New Version!!!
What is the output of the following program?
int getValue(int);
int main()
{
int x = 2;
cout << getValue(x) << endl;
return 0;
}
int getValue (int num)
{
return num = 5
} - Correct Answer -7
Which of the following statements about global variables is 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) 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.
E) All of these are true. - Correct Answer -C) A global variable can have the same
name as a variable that is declared locally within a function.
If a function does not have a prototype, default arguments may be specified in the
function ________. - Correct Answer -header
This type of variable is defined inside a function and is not accessible outside the
function. - Correct Answer -local
What is the output of the following program?
void doSomething(int&);
int main( )
{
int x = 2;
cout << x << endl;
doSomething(x);
cout << x << endl;
,return 0;
}
void doSomething(int& num)
{
num = 0;
cout << num << endl;
} - Correct Answer -2
0
0
What is the output of the following program?
void showDub(int);
int main ( )
{
int x =2;
showDub(x);
cout <<x << endl;
return 0;
}
void showDub (int num)
{
cout << (num + 2) << endl;
, } - Correct Answer -4
2
The value in this type of local variable persists between function calls. - Correct
Answer -static
This is a collection of statements that performs a specific task. - Correct Answer -
function
True/False: It is possible for a function to have some parameters with default
arguments and some without. - Correct Answer -true
True/False: One reason for using functions is to break programs into manageable
units, or modules.
True
False - Correct Answer -true
Which statement correctly defines a vector object for holding integers?
A)