CPP

CPP

Standard Library Design has 10 Questions
Pick out the wrong header file about strings.

None of the mentioned
Which is best for coding the standard libary for c++?

no trailing underscores on names
complex objects are returned by value
have a member-swap()
All of the mentioned
What is meant by vector in the container library contains?

It is a sequence container that encapsulates dynamic size arrays
It is a sequence container that encapsulates static size arrays
It manages the memory
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         vector<int> v;
  7.         v.assign( 10, 42 );
  8.         for (int i = 0; i < v.size(); i++) 
  9.         {
  10.             cout << v[i] << " ";
  11.         }
  12.     }

42
42 42
424
42 for 10 times
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std;
  5.     int main()
  6.     {
  7.         queue<char> q;
  8.         q.push('a');
  9.         q.push('b');
  10.         q.push('c');
  11.         cout << q.front();
  12.         q.pop();
  13.         cout << q.front();
  14.         q.pop();
  15.         cout << q.front();
  16.         q.pop();
  17.     }

ab
abc
a
Error
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std ;
  5.     typedef list<string> LISTSTR; 
  6.     int main()
  7.     {
  8.         LISTSTR :: iterator i;
  9.         LISTSTR test;
  10.         test.insert(test.end(), "one");
  11.         test.insert(test.end(), "two");
  12.         LISTSTR test2(test);
  13.         LISTSTR test3(3, "three");
  14.         LISTSTR test4(++test3.begin(),
  15.         test3.end());
  16.         cout << "test:";
  17.         for (i =  test.begin(); i != test.end(); ++i)
  18.             cout << " " << *i << endl;
  19.         cout << "test:";
  20.         for (i =  test2.begin(); i != test2.end(); ++i)
  21.             cout << " " << *i << endl;
  22.         cout << "test:";
  23.         for (i =  test3.begin(); i != test3.end(); ++i)
  24.             cout << " " << *i << endl;
  25.         cout << "test:";
  26.         for (i =  test4.begin(); i != test4.end(); ++i)
  27.             cout << " " << *i << endl;
  28.     }

test
test one
test two
None of the mentioned
Pick out the wrong header file.

<algorithm>

<containers>

<iterators>

<process>

What is meant by standard c++ library?

It is the collection of class definitions for standard data structures and a collection of algorithms
It is a header file
Both a & b
None of the mentioned
What is the use of header

Contains the standard exception files
Contains the standard library files
It is used to arise an exception in the program
None of the mentioned
Pick out parameter for rehash method in unordered_set in c++?

count
size
hash
None of the mentioned