QUIZ ON : C LANGUAGE - 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

Prototype of function named ‘fun’ is: int fun(int a, float b) Which of the following is true about function ‘fun’:

Option A. It takes two inputs, one integer type and the other float type but returns nothing
Option B. It takes two inputs, one integer type and the other float type but returns 0
Option C. It takes two inputs, one integer type and the other float type but returns an integer
Option D. It takes two inputs, one integer type and the other integer type but returns float
True Answer C

Explanation :

Prototype of function named ‘fun’ is: int fun(int a, float b) Which of the following is true about function ‘fun’:

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

Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3();

Option A. f1, f2, f3
Option B. f3, f2, f1
Option C. Order may vary from compiler to compiler
Option D. None of the above
True Answer C

Explanation :

Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3();

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

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

The data structure used to implement recursive function calls

Option A. Array
Option B. Linked list
Option C. Binary tree
Option D. Stack
True Answer D

Explanation :
The compiler uses the data type stack for implementing normal as well as recursive function calls.

The data structure used to implement recursive function calls

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

In C, if you pass an array as an argument to a function, what actually gets passed?

Option A. Value of elements in array
Option B. First element of the array
Option C. Base address of the array
Option D. Address of the last element of array
True Answer C

Explanation :
The statement 'C' is correct. When we pass an array as a funtion argument, the base address of the array will be passed.

In C, if you pass an array as an argument to a function, what actually gets passed?

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


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad