Questions and Answers
- What type of class template is list?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
It is node-based because it allows efficient insertion anywhere on the program.
- To what type of object does the container can be instantiated?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
any type of object
- What kind of library is Standard Template Library?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The STL is a generic library, meaning that its components are heavily parameterized.
- What is the output of this program?
#include <iostream>
#include <set>
using namespace std;
int main ()
{
multiset<int> MultisetData;
for (int k = 0; k < 6; k++) MultisetData.insert(k);
multiset:: key_compare compare = MultisetData.key_comp();
int highest = *MultisetData.rbegin();
multiset:: iterator Iter = MultisetData.begin();
do
{
cout << ' ' << *Iter;
} while (compare(*Iter++, highest));
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
In this program, We used the set template and then we compared the keys and printing the result.
- What is the output of this program?
#include <iostream>
#include <set>
using namespace std;
int main ()
{
set<int> SetData;
SetData.insert(25);
SetData.insert(15);
SetData.insert(45);
SetData.insert(35);
SetData.insert(55);
while (!SetData.empty())
{
cout << ' ' << *SetData.begin();
SetData.erase(SetData.begin());
}
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
In this program, We used the set template and then we are initializing the values and then we are erasing it.