Vidyalelo
C++ Programming · Q710

C++ miscellaneous

Programming · C++ Programming · question 710

Q710

What will be the output of the following C++ code? #include #include #include using namespace std; int main () int myints[] = 10, 20, 30, 30, 20, 10, 10, 20; vector v(myints, myints + 8); sort (v.begin(), v.end()); vector :: iterator low, up; low = lower_bound (v.begin(), v.end(), 20); up = upper_bound (v.begin(), v.end(), 20); cout << (low - v.begin()) << ' '; cout << (up - v.begin()) << ' '; return 0;

A.
3 6
Answer
B.
2 5
C.
2 6
D.
2 4

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board