Home / CSE MCQs / C++ - MCQs :: Functions - C++

CSE MCQs :: C++ - MCQs

  1. Where does the execution of the program starts?
  2. A.
    user-defined function
    B.
    main function
    C.
    void function
    D.
    none of the mentioned

  3. What are mandatory parts in function declaration?
  4. A.
    return type,function name
    B.
    return type,function name,parameters
    C.
    both a and b
    D.
    none of the mentioned

  5. which of the following is used to terminate the function declaration?
  6. A.
    :
    B.
    )
    C.
    ;
    D.
    none of the mentioned

  7. How many max number of arguments can present in function in c99 compiler?
  8. A.
    99
    B.
    90
    C.
    102
    D.
    127

  9. Which is more effective while calling the functions?
  10. A.
    call by value
    B.
    call by reference
    C.
    call by pointer
    D.
    none of the mentioned

  11. What is the output of this program?

    #include < iostream >

    using namespace std;

    void mani()

    void mani()

    {

    cout << "hai";

    }

    int main()

    {

    main();

    return 0;

    }

  12. A.
    hai
    B.
    haihai
    C.
    compile time error
    D.
    none of the mentioned

  13. What is the output of this program?

    #include < iostream >

    using namespace std;

    void fun(int x, int y)

    {

    x = 20;

    y = 10;

    }

    int main()

    {

    int x = 10;

    fun(x, x);

    cout << x;

    return 0;

    }

  14. A.
    10
    B.
    20
    C.
    compile time error
    D.
    none of the mentioned

  15. What is the scope of the variable declared in the user definied function?
  16. A.
    whole program
    B.
    only inside the {} block
    C.
    both a and b
    D.
    none of the mentioned

  17. How many ways of passing a parameter are there in c++?
  18. A.
    1
    B.
    2
    C.
    3
    D.
    4

  19. Which is used to keep the call by reference value as intact?
  20. A.
    static
    B.
    const
    C.
    absolute
    D.
    none of the mentioned