QUIZ ON : C LANGUAGE - FUNCTIONS

FUNCTIONS

00:00:00

In ‘C’, parameters to a function can be passed by value but not by reference.

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

Explanation :

In ‘C’, parameters to a function can be passed by value but not by reference.

Question No# : 01 out of 20

A function name can be passed as an argument to another function.

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

Explanation :

A function name can be passed as an argument to another function.

Question No# : 02 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# : 03 out of 20

The address of the variable is passed to a function in call by reference.

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

Explanation :

The address of the variable is passed to a function in call by reference.

Question No# : 04 out of 20

Every function must return a value

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

Explanation :
If a function return type is declared as void it cannot return any value.

Every function must return a value

Question No# : 05 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 :

Functions cannot return more than one value at a time.

Question No# : 06 out of 20

Array is passed to a function using call by value method.

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

Explanation :

Array is passed to a function using call by value method.

Question No# : 07 out of 20

exit() function is defined in stdio.h header file.

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

Explanation :
The exit() function is a type of function with a return type without an argument. It's defined by the stdlib header file. You need to use ( exit(0) or exit(EXIT_SUCCESS)) or (exit(non-zero) or exit(EXIT_FAILURE) ) .

exit() function is defined in stdio.h header file.

Question No# : 08 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# : 09 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# : 10 out of 20

If a function contains two return statements successively, the compiler will generate warnings.?

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

Explanation :
Yes. If a function contains two return statements successively, the compiler will generate "Unreachable code" warnings.

If a function contains two return statements successively, the compiler will generate warnings.?

Question No# : 11 out of 20

Function putchar() displays

Option A. one word at a time on the screen
Option B. one character at a time
Option C. result on the screen
Option D. None of the above
True Answer B

Explanation :

Function putchar() displays

Question No# : 12 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# : 13 out of 20

A function cannot be defined inside another function

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

Explanation :
A function cannot be defined inside the another function, but a function can be called inside a another function.

A function cannot be defined inside another function

Question No# : 14 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# : 15 out of 20

exit() function is defined in stdio.h header file.

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

Explanation :

exit() function is defined in stdio.h header file.

Question No# : 16 out of 20



In the absence of a exit condition in a recursive function, the following error is given

Option A. Compile time error
Option B. Run time error
Option C. Logical error
Option D. No error
True Answer B

Explanation :
When a recursive function is called in the absence of an exit condition, it results in an infinite loop due to which the stack keeps getting filled(stack overflow). This results in a run time error.

In the absence of a exit condition in a recursive function, the following error is given

Question No# : 17 out of 20



What is the return-type of the function sqrt()

Option A. int
Option B. float
Option C. double
Option D. depends on the data type of the parameter
True Answer C

Explanation :

What is the return-type of the function sqrt()

Question No# : 18 out of 20



Every function in ‘C’ must have a “return” statement.

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

Explanation :

Every function in ‘C’ must have a “return” statement.

Question No# : 19 out of 20

The name of all functions end with a

Option A. pair of parenthesis
Option B. semicolon
Option C. braces
Option D. colon
True Answer A

Explanation :

The name of all functions end with a

Question No# : 20 out of 20