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

CSE MCQs :: C++ - MCQs

  1. By default how the value are passed in c++?
  2. A.
    call by value
    B.
    call by reference
    C.
    call by pointer
    D.
    none of the mentioned

  3. What will happen when we use void in argument passing?
  4. A.
    It will not return value to its caller
    B.
    It will return value to its caller
    C.
    both a & b are correct
    D.
    none of the mentioned

  5. How many types of returning values are present in c++?
  6. A.
    1
    B.
    2
    C.
    3
    D.
    4

  7. What will you use if you are not intended to get a return value?
  8. A.
    static
    B.
    const
    C.
    volatile
    D.
    void

  9. Where does the return statement returns the execution of the program?
  10. A.
    main function
    B.
    caller function
    C.
    same function
    D.
    none of the mentioned

  11. When will we use the function overloading?
  12. A.
    same function name but different number of arguments
    B.
    different function name but same number of arguments
    C.
    same function name but same number of arguments
    D.
    different function name but different number of arguments

  13. Overloaded functions are
  14. A.
    Very long functions that can hardly run
    B.
    One function containing another one or more functions inside it.
    C.
    Two or more functions with the same name but different number of parameters or type.
    D.
    none of the mentioned

  15. What will happen while using pass by reference
  16. A.
    The values of those variables are passed to the function so that it can manipulate them
    B.
    The location of variable in memory is passed to the function so that it can use the same memory area for its processing
    C.
    The function declaration should contain ampersand (& in its type declaration)
    D.
    All of the mentioned

  17. When our function doesn't need to return anything means what we will as parameter in function?
  18. A.
    void
    B.
    blank space
    C.
    both a & b
    D.
    none of the mentioned

  19. What are the advantages of passing arguments by reference?
  20. A.
    Changes to parameter values within the function also affect the original arguments.
    B.
    There is need to copy parameter values (i.e. less memory used)
    C.
    There is no need to call constructors for parameters (i.e. faster)
    D.
    All of the mentioned