CPP

CPP

Associative Containers has 8 Questions
What do associate containers implement?

Arrays
Associative arrays
Functional Arrays
None of the mentioned
How many items are presented in the associate container?

2
3
4
5
By using which of the following the elements in the associate container can be efficiently accessed?

Key
Position
Both a & b
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std;
  5.     int main ()
  6.     {
  7.         string mystring;
  8.         bitset<4> mybits; 
  9.         mybits.set();
  10.         mystring = mybits.to_string<char, char_traits<char>, 
  11.         allocator<char> >();
  12.         cout << mystring << endl;
  13.         return 0;
  14.     }

0000
0001
0011
1111
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         set<int> myset;
  7.         myset.insert(20);
  8.         myset.insert(30);
  9.         myset.insert(10);
  10.         while (!myset.empty())
  11.         {
  12.             cout << ' ' << *myset.begin();
  13.             myset.erase(myset.begin());
  14.         }
  15.         cout << '\n';
  16.         return 0;
  17.     }

10
20
30
All of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         multiset<int> mymultiset;
  7.         for (int i = 0; i < 5; i++) mymultiset.insert(i);
  8.         multiset<int> :: key_compare mycomp = mymultiset.key_comp();
  9.         int highest = *mymultiset.rbegin();
  10.         multiset<int> :: iterator it = mymultiset.begin();
  11.         do 
  12.         {
  13.             cout << ' ' << *it;
  14.         } while (mycomp(*it++, highest));
  15.         return 0;
  16.     }

12345
01234
1234
0123
How many instance are allowed by map and set while inserting a element into container?

1
2
3
Multiple
What do maps and sets support?

Single directional iterators
Bi-directional iterators
Both a & b
None of the mentioned