11. Which header file is used to operate on numeric sequences?
12. What will be the output of the following C++ code?
#include <typeinfo>
#include <iostream>
using namespace std;
class A
{
public:
virtual ~A();
};
int main()
{
A* a = NULL;
try
{
cout << typeid(*a).name() << endl;
}
catch (bad_typeid)
{
cout << "Object is NULL" << endl;
}
}
#include <typeinfo>
#include <iostream>
using namespace std;
class A
{
public:
virtual ~A();
};
int main()
{
A* a = NULL;
try
{
cout << typeid(*a).name() << endl;
}
catch (bad_typeid)
{
cout << "Object is NULL" << endl;
}
}
13. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class student
{
public:
int rno , m1 , m2 ;
protected:
void get()
{
rno = 15, m1 = 10, m2 = 10;
}
};
class sports
{
public:
int sm;
void getsm()
{
sm = 10;
}
};
class statement : public student, public sports
{
int tot, avg;
public:
void display()
{
tot = (m1 + m2 + sm);
avg = tot / 3;
cout << tot;
cout << avg;
}
void setObject()
{
get();
}
};
int main()
{
statement obj;
obj.setObject();
obj.getsm();
obj.display();
}
#include <iostream>
using namespace std;
class student
{
public:
int rno , m1 , m2 ;
protected:
void get()
{
rno = 15, m1 = 10, m2 = 10;
}
};
class sports
{
public:
int sm;
void getsm()
{
sm = 10;
}
};
class statement : public student, public sports
{
int tot, avg;
public:
void display()
{
tot = (m1 + m2 + sm);
avg = tot / 3;
cout << tot;
cout << avg;
}
void setObject()
{
get();
}
};
int main()
{
statement obj;
obj.setObject();
obj.getsm();
obj.display();
}
14. In sequence point, how will the overloaded operators behave like?
15. Which operator is used in priority queue?
16. What will be the output of the following C++ code?
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
for (int i = 1; i <= 5; i++)
v.push_back(i);
v.resize(4);
for (auto it = v.begin(); it != v.end(); it++)
cout << *it << " ";
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
for (int i = 1; i <= 5; i++)
v.push_back(i);
v.resize(4);
for (auto it = v.begin(); it != v.end(); it++)
cout << *it << " ";
return 0;
}
17. What are Bi-directional iterators?
18. What is the name of the container which contains group of multiple objects?
19. What will be the output of the following C++ code?
#include <iostream>
#include <utility>
#include <string>
using namespace std;
int main ()
{
pair <int,int> p1(1,2);
pair <int,int> p2(3,4);
if(p1 <= p2)
cout<<"P1 is small";
else
cout<<"P2 is small";
return 0;
}
#include <iostream>
#include <utility>
#include <string>
using namespace std;
int main ()
{
pair <int,int> p1(1,2);
pair <int,int> p2(3,4);
if(p1 <= p2)
cout<<"P1 is small";
else
cout<<"P2 is small";
return 0;
}
20. What is the use of reset() function?
Read More Section(C plus plus miscellaneous)
Each Section contains maximum 100 MCQs question on C plus plus miscellaneous. To get more questions visit other sections.
- C plus plus miscellaneous - Section 1
- C plus plus miscellaneous - Section 2
- C plus plus miscellaneous - Section 3
- C plus plus miscellaneous - Section 4
- C plus plus miscellaneous - Section 5
- C plus plus miscellaneous - Section 6
- C plus plus miscellaneous - Section 7
- C plus plus miscellaneous - Section 8
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11