Function Declarations C++ MCQ

Errorlogger
0
1. Where does the execution of the program starts?
a) user-defined function
b) main function
c) void function
d) none of the mentioned




2. What are mandatory parts in function declaration?
a) return type,function name
b) return type,function name,parameters
c) both a and b
d) none of the mentioned




3. which of the following is used to terminate the function declaration?
a) :
b) )
c) ;
d) none of the mentioned




4. How many max number of arguments can present in function in c99 compiler?
a) 99
b) 90
c) 102
d) 127




5. Which is more effective while calling the functions?
a) call by value
b) call by reference
c) call by pointer
d) none of the mentioned




6. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     void mani()
  4.     void mani()
  5.     {
  6.         cout<<"hai";
  7.     }
  8.     int main()
  9.     {
  10.         mani();
  11.         return 0;
  12.     }
a) hai
b) haihai
c) compile time error
d) none of the mentioned




7. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     void fun(int x, int y)
  4.     {
  5.         x = 20;
  6.         y = 10;
  7.     }
  8.     int main()
  9.     {
  10.         int x = 10;
  11.         fun(x, x);
  12.         cout << x;
  13.         return 0;
  14.     }
a) 10
a) 10
c) compile time error
d) none of the mentioned




8. What is the scope of the variable declared in the user definied function?
a) whole program
b) only inside the {} block
c) both a and b
d) none of the mentioned




9. How many minimum number of functions are need to be presented in c++?
a) 0
b) 1
c) 2
d) 3



Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(30)

Our website uses cookies to enhance your experience. Check Now
Accept !