QUIZ ON : PROGRAMMING AND PROBLEM SOLVING THROUGH PYTHON - FUNCTIONS

FUNCTIONS

00:00:00

Names of functions in two different files linked together can be same

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :
If two function are declared in a same name, it gives "Error: Multiple declaration of function_name())".

Names of functions in two different files linked together can be same

Question No# : 01 out of 20

Recursion cannot call a function itself.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

Recursion cannot call a function itself.

Question No# : 02 out of 20

A function in ‘C’ must have at least one argument.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

A function in ‘C’ must have at least one argument.

Question No# : 03 out of 20

Recursion works faster than loops.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :
When a recursive call is made, the function/process clones itself and then process that funtion. This leads to time and space constrains. In a loop, there is no recursive call involved that saves a lot of time and space too.

Recursion works faster than loops.

Question No# : 04 out of 20

Functions can return a floating point number.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Functions can return a floating point number.

Question No# : 05 out of 20

In C functions the actual expressions / parameters are passed on to formal parameters using the method of call by value result

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

In C functions the actual expressions / parameters are passed on to formal parameters using the method of call by value result

Question No# : 06 out of 20

In a function two return statements should never occur.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

In a function two return statements should never occur.

Question No# : 07 out of 20

Functions cannot return a floating point number

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :
A function can return floating point value.

Functions cannot return a floating point number

Question No# : 08 out of 20

A ‘C’ function can contain many return statements.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

A ‘C’ function can contain many return statements.

Question No# : 09 out of 20

Functions may have several declarations, but only one definition.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :
Yes, you can have multiple declarations (or prototypes), but you can only have one function definition for a given function name in C, or function name + arguments in C++. This needs to be supported for the very frequent situation where a function has prototypes in several include files but only one definition.

Functions may have several declarations, but only one definition.

Question No# : 10 out of 20

In a function two return statements should never occur.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

In a function two return statements should never occur.

Question No# : 11 out of 20

Actual parameters are used at the time of function calling.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Actual parameters are used at the time of function calling.

Question No# : 12 out of 20

void (*ptr)() is a pointer to a function which receives nothing and returns nothing.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

void (*ptr)() is a pointer to a function which receives nothing and returns nothing.

Question No# : 13 out of 20

Names of functions in two different files linked together must be unique.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Names of functions in two different files linked together must be unique.

Question No# : 14 out of 20

The keyword used to transfer control from a function back to the calling function is

Option A. switch
Option B. goto
Option C. go back
Option D. return
True Answer D

Explanation :

The keyword used to transfer control from a function back to the calling function is

Question No# : 15 out of 20

Functions cannot return more than one value at a time

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :
The default return type for a function is int.

Functions cannot return more than one value at a time

Question No# : 16 out of 20

Functions can be called either by value or by reference.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Functions can be called either by value or by reference.

Question No# : 17 out of 20

The names of parameters in a function definition and its declaration must be same.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

The names of parameters in a function definition and its declaration must be same.

Question No# : 18 out of 20

For the function

int operation (int A[], int n)
{
}
Which is the appropriate calling statement from main program?

Option A. s=operation(A[], 6)
Option B. operation(A, 6)
Option C. k=operation(A, 6)
Option D. d=operation(int A, 6)
True Answer C

Explanation :

For the function

int operation (int A[], int n)
{
}
Which is the appropriate calling statement from main program?

Question No# : 19 out of 20



Recursion cannot call a function itself.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

Recursion cannot call a function itself.

Question No# : 20 out of 20