Que- 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
Answer- Using Double linked list
Que- Which of the following does not support any insertion or deletion?
a. Array
b. Vector
c. Dequeue
d. List
Answer- Array
Que- What do container adapter provide to interface?
a. Restricted interface
b. More interface
c. No interface
d. Memory interface
Answer- Restricted interface
Que- What does the sequence adaptor provide?
a. Insertion
b. Deletion
c. Interface to sequence container
d. Insertion & Deletion
Answer- Interface to sequence container
Que- Which are presented in the container adaptors?
a. stack
b. queue
c. priority_queue
d. all of the mentioned
Answer- all of the mentioned
Que- In which context does the stack operates?
a. FIFO
b. LIFO
c. Both FIFO & LIFO
d. LIFI
Answer- LIFO
Que- Which operator is used in priority queue?
a. operator<
b. operator>
c. operator)
d. operator!
Answer- operator<
Que- What do associate containers implement?
a. Arrays
b. Associative arrays
c. Functional Arrays
d. Static arrays
Answer- Associative arrays
Que- 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
Answer- Key
Que- How many items are presented in the associate container?
a. 2
b. 3
c. 4
d. 5
Answer- 4
Que- How many instances are allowed by map and set while inserting an element into container?
a. 1
b. 2
c. 3
d. Multiple
Answer- 1
Que- What do maps and sets support?
a. Single directional iterators
b. Bi-directional iterators
c. Single & Bi-directional directional iterators
d. functional iterators
Answer- Bi-directional iterators
Que- What kind of library is Standard Template Library?
a. Polymorphic
b. Generic
c. Both Polymorphic & Generic
d. Virtual
Answer- Generic
Que- To what type of object does the container can be instantiated?
a. int
b. float
c. double
d. any type of object
Answer- any type of object
Que- What type of class template is list?
a. Class-based
b. Node-based
c. Method-based
d. size-based
Answer- Node-based
Que- What type of access does deque and vector provide?
a. Linear access
b. Parallel access
c. Random access
d. Memory access
Answer- Random access
Que- Where does the vector add the item?
a. End
b. Insert
c. Middle
d. Start
Answer- End
Que- Which are not full container classes in c++?
a. Sequence container
b. Associative container
c. Container adaptor
d. iterative container
Answer- Container adaptor
Que- What is the lifetime of the element in container?
a. Whole program
b. Outside the block
c. Everywhere
d. Only on that container
Answer- Only on that container
Que- What do all STL containers define?
a. Iterator types
b. Begin methods
c. End methods
d. All of the mentioned
Answer- All of the mentioned
Que- What do we return if we use simple array on a internal container?
a. Methods
b. Pointers
c. Objects
d. Values
Answer- Pointers
Que- What is mandatory for designing a new container?
a. Classes
b. Iterators
c. Container
d. Variables
Answer- Iterators
Que- What are the design requirements for building a container from the sratch?
a. Container interface requirements
b. Allocator interface requirements
c. Iterator requirements
d. All of the mentioned
Answer- All of the mentioned
Que- How many iterators are needed for the defining a new container?
a. 1
b. 2
c. 3
d. 4
Answer- 3
Que- What is the use of the allocator interface in the user-defined container?
a. Storage management
b. Memory management
c. Storage & Memory management
d. Iterator management
Answer- Storage management
Que- How many types of container classes are there in c++?
a. 1
b. 2
c. 3
d. As many as possible
Answer- 2
Que- What is the name of the container which contains group of multiple objects?
a. Heterogeneous container
b. Homogeneous container
c. Both Homogeneous & Heterogeneous container
d. Sequence container
Answer- Heterogeneous container
Que- What is sequence container arrays?
a. C-like arrays
b. Template class sequence container, alternative for C-like arrays
c. Collection of data of the same type
d. Collection of objects
Answer- Template class sequence container, alternative for C-like arrays
Que- Pick the correct statement.
a. Sequence Container arrays know (somehow stores within) its size whereas C-like arrays do not
b. Sequence Container arrays have no advantage over C-like arrays
c. Sequence Container arrays are same as C-like arrays
d. Sequence Container arrays are also present in C
Answer- Sequence Container arrays know (somehow stores within) its size whereas C-like arrays do not
Que- Which of the following is/are advantage(s) of Sequence Container arrays over C-like arrays?
a. Sequence Container arrays store its size within itself whereas C-like arrays do not
b. Sequence Container arrays are more efficient
c. Sequence Container arrays have no array decay problem whereas C-like arrays do have
d. All of the mentioned
Answer- All of the mentioned
Que- Which of the follwoing function(s) of Array classes are similar to [] operator?
a. at()
b. get()
c. both at() and get()
d. front()
Answer- both at() and get()
Que- How many different ways are there to access an element of array classes at the ith position?
a. 1
b. 2
c. 3
d. 4
Answer- 3
Que- What header file is included to use array classes?
a. <array>
b. <Array>
c. <algorithm>
d. <ARRAY>
Answer- <array>
Que- What is the correct syntax of declaring an array class?
a. array<type> arr;
b. array<type,size> arr;
c. Array<type> arr;
d. Array<type,size> arr;
Answer- array<type,size> arr;
Que- What is the syntax of printing the first element of an array Arr using get() function?
a. Arr.get(0)
b. get<0>(Arr)
c. Arr.get[0]
d. get<0>[Arr]
Answer- get<0>(Arr)
Que- Which header file is required to use get() function?
a. <array>
b. <tuple>
c. <Array>
d. <access>
Answer- <tuple>
Que- What is the difference between get() and at()?
a. at() is available under <array> header file whereas get() is available under <tuple> header file
b. at() is a member function of array class whereas get() is not
c. get() takes array class as a parameter whereas at() takes a constant integer(i.e. index) as a parameter
d. all of the mentioned
Answer- all of the mentioned
Que- Which function is used to access the first element of an array class?
a. front()
b. start()
c. back()
d. first()
Answer- front()
Que- Which function is used to access the last element of an array class?
a. end()
b. start()
c. back()
d. last()
Answer- back()
Que- Which of the following function(s) is/are used to get the size of the array class?
a. size()
b. max_size()
c. both size() and max_size()
d. get_size()
Answer- both size() and max_size()
Que- What is the use of swap() function in array class?
a. Swaps two elements of an array given elements
b. Swaps two arrays
c. Swaps two elements given indices of elements
d. Swaps same elements of the array if required
Answer- Swaps two arrays
Que- What is the syntax of swap()?
a. swap(arr1, arr2);
b. arr1.swap(arr2);
c. swap<int, int>(arr1, arr2);
d. swap[arr1, arr2];
Answer- arr1.swap(arr2);
Que- What is the use of empty() function in array classes?
a. To check whether the size of an array is zero or not
b. To check whether an array is empty or not
c. To check how many elements are there in the array
d. To check whether an array contains negative elements or not
Answer- To check whether the size of an array is zero or not
Que- What is the use of fill() function in array class?
a. To fill an array with a given single value
b. To delete all the elements that are equal to the given value
c. To replace all the elements of the array which are equal to the given value
d. To check whether given element fills the array or not
Answer- To fill an array with a given single value
Que- What are the vectors?
a. Arrays with dynamic size
b. Arrays with different types of elements
c. Same as array classes
d. Arrays with static size but use template classes
Answer- Arrays with dynamic size
Que- Pick the correct statement.
a. Vectors have dynamic size whereas Array classes have a static size
b. Both vectors and Array classes have a dynamic size
c. Both vectors and Array classes have a static size
d. Vectors have static size whereas Array classes have a dynamic size
Answer- Vectors have dynamic size whereas Array classes have a static size
Que- Pick the incorrect statement.
a. Vectors have a dynamic size
b. Vectors are placed in contiguous storage
c. Insertion in vectors always takes constant time
d. Vectors insert the element at the end
Answer- Insertion in vectors always takes constant time
Que- Which of the following header file is needed to use vectors in your program?
a. <array>
b. <vector>
c. <containers>
d. <stdio>
Answer- <vector>
Que- Which of the following(s) can be used to access the first element of a vector v?
a. v.begin()
b. v.cbegin()
c. v[0]
d. all of the mentioned
Answer- all of the mentioned
Que- Which of the following(s) can be used to access the last element of a vector v?
a. v.end()
b. v.cend()
c. both v.end() and v.cend()
d. vectors do not have a function to access the last element
Answer- vectors do not have a function to access the last element
Que- What is the difference between begin() and cbegin() in vectors?
a. both are same
b. begin() returns iterator to first element and cbegin() returns iterator to last element
c. begin() returns an iterator to first element whereas cbegin() returns constant iterator to first element
d. begin() returns returns first element cbegin() returns void
Answer- begin() returns an iterator to first element whereas cbegin() returns constant iterator to first element
Que- What is the difference between begin() and rbegin()?
a. both are the same
b. begin() returns an iterator to the first element and rbegin() returns an iterator to an element kept at the end of the vector
c. begin() returns an iterator to first element whereas rbegin() returns constant iterator to first element
d. begin() returns returns first element rbegin() returns void
Answer- begin() returns an iterator to the first element and rbegin() returns an iterator to an element kept at the end of the vector
Que- Which is the following is syntactically correct for vector<int> v?
a. vector <int> :: const_iterator itr = v.rbegin();
b. vector <int> :: reverse_iterator itr = v.begin();
c. vector <int> :: iterator itr = v.begin();
d. vector <int> :: iterator itr = v.cbegin();
Answer- vector <int> :: iterator itr = v.begin();
Que- Which of the following function is used to get the actual number of elements stored in vector?
a. v.size()
b. v.capacity()
c. v.max_size()
d. v.no_of_elements()
Answer- v.size()
Que- Which function is used to get the total capacity of a vector?
a. v.size()
b. v.capacity()
c. v.max_size()
d. v.no_of_elements()
Answer- v.capacity()
Que- How the size of a vector increases once it is full?
a. Vector increases its capacity one by one
b. Vector doubles its capacity after it is full
c. Vector increases its capacity by half of its previous size
d. Vector increases its capacity by a constant factor
Answer- Vector doubles its capacity after it is full
Que- Which function is used to check whether the vector is empty or not?
a. empty()
b. isempty()
c. haveElements()
d. none()
Answer- empty()
Que- How many list sequence containers are provided by STL?
a. 1
b. 2
c. 3
d. 4
Answer- 2
Que- Which type of list a Forward_list sequence container implements?
a. Singly Linked List
b. Doubly Linked List
c. Both type of list
d. A simple sequence of array
Answer- Singly Linked List
Que- Which type of list a List sequence container implements?
a. Singly Linked List
b. Doubly Linked List
c. Both type of list
d. A simple sequence of array
Answer- Doubly Linked List
Que- Which of the following header file is required for forwawrd_list?
a. <forward_list>
b. <list>
c. <f_list>
d. <Forward_List>
Answer- <forward_list>
Que- Which of the following(s) is/are the correct way of assigning values to a forward_list f?
a. f.assign({1,2,3,4,5})
b. f.assign(10,5)
c. both f.assign({1,2,3,4,5}) and f.assign(10,5)
d. f.assign(1,1,1,1)
Answer- both f.assign({1,2,3,4,5}) and f.assign(10,5)
Que- How the list differs from vectors?
a. Vector is contiguous whereas List is non-contiguous
b. Insertion in the list takes constant time whereas it is not constant in vectors
c. There is no capacity defined for list
d. All of the mentioned
Answer- All of the mentioned
Que- What is the syntax of declaraing a forward_list?
a. forward_list f;
b. forward_list<type> f;
c. forward_list f<type>;
d. forward_list<type,size> f;
Answer- forward_list<type> f;
Que- What is a pair?
a. Container consisting of two data elements of the same type
b. Container consisting of two data elements of different type
c. Container consisting of one header and two data elements of the same type
d. Container consisting of two data elements can have the same or different type
Answer- Container consisting of two data elements can have the same or different type
Que- Which header file is required to use pair container in your program?
a. <algorihtm>
b. <utility>
c. <pair>
d. <utitityPair>
Answer- <utility>
Que- Which of the following is the correct syntax of using pair p?
a. pair <type,type> p;
b. pair p <type,type>;
c. pair [type,type] p;
d. pair p [type,type];
Answer- pair <type,type> p;
Que- Which of the following operations can be performed on a pair?
a. Assignment of pairs
b. Copying of one pair to another
c. Comparison of two pairs
d. All of the mentioned
Answer- All of the mentioned