Q: How many list sequence containers are provided by STL?
Solution: There are two list sequence containers are provided by STL namely forward_list and list.
Q: Which type of list a Forward_list sequence container implements?
Solution: Forward_list sequence container implements a Singly Linked List.
Q: Which type of list a List sequence container implements?
Solution: List sequence container implements Doubly Linked List.
Q: Which of the following header file is required for forwawrd_list?
Solution: One needs to implementheader file to use forward_list in a program.
Q: Which of the following(s) is/are the correct way of assigning values to a forward_list f?
Solution: Both f.assign({1,2,3,4,5}) and f.assign(10,5) are correct way of assigning values to a forward_list. The first assignment initializes the list with the elements 1,2,3,4 and 5 whereas the second assignment initializes the list 10 elements with value 5 i.e. 5 10 times.
Q: How the list differs from vectors?
Solution: List is non-contiguous that means elements of a list are not the contiguous manner in memory. Insertion in a list is constant for because we are not increasing the size of the list anywhere which was the case of a vector. Vectors have a capacity defined whereas there is no such capacity defined for Lists.
Q: What is the syntax of declaraing a forward_list?
Solution: forward_listf; is the correct syntax of declaring a forward-list.
Q: What is a pair?
Solution: Pair is a container defined in STL which consist of two elements which can be of same or different types.
Q: Which header file is required to use pair container in your program?
Solution: Pair container is defined under the header filetherefore one should include header before using pair container.
Q: Which of the following is the correct syntax of using pair p?
Solution: A pair is declared using the this syntax pairidentifier.
You Have Score    | /10 |