Question
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return (i % 2) == 1;
}
int main ()
{
vector<int> myvector;
for (int i = 1; i < 10; ++i) myvector.push_back(i);
vector<int> :: iterator bound;
bound = partition (myvector.begin(), myvector.end(), IsOdd);
for (vector<int> :: iterator it = myvector.begin(); it != bound; ++it)
cout << ' ' << *it;
return 0;
}
a.
1 3 5
b.
1 3 9
c.
1 9 3 7
d.
1 9 3 7 5
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. When does the next sequence point start?
View solution
Q. What is meant by heap?
View solution
Q. Which value is pointed out first in heap?
View solution
Q. Which operator is used to compare the elements in heap?
View solution
Q. How to protect the heap from affecting the memory?
View solution
Q. In what form does the STL provides heap?
View solution
Q. How many types are there in binary heaps?
View solution
Q. Which keyword is used to declare the min and max functions?
View solution
Q. What kind of functions are min and max in c++?
View solution
Q. How many parameters are needed for minmax function?
View solution
Q. Which function is used to return the minimum element in the range?
View solution
Q. Which operator is used to compare the values to find min and max?
View solution
Q. What is meant by permutation in c++?
View solution
Q. How the different permutations are ordered in c++?
View solution
Q. Pick out the correct statement about permutation.
View solution
Q. What is the header file for vector permutation?
View solution
Q. How many parameters are required for next_permutation?
View solution
Q. Pick out the in correct type of function in header file.
View solution
Q. What type of algorithm is not available in creating our own STL style algorithms?
View solution
Q. What is meant by hash tables in C++?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!