1.

Which of the following function is used to get the actual number of elements stored in vector?(a) v.size()(b) v.capacity()(c) v.max_size()(d) v.no_of_elements()The question was asked by my college director while I was bunking the class.Origin of the question is seq_con Vector Class topic in portion Class Hierarchies, Library & Containers of C++

Answer»

The correct answer is (a) 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.



Discussion

No Comment Found

Related InterviewSolutions