Question
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int i,int j)
{
return (i < j);
}
int main ()
{
int myints[] = {9, 8, 7, 6};
vector<int> myvector (myints, myints + 4);
partial_sort (myvector.begin(), myvector.begin() + 2, myvector.end());
partial_sort (myvector.begin(), myvector.begin() + 2, myvector.end(),
myfunction);
for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it)
cout << ' ' << *it;
return 0;
}
a.
6 7 8 9
b.
9 8 6 7
c.
6 7 9 8
d.
None of the mentioned
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. What is the use of includes function in c++?
View solution
Q. How many parameters are required for sort_heap function?
View solution
Q. How many categories of iterators are there in c++?
View solution
Q. Which of the following can serve as random-access iterator?
View solution
Q. What kind of pattern is iterator pattern?
View solution
Q. In which type of semantics does c++ implements iterator?
View solution
Q. By using which operator does point to next element is represent in
View solution
Q. What is the use of checked iterators?
View solution
Q. What will happen if the iterator is unchecked?
View solution
Q. How many adaptors support the checked iterators?
View solution
Q. What does the checked iterator allow you to find?
View solution
Q. What kind of errors do checked iterators detect?
View solution
Q. Where are allocators used?
View solution
Q. Where are allocators implemented?
View solution
Q. Which operator is used to allocate the memory?
View solution
Q. Which operator is used to deallocate the memory?
View solution
Q. Which header file is used to manipulate the allocater?
View solution
Q. What is the use of reference member type in allocator?
View solution
Q. What is the correct syntax for declaring an allocator?
View solution
Q. The break statement is used in
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!