CPP

CPP

Standard Library Algorithms has 9 Questions
What is the header file used for declaring the standard library algorithms?

container
algorithm
library
None of the mentioned
Pick out the correct method in the c++ standard library algorithm.

mismatch
maximum
minimum
None of the mentioned
What is the use of make_heap in the heap operation?

Rearrange a heap
Deform a heap
Form a heap
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.         int first[] = {5, 10, 15, 20, 25};
  8.         int second[] = {50, 40, 30, 20, 10};
  9.         vector<int> v(10);      
  10.         vector<int> :: iterator it;
  11.         sort (first, first + 5);   
  12.         sort (second, second + 5); 
  13.         it = set_union (first, first + 5, second, second + 5, v.begin());
  14.         cout << int(it - v.begin());
  15.         return 0;
  16.     }

6
7
8
9
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std;
  5.     int main () 
  6.     {
  7.         int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
  8.         int mycount = count (myints, myints + 8, 10);
  9.         cout << "10 appears " << mycount << " times.\n";
  10.         vector<int> myvector (myints, myints+8);
  11.         mycount = count (myvector.begin(), myvector.end(), 20);
  12.         cout << "20 appears " << mycount  << " times.\n";
  13.         return 0;
  14.     }

3 3
3 1
8
None of the mentioned
What is the output of this program?
  1.     #include  
  2.     #include 
  3.     using namespace std;
  4.     int main () 
  5.     {
  6.         int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};  
  7.         int* pbegin = myints;                      
  8.         int* pend = myints + sizeof(myints) / sizeof(int);
  9.         pend = remove (pbegin, pend, 20);      
  10.         for (int* p = pbegin; p != pend; ++p)
  11.             cout << ' ' << *p;
  12.         return 0;
  13.     }

10, 20, 30, 30, 20, 10, 10, 20
10, 30, 30, 10, 10
10, 20, 20, 10, 10, 10, 20
None of the mentioned
What is the type of the first item in the heap?

Bigger than others
Lower than others
Mean value of the heap
None of the mentioned
Pick out the correct library in the following choices.

Search
Generate
Numeric
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.         vector<int> myvector;
  8.         for (int i = 1; i < 6; ++i) 
  9.             myvector.push_back(i);
  10.         reverse(myvector.begin(), myvector.end());
  11.         for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it)
  12.             cout << ' ' << *it;
  13.         return 0;
  14.     }

1 2 3 4 5
5 4 3 2 1
0 1 2 3 4
None of the mentioned