Vidyalelo
C++ Programming · Q902

C++ miscellaneous

Programming · C++ Programming · question 902

Q902

What will be the capacity of vector at the end in the following C++ code? #include #include using namespace std; int main() vector v; for (int i = 1; i <= 5; i++) v.push_back(i); v.reserve(50); cout<<v.capacity(); return 0;

A.
10
B.
8
C.
50
Answer
D.
60

Answer: Option C

Solution

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