QUIZ ON : C LANGUAGE - FUNCTIONS

FUNCTIONS

00:00:00

An array can be passed to a function by

Option A. Call by reference
Option B. Call by value
Option C. Call by reference by passing base address to a function
Option D. Both A and C
True Answer D

Explanation :

An array can be passed to a function by

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



The value obtained in the function is given back to main by using ________ keyword.

Option A. return
Option B. static
Option C. new
Option D. volatile
True Answer A

Explanation :

The value obtained in the function is given back to main by using ________ keyword.

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



A function can have any number of return statements.

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

Explanation :

A function can have any number of return statements.

Question No# : 05 out of 20



Due to variable scope in C

Option A. Variables created in a function cannot be used another function
Option B. Variables created in a function can be used in another function
Option C. Variables created in a function can only be used in the main function
Option D. None of the above
True Answer A

Explanation :

Due to variable scope in C

Question No# : 06 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# : 07 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# : 08 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# : 09 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# : 10 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# : 11 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# : 12 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# : 13 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# : 14 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# : 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



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# : 17 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# : 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



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# : 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