32.
What will be the output of the following C++ code?
#include <iostream> 
#include <string>
using namespace std; 
int main(int argc, char const *argv[])
{
	string str;
	cin>>str;
	cout<<str;
	return 0;
}

33.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
 
class A
{
	mutable int a;
 
        public:
	int assign(int i) const {
		a = i;
	}
	int return_value() const {
		return a;
	}
 
};
 
int main(int argc, char const *argv[])
{
	A obj;
	obj.assign(5);
	cout<<obj.return_value();
}

35.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
  string str ("helloworld.");
  cout << str.substr(3).substr(4) << endl;
  return 0;
}

36.
What will be the output of the following C++ code?
#include <iostream> 
#include <string>
using namespace std; 
int main(int argc, char const *argv[])
{
	char str[] = "Hello World";
	cout<<str[0];
	return 0;
}

37.
Pick the correct statement about string objects in C++.

40.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int a = 0;
    int b = 10;
    if ( a && b )
    {
        cout << "true"<< endl ;
    }
    else
    {
         cout << "false"<< 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.