Quiz: Functions

To View Tricks: Login Required

Number of Questions: 25

Question: 6 -

Which is more effective while calling the functions?

Options:
  1. call by reference

  2. call by value

  3. call by object

  4. call by pointer

  5. Answer:

    call by reference

    Solution:

    In the call by reference, it will just passes the reference of the memory addresses of passed values rather than copying the value to new memories which reduces the overall time and memory use.


Question: 7 -

How many can max number of arguments present in function in the c99 compiler?

Options:
  1. 127

  2. 102

  3. 99

  4. 90

  5. Answer:

    127

    Solution:

    C99 allows to pass a maximum of 127 arguments in a function.


Question: 8 -

What will be the output of the following C++ code?

#include <iostream>
using namespace std;
void car{
    cout << "Audi R8";
}
int main() {
    car();

    return 0;
}

Options:
  1. compile time error

  2. runtime error

  3. Audi R8

  4. Audi R8Audi R8

  5. Answer:

    compile time error

    Solution:

    We have to use the semicolon to declare the function in line 3. This is called a function declaration and a function declaration ends with a semicolon.


Question: 9 -

which of the following is used to terminate the function declaration?

Options:
  1. )

  2. ;

  3. :

  4. ]

  5. Answer:

    ;

    Solution:

    ; semicolon is used to terminate a function declaration statement in C++.


Question: 10 -

What are mandatory parts in the function declaration?

Options:
  1. parameters, variables

  2. return type, function name, parameters

  3. parameters, function name

  4. return type, function name

  5. Answer:

    return type, function name

    Solution:

    In a function, return type and function name are mandatory all else are just used as a choice.