Test Series - cpp

Test Number 87/102

Q: Pick out the in correct type of function in  header file.
A. Partitions
B. Sort
C. Merge
D. Join
Solution: First three type of options are available in  header file.
Q: What type of algorithm is not available in creating our own STL style algorithms?
A. copy_if()
B. remove_copy_if()
C. sort
D. remove_copy()
Solution: copy_if() algorithm is not available in creating our own STL style algorithms.
Q: What is meant by hash tables in C++?
A. Array data structure
B. Keyed array data structure
C. Data structure
D. Linear probing
Solution: In hash table, every value will have a key, So that it can be accessed easily.
Q: What is the use of includes function in c++?
A. Compares two ranges of data
B. Compares two sorted ranges of data
C. Includes a new element in the range
D. Includes a new element in the end
Solution: Returns true if the first sorted range contains all the elements in the second sorted range.
Q: How many parameters are required for sort_heap function?
A. 1
B. 2
C. 2 or 3
D. 3
Solution: There are three parameters required for sort_heap. There are first element in heap and last element in heap and an optional compare.
Q: How many categories of iterators are there in c++?
A. 2
B. 4
C. 5
D. 3
Solution: There are five types of iterators. They are Output, Input, Forward, Random access and Bi-directional.
Q: Which of the following can serve as random-access iterator?
A. Memory pointer
B. Object pointer
C. Class pointer
D. Memory & Class pointer
Solution: Because of this, It can serve as any category of iterator.
Q: What kind of pattern is iterator pattern?
A. Design pattern
B. Sequence pattern
C. Adapter pattern
D. Star pattern
Solution: Iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container’s elements.
Q: In which type of semantics does c++ implements iterator?
A. Memory
B. Size
C. Pointer
D. Value
Solution: C++ uses pointer arithmetic/semantic to implement iterators.
Q: By using which operator does point to next element is represent in
iterator?
A. ++
B. 
C. +-
D. -+-
Solution: ‘++’ operator is used to represent the next element in the iterator.

You Have Score    /10