Standard Template Library

11. Which C++ STL container automatically maintains elements in sorted order?
  • A. Vector
  • B. Set
  • C. List
  • D. Queue

Set

Set

12.How can we iterate over all elements in a vector in C++ STL using an iterator?
  • A. Using for loop with index.
  • B. Using an iterator object and begin() and end() functions.
  • C. Using the foreach loop.
  • D. Using the next() function.

Using an iterator object and begin() and end() functions.

Using an iterator object and begin() and end() functions.

13.Which C++ STL container is best suited for implementing a stack?
  • A. Queue
  • B. Vector
  • C. List
  • D. Deque

Deque

Deque

14.Which function is used to check whether a map contains a key in C++ STL?
  • A. contains()
  • B. find()
  • C. exists()
  • D. has_key()

find()

find()

15.Which of the following operations is NOT supported by the queue container in C++ STL?
  • A. push()
  • B. pop()
  • C. front()
  • D. insert()

insert()

insert()