42.
Pick the correct statement.

44.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
ostream & operator<<(ostream & i, int n)
{
    return i;
}
int main()
{
    cout << 5 << endl;
    cin.get();
    return 0;
}

45.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class Box{
    int capacity;
    bool operator<(Box b){
	return this->capacity < b.capacity ? true : false;
    }
public:
    Box(){}
    Box(double capacity){
	this->capacity = capacity;
    }
};
int main(int argc, char const *argv[])
{
    Box b1(10);
    Box b2 = Box(14);
    if(b1 < b2){
	cout<<"Box 2 has large capacity.";
    }
   else{
	cout<<"Box 1 has large capacity.";
    }
    return 0;
}

47.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main ()
{
    int a, b;         
    a = 10;           
    b = 4;            
    a = b;           
    b = 7;           
    cout << "a:";
    cout << a;
    cout << " b:";
    cout << b;
    return 0;
}

48.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
  std::string str ("Example.");
  str.back() = '!';
  std::cout << str << endl;
  return 0;
}

Read More Section(Classes and Objects in C plus plus)

Each Section contains maximum 100 MCQs question on Classes and Objects in C plus plus. To get more questions visit other sections.