51. Pick out parameter for rehash method in unordered_set in c++?
52. What are Container Adaptors?
53. What are Unordered Associative Containers?
54. How does the limits.h header file can be represented in C++?
55. What will be the output of the following C++ code?
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
v.assign( 10, 42 );
for (int i = 0; i < v.size(); i++)
{
cout << v[i] << " ";
}
}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
v.assign( 10, 42 );
for (int i = 0; i < v.size(); i++)
{
cout << v[i] << " ";
}
}
56. Pick out the wrong header file.
57. What will be the output of the following C++ code?
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char s[] = "365.24 29.53";
char* p;
double d1, d2;
d1 = strtod (s, &p);
d2 = strtod (p, NULL);
printf ("%.2f\n", d1/d2);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char s[] = "365.24 29.53";
char* p;
double d1, d2;
d1 = strtod (s, &p);
d2 = strtod (p, NULL);
printf ("%.2f\n", d1/d2);
return 0;
}
58. What will be the output of the following C++ code?
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
queue<char> q;
q.push('a');
q.push('b');
q.push('c');
cout << q.front();
q.pop();
cout << q.front();
q.pop();
cout << q.front();
q.pop();
}
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
queue<char> q;
q.push('a');
q.push('b');
q.push('c');
cout << q.front();
q.pop();
cout << q.front();
q.pop();
cout << q.front();
q.pop();
}
59. What will be the output of the following C++ code?
#include <list>
#include <string>
#include <iostream>
using namespace std ;
typedef list<string> LISTSTR;
int main()
{
LISTSTR :: iterator i;
LISTSTR test;
test.insert(test.end(), "one");
test.insert(test.end(), "two");
LISTSTR test2(test);
LISTSTR test3(3, "three");
LISTSTR test4(++test3.begin(),
test3.end());
cout << "test:";
for (i = test.begin(); i != test.end(); ++i)
cout << " " << *i << endl;
cout << "test:";
for (i = test2.begin(); i != test2.end(); ++i)
cout << " " << *i << endl;
cout << "test:";
for (i = test3.begin(); i != test3.end(); ++i)
cout << " " << *i << endl;
cout << "test:";
for (i = test4.begin(); i != test4.end(); ++i)
cout << " " << *i << endl;
}
#include <list>
#include <string>
#include <iostream>
using namespace std ;
typedef list<string> LISTSTR;
int main()
{
LISTSTR :: iterator i;
LISTSTR test;
test.insert(test.end(), "one");
test.insert(test.end(), "two");
LISTSTR test2(test);
LISTSTR test3(3, "three");
LISTSTR test4(++test3.begin(),
test3.end());
cout << "test:";
for (i = test.begin(); i != test.end(); ++i)
cout << " " << *i << endl;
cout << "test:";
for (i = test2.begin(); i != test2.end(); ++i)
cout << " " << *i << endl;
cout << "test:";
for (i = test3.begin(); i != test3.end(); ++i)
cout << " " << *i << endl;
cout << "test:";
for (i = test4.begin(); i != test4.end(); ++i)
cout << " " << *i << endl;
}
60. What is the use of header
Read More Section(Standard Template Library (STL) in C plus plus)
Each Section contains maximum 100 MCQs question on Standard Template Library (STL) in C plus plus. To get more questions visit other sections.