B. Not allow you to overwrite the bounds of your container
C. It will check the list value
D. Overwrite the bounds of your iterators
Solution: Checked iterators ensure that you do not overwrite the bounds of your container.
Q: What will happen if the iterator is unchecked?
A. Arising of compiler warnings
B. Unchecked behavior on program
C. Nothing will execute
D. Arising of compiler warnings & Unchecked behavior on program
Solution: We will get unchecked behavior on calls to an unchecked function and Calls to the standard function will result in compiler warnings.
Q: How many adaptors support the checked iterators?
A. 1
B. 2
C. 3
D. 4
Solution: There are two adaptors that support checked iterators. They are checked_array_iterator class, Checked_iterator class.
Q: What does the checked iterator allow you to find?
A. Warnings
B. Compile time error
C. Run time error
D. Warnings & Run time error
Solution: Checked iterator allow you to find Run time error.
Q: What kind of errors do checked iterators detect?
A. Uninitialized iterators
B. Initialized iterators
C. Range access
D. Both Uninitialized iterators and range access
Solution: Checked iterators can easily detect the errors in Uninitialized iterators as well as Range of access.
Q: Where are allocators used?
A. Allocation of memory
B. Deallocation of memory
C. Used for pointers
D. Both Allocation & Deallocation of memory
Solution: Allocators handle all the request for allocation and deallocation of memory for the container.
Q: Where are allocators implemented?
A. Template library
B. Standard library
C. C++ code library
D. String library
Solution: Allocators are implemented in C++ standard library but it is used for C++ template library.
Q: Which operator is used to allocate the memory?
A. =
B. +
C. new
D. free
Solution: The default allocator uses operator new to allocate memory.
Q: What is the use of reference member type in allocator?
A. Point to an element
B. Quantities of element
C. Reference to an element
D. Sequence of an element
Solution: free() function is used to free the memory used by the program.
eg,
int *p = (int*) malloc(sizeof(int)); //allocation of memory.
free(p); // freeing the memory occupied by pointer p.
Q: What is the correct syntax for declaring an allocator?
A. template < class T > class allocator;
B. template < class T > class;
C. template class allocator;
D. template class()
Solution: It is a type of syntax for declaring the allocater.