Quiz: Functions

To View Tricks: Login Required

Number of Questions: 25

Question: 21 -

Where the default value of parameter have to be specified?

Options:
  1. Function prototype

  2. Function definition

  3. Both B or C

  4. Function call

  5. Answer:

    Function prototype

    Solution not available.

Question: 22 -

If an argument from the parameter list of a function is defined constant then _______________

Options:
  1. It cannot be modified inside the function

  2. Segmentation fault

  3. It can be modified inside the function

  4. Error occurs

  5. Answer:

    It cannot be modified inside the function

    Solution:

    A function is not allowed a constant member of the parameter list.


Question: 23 -

Which of the following function / type of function cannot be overloaded?

Options:
  1. Both B and C

  2. Virtual function

  3. Static function

  4. Member function

  5. Answer:

    Virtual function

    Solution not available.

Question: 24 -

Which of the following feature is used in function overloading and function with default argument?

Options:
  1. Abstraction

  2. Polymorphism

  3. Modularity

  4. Encapsulation

  5. Answer:

    Polymorphism

    Solution:

    Both of the above types allows a function overloading which is the basic concept of Polymorphism.


Question: 25 -

Which of the following function declaration is/are incorrect?

A. int Sum(int a, int b = 2, int c = 3);

B. int Sum(int a = 5, int b);

C. int Sum(int a = 0, int b, int c = 3);

D. Both B and C are incorrect.

Options:
  1. A

  2. B

  3. D

  4. C

  5. Answer:

    D

    Solution not available.