QUIZ ON : C LANGUAGE - FUNCTIONS

FUNCTIONS

00:00:00

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

Which of the following function declaration need not have a return statement in its body?

Option A. int a(char *s)
Option B. void b(int a[], int n)
Option C. float *c()
Option D. short d(long x)
True Answer B

Explanation :

Which of the following function declaration need not have a return statement in its body?

Question No# : 04 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# : 05 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# : 06 out of 20

Functions can return a floating point number.

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

Explanation :
Yes, you can use float as a return type in C. Yes you can use, write prototype before calling that function otherwise compiler will assume it has a int and returns the int value.

Functions can return a floating point number.

Question No# : 07 out of 20

Functions can be called only by value

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

Explanation :
A function can be called either call by value or call by reference. Example: Call by value means c = sub(a, b); here value of a and b are passed. Call by reference means c = sub(&a, &b); here address of a and b are passed.

Functions can be called only by value

Question No# : 08 out of 20

Functions that do not contain return statement do not return any value.

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

Explanation :

Functions that do not contain return statement do not return any value.

Question No# : 09 out of 20

getchar() function is available in which header file?

Option A. Stdio.h
Option B. Conio.h
Option C. Math.h
Option D. Header.h
True Answer A

Explanation :

getchar() function is available in which header file?

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

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

Changes made to an array inside a function are automatically reflected in calling program.

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

Explanation :

Changes made to an array inside a function are automatically reflected in calling program.

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

Functions may have several declarations, but only one definition.

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

Explanation :

Functions may have several declarations, but only one definition.

Question No# : 17 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# : 18 out of 20

Maximum number of arguments that a function can take is 12

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

Explanation :
C can accept upto 127 maximum number of arguments in a function.

Maximum number of arguments that a function can take is 12

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