Question
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool mygreater (int i,int j)
{
return (i > j);
}
int main ()
{
int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
vector<int> v(myints, myints + 8);
pair<vector<int> :: iterator, vector<int> :: iterator> bounds;
sort (v.begin(), v.end());
bounds = equal_range (v.begin(), v.end(), 20);
cout << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n';
return 0;
}
a.
3 and 6
b.
2 and 5
c.
3 and 5
d.
2 and 4
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. 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
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
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!