1.

Which function is used to get the total capacity of a vector?(a) v.size()(b) v.capacity()(c) v.max_size()(d) v.no_of_elements()This question was addressed to me during a job interview.This intriguing question comes from seq_con Vector Class in section Class Hierarchies, Library & Containers of C++

Answer»

Correct CHOICE is (b) v.capacity()

The best explanation: capacity() FUNCTION is used to get the total number of elements that can be stored at PRESENT in the vector.



Discussion

No Comment Found

Related InterviewSolutions