C Objective Interview Questions on Functions

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

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

  1. Value of elements in array
  2. First element of the array
  3. Base address of the array
  4. Address of the last element of the array.

Answer :

Ans : 3, Only Base address will be passed as a parameter to function

A function that calls itself for its processing is known as

  1. Inline Function
  2. Nested Function
  3. Overloaded Function
  4. Recursive Function.

Answer :

Ans : 4, Calling function from the definition of same function is called recursion

Arguments of functions are separated with

  1. Comma (,)
  2. Semicolon (;)
  3. Colon (:)
  4. None of these.

Answer :

Ans : 1, We must separate arguments with comma operator

Variables inside the parenthesis of functions declarations have _____ level access.

  1. Local
  2. Within the file
  3. Within the program
  4. None of above.

Answer :

Ans : 1, Arguments of function are always local variables

The default parameter passing mechanism is?

  1. No such rule in C
  2. Call by reference
  3. Call by value result.
  4. Call by value

Answer :

Ans : 4, Generally we call every function by passing values only

The order in which actual arguments are evaluated in function call

  1. From the left
  2. From the right
  3. is compiler dependent
  4. None of above.

Answer :

Ans : 2

Use of functions?

  1. Helps to avoid repeating a set of statements many times
  2. Enhance the logical clarity of the program
  3. Helps to avoid repeated programming across program
  4. All of above.

Answer :

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

Any C program

  1. Must contain at least one function
  2. Need not contain any function
  3. Needs input data
  4. None of above.

Answer :

Ans : 1, At least starting point that is main() function

Call by reference is also known as?

  1. Call by address or Call by location
  2. Call by address or Call by value
  3. Call by value or Call by name
  4. None of above.

Answer :

Ans : 1

How to declare a pointer to a function?

  1. int *(fp)()
  2. int (*fp)()
  3. int * (fp)()
  4. None.

Answer :

Ans : 2, Where ‘fp’ is a pointer pointing to function which is returning integer

C Objective Interview Questions – Functions – 2

Share this