Test Series - cpp

Test Number 64/102

Q: What do associate containers implement?
A. Arrays
B. Associative arrays
C. Functional Arrays
D. Static arrays
Solution: Associative containers refer to a group of class templates in the standard library of the C++ programming language that implements ordered associative arrays.
Q: By using which of the following the elements in the associate container can be efficiently accessed?
A. Key
B. Position
C. Both Key & Position
D. Value
Solution: Associative containers are designed to be especially efficient in accessing its elements by their key, as opposed to sequence containers which are more efficient in accessing elements by their position.
Q: How many items are presented in the associate container?
A. 2
B. 3
C. 4
D. 5
Solution: There are 4 items presented in the associate container. They are set, multiset, map and multimap.
Q: How many instances are allowed by map and set while inserting an element into container?
A. 1
B. 2
C. 3
D. Multiple
Solution: Both map and set only allow one instance of a key or element to be inserted into the container.
Q: What do maps and sets support?
A. Single directional iterators
B. Bi-directional iterators
C. Single & Bi-directional directional iterators
D. functional iterators
Solution: Bi-directional iterator are used to move in both direction from any element i.e. both forward and backward movements are allowed.
Q: What kind of library is Standard Template Library?
A. Polymorphic
B. Generic
C. Both Polymorphic & Generic
D. Virtual
Solution: The STL is a generic library, meaning that its components are heavily parameterized.
Q: To what type of object does the container can be instantiated?
A. int
B. float
C. double
D. any type of object
Solution: All type of object does the container can be instantiated.
Q: What type of class template is list?
A. Class-based
B. Node-based
C. Method-based
D. size-based
Solution: It is node-based because it allows for efficient insertion anywhere in the program.
Q: What type of access does deque and vector provide?
A. Linear access
B. Parallel access
C. Random access
D. Memory access
Solution: Because they can manipulate the values on anywhere in the program, So it is providing random access.
Q: Where does the vector add the item?
A. End
B. Insert
C. Middle
D. Start
Solution: Vector allows insertion of element at the end.

You Have Score    /10