Are vectors faster than arrays?



Are vectors faster than arrays?..

Answer / Anand Kumar Shaw

In C++, both vectors and arrays have their own advantages and disadvantages when it comes to performance. Vectors offer convenience with built-in functions for operations like push_back, pop_back, resize, etc., but they may not always be faster than arrays due to the additional overhead of managing dynamic memory.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

print first nodd numbers in descending order

7 Answers  


Is rust better than c++?

1 Answers  


i have given a project to create examination seating plan system in c++. so can anyone send me the answer of this question quickly??????

1 Answers  


Does c++ support multilevel and multiple inheritances?

1 Answers  


Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?

1 Answers  


What does the linker do?

1 Answers  


Write about the members that a derived class can add?

1 Answers  


Can you explain the term "resource acquisition is initialization?"

1 Answers   Amazon,


What is wrapper class in c++?

1 Answers  


What are friend classes?

1 Answers  


class professor {}; class teacher : public virtual professor {}; class researcher : public virtual professor {}; class myprofessor : public teacher, public researcher {}; Referring to the sample code above, if an object of class "myprofessor" were created, how many instances of professor will it contain? a) 0 b) 1 c) 2 d) 3 e) 4

4 Answers   Quark,


How would you represent an error detected during constructor of an object?

1 Answers  


Categories