CPP

CPP

Defining a New Container has 10 Questions

What do all STL containers define?

Iterator types
Begin methods
End methods
All of the mentioned
What do we return if we use simple array on a internal container?

Methods
Pointers
Objects
None of the mentioned
What is mandatory for designing a new container?

Classes
Iterators
Container
None of the mentioned
How many iterators are needed for the defining a new container?

1
2
3
4
How many types of container classes are there in c++?

1
2
3
As many as possible
What is the use of the allocater interface in the user-defined container?

Storage management
Memory management
Both a & b
None of the mentioned
What is the name of the container which contains group of multiple objects?

Heterogeneous container
Homogeneous container
Both a & b
None of the mentioned
What are the design requirements for building a container from the sratch?

Container interface requirements
Allocator interface requirements
Iterator requirements.
All 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 s = "spaces in text";
  8.         s.erase(remove(s.begin(), s.end(), ' ' ), s.end() ) ;
  9.         cout << s << endl;
  10.     }

spaces
spaces in
spaces in text
spacesintext
What is the output of this program?
  1.     #include  
  2.     #include 
  3.     #include 
  4.     #include 
  5.     using namespace std;
  6.     int square(int i) { return i * i; }
  7.     int main()
  8.     {
  9.         vector<int> V, V2;
  10.         V.push_back(0);
  11.         V.push_back(1);
  12.         V.push_back(2);
  13.         transform(V.begin(), V.end(), back_inserter(V2), square);
  14.         copy(V2.begin(), V2.end(), ostream_iterator<int>(cout, " "));
  15.         cout << endl;
  16.     }

0
1
2
0 1 4