Q: Unordered map is implemented using _________________
Solution: As unordered map has no order of keys therefore hash table is used to store key-value pairs in a hash table.
Q: Map is implemented using ________________
Solution: The map has some order of stored keys therefore red black tree is used to maintain that order and access the elements as soon as possible.
Q: Which of the following is correct about the map and unordered map?
Solution: All the above mentioned points are correct about maps and unordered maps. Maps uses red-black tree whereas unordered map uses hash tables therefore the average search time for the unordered map is O(1) whereas it is O(logn) in case of maps.
Q: Which of the following queue container can expand or shrink from both directions?
Solution: Deque is a short form for a doubly ended queue which can be expanded and shrinked from any side of the queue either from the front or from the back.
Q: Which of the following is correct about map and multimap?
Solution: Multimap is similar to map, the only difference that they have is that in multimap elements can have the same keys where in the map we have only one to one key-value pair correspondence.
Q: What is the header file used for declaring the standard library algorithms?
Solution: C++ Standard Library, algorithms are components that perform algorithmic operations on containers and other sequences. For this operation, We have to useheader file.
Q: Pick out the correct method in the c++ standard library algorithm.
Solution: It is a method in the search operation in standard library algorithms.
Q: What is the use of make_heap in the heap operation?
Solution: It is used to rearranges a range so that it becomes a heap.
Q: What is the type of the first item in the heap?
Solution: In C++, when we say heap we mean max heap and first element of max is bigger than others.
Q: Pick out the correct library in the following choices.
Solution: These are the available libraries in C++.
You Have Score    | /10 |