1.

Subsequent elements are moved in terms of _____ when an element in inserted in vector?(a) Assignment Operator(b) Copy constructor(c) Both assignment operator and copy constructor(d) destructorI have been asked this question in exam.The doubt is from Sequences and Containers in chapter Algorithms, Objects & Iterators in C++ of C++

Answer»

Right option is (c) Both assignment operator and copy constructor

The explanation: The VECTOR MAINTAINS a CERTAIN order of its elements, so that when a new ELEMENT is INSERTED at the beginning or in the middle of the vector, Subsequent elements are moved backwards in terms of their assignment operator or copy constructor.



Discussion

No Comment Found

Related InterviewSolutions