61. What will be the output of the following C++ code?
#include <iostream>
#include <set>
using namespace std;
int main ()
{
set<int> myset;
myset.insert(20);
myset.insert(30);
myset.insert(10);
while (!myset.empty())
{
cout << ' ' << *myset.begin();
myset.erase(myset.begin());
}
cout << '\n';
return 0;
}
#include <iostream>
#include <set>
using namespace std;
int main ()
{
set<int> myset;
myset.insert(20);
myset.insert(30);
myset.insert(10);
while (!myset.empty())
{
cout << ' ' << *myset.begin();
myset.erase(myset.begin());
}
cout << '\n';
return 0;
}62. How the list differs from vectors?
63. Which alternative can replace the throw statement?
64. What type of algorithm is not available in creating our own STL style algorithms?
65. What will be the output of the following C++ code?
#include<iostream>
#include<any>
using namespace std;
int main()
{
float val = 5.5;
any var(val);
cout<<var<<endl;
char c = 'a';
var.emplace<char>(c);
cout<<var<<endl;
return 0;
}
#include<iostream>
#include<any>
using namespace std;
int main()
{
float val = 5.5;
any var(val);
cout<<var<<endl;
char c = 'a';
var.emplace<char>(c);
cout<<var<<endl;
return 0;
}66. Which operator is used as not operator in bitset?
67. What will be the output of the following C++ code?
#include <iostream>
#include <utility>
using namespace std;
int main ()
{
pair p(1,2);
cout<<"Pair(first,second) = ("<<p.first<<","<<p.second<<")\n";
return 0;
}
#include <iostream>
#include <utility>
using namespace std;
int main ()
{
pair p(1,2);
cout<<"Pair(first,second) = ("<<p.first<<","<<p.second<<")\n";
return 0;
}68. What will be the output of the following C++ code?
#include <iostream>
#include <stack>
using namespace std;
int main ()
{
stack<int> myints;
cout << (int) myints.size();
for (int i = 0; i < 5; i++) myints.push(i);
cout << (int) myints.size() << endl;
return 0;
}
#include <iostream>
#include <stack>
using namespace std;
int main ()
{
stack<int> myints;
cout << (int) myints.size();
for (int i = 0; i < 5; i++) myints.push(i);
cout << (int) myints.size() << endl;
return 0;
}69. What is the use of sort_heap() function in heap?
70. What is the use of sum() function in Valarray?
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
