CPP MCQ
Which of the following function is used to get the actual number of elements stored in vector?
A)
v.capacity()
B)
v.size()
C)
v.max_size()
D)
v.no_of_elements()

Correct Answer : Option (B) :   v.size()

Explanation : To get the number of elements stored in the vector v we use the function v.size(). It returns how many elements are currently in the vector excluding the void places.