Question: 1).If a function is declared to return void, then which statement below is true? A) The function cannot return until reaching the end of the

1).If a function is declared to return void, then which statement below is true?

A) The function cannot return until reaching the end of the function body

B) The function needs a return statement that always returns the integer value zero

C) The function needs a return statement with no return value

2).A stub function is

A) A short function

B) A function that has been unit tested

C) A function that acts as a placeholder and returns a simple value so another function can be tested

3). Which of the following is the best choice for a return type from a function that prompts users to enter their password?

A) char B) int C) string D) void

4). In the following code snippet, what is the scope of variable b?

void func1()

{

int i = 0; double b = 0;

}void func2(){}int main(){ func1(); func2(); return 0;}

A) It can be used only in func1().

B) It can be used in user-defined functions, func1() and func2().

C) It can be used anywhere in this program.

D) It can be used in many programs.

5).Which of the following is correct about a global variable?

A) It is declared before all the functions in a program

.B) It is visible to all the functions declared after it.

C) It is declared in the main function.

D) It is declared within the scope of a function.

6). . On executing the following code snippet, what is the value of the global variable gvar?

int gvar = 1;int main()

{

int gvar = 0; gvar = gvar + 10;

cout << gvar; return 0;}

A) 1 B) 10 C) 11 D) 0

7).Which of the following is NOT a good practice when developing a computer program?

A) Put as many statements as possible into the main function

B) Document the purpose of each function parameter

C) Decompose a program into many small functions

D) Place code that is used multiple times into a separate function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!