BreakInterview

1. Which of the following in Object Oriented Programming is supported by Function overloading and default arguments features of C++.

Inheritance
Polymorphism
Encapsulation
None of the above

2. Predict the output of the following code.
#include 
using namespace std;
 
int fun(int=0, int = 0);
 
int main()
{
  cout << fun(5);
  return 0;
}
 
int fun(int x, int y) { return (x+y); }

5
10
Compiler Error

3. Predict the output of the following code.
#include
using namespace std;
 
int fun(int x = 0, int y = 0, int z)
{  return (x + y + z); }
 
int main()
{
   cout << fun(10);
   return 0;
}

10
20
Compiler Error

4. Can destuctors be private in C++?

Yes
No

5. Like constructors, can there be more than one destructors in a class?

Yes
No

6. Can destructors be virtual in C++?

Yes
No

7. Inline functions are useful when

Function is large with many nested loops
Function has many static variables
Function is small and we want to avoid function call overhead.
None of the above

8. Predict the output of the following code.
#include
using namespace std;
int main ()
{
       int cin;
       cin >> cin;
       cout << "cin" << cin;
       return 0;
}

error in using cin keyword
cin+junk value
cin+input
Runtime error

9. Predict the output of the following code.
#include
using namespace std;
 
class Empty {};
 
int main()
{
  cout << sizeof(Empty);
  return 0;
}

A non-zero value.
Compiler Error
Runtime Error

10. Every class has atleast one construtor

Yes
No