73.
What will be the output of the following C++ code?
#include <stdio.h> 
#include<iostream>
using namespace std;
int main()
{
    int x = 5, y = 5;
    cout << ++x << --y << endl;
    return 0;
}

75.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class base
{
    int val1, val2;
    public:
    int get()
    {
        val1 = 100;
        val2 = 300;
    }
    friend float mean(base ob);
};
float mean(base ob)
{
    return float(ob.val1 + ob.val2) / 2;
}
int main()
{
    base obj;
    obj.get();
    cout << mean(obj);
    return 0;
}

76.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class complex
{
    int i;
    int j;
    public:
    complex(int a, int b)
    {
	i = a;
	j = b;
    }
    complex operator+(complex c)
    {
	complex temp;
	temp.i = this->i + c.i;
	temp.j = this->j + c.j;
	return temp;
    }
    void show(){
	cout<<"Complex Number: "<<i<<" + i"<<j<<endl;
    }
};
int main(int argc, char const *argv[])
{
    complex c1(1,2);
    complex c2(3,4);
    complex c3 = c1 + c2;
    c3.show();
    return 0;
}

78.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class sample1 
{
    float i, j;
};
class sample2 
{
    int x, y;
    public:
    sample2 (int a, int b) 
    {
         x = a; 
         y = b;
    }
    int result() 
    { 
         return x + y;
     }
};
int main () 
{
    sample1 d;
    sample2 * padd;
    padd = (sample2*) &d;
    cout<< padd->result();
    return 0;
}

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

80.
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
	static int a;
    public:
	void change(int i){
		a = i;
	}
	void value_of_a(){
		cout<<a;
	}
};
 
int A::a = 5;
 
int main(int argc, char const *argv[])
{
	A a1 = A();
	A a2 = A();
	A a3 = A();
	a1.change(10);
	a1.value_of_a();
	a2.value_of_a();
	a3.value_of_a();
	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.