Test Series - cpp

Test Number 63/102

Q: How many items are there in sequence container?
A. 2
B. 3
C. 4
D. 5
Solution: There are five items in sequence container. They are array, vector, list, forward_list and dequeue.
Q: Which of the following class template are based on arrays?
A. vector
B. list
C. dequeue
D. both vector & dequeue
Solution: Class template vector and class template dequeue both are based on arrays.
Q: Which of the following will return the new element at the end of container?
A. front
B. back
C. push_back
D. pop_back
Solution: Q3: back() in containers are used to access the last element of the sequence.
Q: How the list containers are implemented?
A. Using Double linked list
B. Using Single linked list
C. Using Single & Double linked list
D. Using linear linked list
Solution: List containers are implemented as doubly-linked lists. Doubly linked lists can store each of the elements they contain in different and unrelated storage locations.
Q: Which of the following does not support any insertion or deletion?
A. Array
B. Vector
C. Dequeue
D. List
Solution: Because array is not dynamic in nature, So they can’t be manipulated.
Q: What do container adapter provide to interface?
A. Restricted interface
B. More interface
C. No interface
D. Memory interface
Solution: A container adapter provides a restricted interface to a container.In particular, adapters do not provide iterators; they are intended to be used only through their specialized interfaces.
Q: What does the sequence adaptor provide?
A. Insertion
B. Deletion
C. Interface to sequence container
D. Insertion & Deletion
Solution: Sequence adaptor provides interface to sequence container.
Q: Which are presented in the container adaptors?
A. stack
B. queue
C. priority_queue
D. all of the mentioned
Solution: These mentioned things are presented in container adapters.
Q: In which context does the stack operates?
A. FIFO
B. LIFO
C. Both FIFO & LIFO
D. LIFI
Solution: A stack is a container where elements operate in a LIFO context, where elements are inserted (pushed) and removed (popped) from the end of the container.
Q: Which operator is used in priority queue?
A. operator<
B. operator>
C. operator)
D. operator!
Solution: It is used to decide the priority of two elements to be inserted in the queue.

You Have Score    /10