I this post we have provided part 4 of the most common C++ interview questions along with answers. We recommend you to try to answer the questions, before referring to the given answer. If you find any mistake or a better alternate solution we are happy to see your suggestions and comments
1. What is template?
Ans : Template is the facility to handle more than one data type in single declaration
2. What is STL?
Ans : Standard implementation of containers
3. What is a container class?
Ans : A class that allows to have a collection of other objects
4. What are the container available in C++?
- Sequence Containers
- array (C++ 11)
- forward_list (C++ 11)
- Associative Containers
- unordered_set (C++ 11)
- unordered_multiset (C++ 11)
- unordered_map (C++ 11)
- unordered_multimap (C++ 11)
- Container Adopters
- stack (LIFO)
- queue (FIFO)
5. What is the difference between vector and deque?
Ans : In vector the elements are in continuous memory location but not continuous in deque
6. What is the difference between vector and C++ 11 STL array?
Ans : Vector can be resized and STL array cannot be resized
7. What is the difference between regular array and C++ 11 STL array?
Ans : STL array provided boundary check and is not possible in regular array
8. What is the difference between list and deque?
Ans : Deque supports random access iterator while list doen’t
9. What is a iterator?
Ans : A object that allows to access each element in a container
10. What are the different types of iterator?
- Random Access