Skip to main content

STL: Standard Template Library

1).What does STL stand for in C++?

1) Standard Template Library
2) Standard Type Library
3) Standard Test Library
4) None of the above

2).Which of the following is NOT a component of the C++ STL?

1) Containers
2) Algorithms
3) Iterators
4) Memory Management

3).Which header file is required for using the vector container in STL?

1) <vector>
2) <iostream>
3) <algorithm>
4) <list>

4).What type of container is std::vector?

1) Sequence container
2) Associative container
3) Container adapter
4) None of the above

5).Which STL container is best for fast insertion and deletion from both ends?

1) std::list
2) std::vector
3) std::deque
4) std::map

6).Which STL algorithm is used to find an element in a container?

1) find()
2) search()
3) locate()
4) find_element()

7).Which of the following STL containers is used for key-value pairs?

1) std::map
2) std::list
3) std::deque
4) std::vector

8).What does the std::sort() function do in STL?

1) Sorts the elements of a container
2) Reverses the container
3) Finds the maximum element
4) None of the above

9).Which function is used to remove an element from a vector in STL?

1) erase()
2) remove()
3) pop_back()
4) delete()

10).Which container type is the fastest for random access?

1) std::vector
2) std::list
3) std::deque
4) std::map