QUIZ ON : PROGRAMMING AND PROBLEM SOLVING THROUGH PYTHON - FUNCTIONS

FUNCTIONS

00:00:00

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# : 01 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# : 02 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# : 03 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# : 04 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# : 05 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# : 06 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# : 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



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



Which keyword can be used for coming out of recursion?

Option A. break
Option B. return
Option C. exit
Option D. Both break and return
True Answer B

Explanation :

Which keyword can be used for coming out of recursion?

Question No# : 10 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# : 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 is sometimes called

Option A. Circular definition
Option B. Complex definition
Option C. Procedure
Option D. Union
True Answer A

Explanation :

Recursion is sometimes called

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



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# : 15 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# : 16 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# : 17 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# : 18 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# : 19 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# : 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