CPP

CPP

Modifying Sequence Algorithms has 7 Questions

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 (5);
  8.         fill (myvector.begin(), myvector.begin() + 4, 5);
  9.         fill (myvector.begin() + 3,myvector.end() - 2, 8);
  10.         for (vector<int> :: iterator it = myvector.begin();
  11.             it != myvector.end(); ++it)
  12.         cout << ' ' << *it;
  13.         return 0;
  14.     }

5 5 5 5 0
8 8 8 8 0
5 8 5 8 0
5 5 5 5 5
How the sequence of objects can be accessed?

Iterators
Pointers
Both a & b
None of the mentioned
What kind of object is modifying sequence algorithm?

Function template
Class template
Method
None of the mentioned
What is the use of middle parameter in rotate method?

Marks the begining of a sequence
Marks the ending of a sequence
Marks the elements in a sequence
None of the mentioned
What operator is used to remove the dupplicates in the range?

)
^
%
==
How many kind of operation can be applied to transform method in c++?

1
2
3
4
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 ,40 };
  8.         int * p;
  9.         p = find (myints, myints + 4, 30);
  10.         --p;
  11.         cout << *p << '\n';
  12.         return 0;
  13.     }

10
20
30
40