--:--









Quiz for Containers vector

Course: C++ Language | Subject: Unit 11 | Topic: The Standard Template Library (STL)



Logo

Q1: What type of container is vector in STL?

Logo

Q2: Which operation is efficient with vector?

Logo

Q3: What happens to vector size when elements are added?

Logo

Q4: Which STL vector function removes the last element?

Logo

Q5: Which iterator category does vector support?

Logo

Q6: What is the time complexity of adding an element at the end of a vector?

Logo

Q7: How does vector store its elements?

Logo

Q8: Which method returns the current number of elements in a vector?

Logo

Q9: Which method returns the maximum number of elements vector can hold without resizing?

Logo

Q10: What does the reserve() method do in a vector?

Logo

Q11: Which of the following is NOT a valid vector method?

Logo

Q12: Which STL container is preferred over vector for frequent insertions/removals at both ends?

Logo

Q13: If a vector needs to grow, what generally happens internally?

Logo

Q14: Which of these is the default initial capacity behavior of a vector?

Logo

Q15: What is the complexity of accessing an element at index i in a vector?

Logo

Q16: Which STL vector method erases all elements?

Logo

Q17: Which vector method adds an element at the end?

Logo

Q18: What does the at() method in vector do?

Logo

Q19: Which of the following is true about vectors?

Logo

Q20: What happens if you access an out-of-bounds index using operator[] in vector?

Are you ready to start test? Set your time limit