C Objective Interview Questions on Functions

These C Objective Interview Questions on functions Part 2 post providing basic, intermediate and Hard level examples in C Functions. The Practice of these examples makes you good in C programming.


What is the correct syntax to send an array as a parameter to function?

  1. fun(array[size]);
  2. fun(*array);
  3. fun(array);
  4. all of above mentioned

Answer :

Ans : 3, we can pass directly array name as a parameter

Recursive functions are executed in which order

  1. Parallel order
  2. Iterative order
  3. Last in first out
  4. Random order.

Answer :

Ans : 3

In recursive call of the function where the automatic variables are stored?

  1. Stack
  2. Queue
  3. Array
  4. Register

Answer :

Ans : 1, because recursion follows stack rule

Usually, the loop’s working is faster than recursion

  1. Always true
  2. Always false
  3. Sometimes true
  4. Sometimes false

Answer :

Ans : 1, But recursion having its own advantages

 


A function can return more than one value using _________

  1. Call by value
  2. Call by reference
  3. Using more than 1 return statement
  4. Returning more than 1 value using single return statement separated by commas.

Answer :

Ans : 2, By returning address of block which contains more than one elemet such as array, string, sturcture and much more

Which of the following are the types of functions

  1. Library functions
  2. User-defined functions
  3. Nested functions
  4. Both A and B
  5. All of the above

Answer :

Ans : 4, Nested functions cannot be defined

The arguments received by a function are called

  1. Actual arguments
  2. Formal arguments
  3. Real arguments
  4. Parameters

Answer :

Ans : 2, Arguments in the calling function are called actual arguments and Arguments in the called function are called Formal arguments

Function prototype is

  1. A statement
  2. A block
  3. Can be either a or b
  4. None of all.

Answer :

Ans : 1, Prototye or declaration is always a single statement ends with semi-colon

Can we use a function as a parameter of another function? [ Eg: void m1(int m2()) ]

  1. Yes, and we can use the function value conveniently
  2. Yes, but we call the function again to get the value, not as convenient as in using variable
  3. No, C does not support it.
  4. This case is compiler dependent.

Answer :

Ans : 4, all the above mentioned are true in case of given question

We declare a function with ______ if it does not have any return type

  1. long
  2. double
  3. void
  4. int.

Answer :

Ans : 3, void is the technical keyword that represents ‘nothing’

Which of the following function declaration is illegal?

  • int 1f(int);
  • int 2f(int a);
  • int 3f(int*, int []);
  • All of the above

Answer :

Ans : 4, In C-Language, we cannot start identifier using digit

The results of the function are given back to calling a function by using ________ keyword?

  1. back
  2. return
  3. break
  4. close

Answer :

Ans : 2, return-statement returns the value of function result back to calling function.

Can functions return structure in c?

  1. True
  2. False
  3. Depends on the compiler
  4. Depends on the standard.

Answer :

Ans : 1,  For example  struct Emp read(); inwhich ‘struct Emp’ is the return type of function

How many times would the following program print (“abc”)? main( ) { printf(“\nabc”); main( ); }

  1. Infinite number of times
  2. 32767 times
  3. 65535 times
  4. Till the stack does not overflow.

Answer :

Ans : 4, Function executes as long as stack memory is available

 C Technical Interview Questions On Arrays – Part1

Share this