Test Series - cpp

Test Number 84/102

Q: How does a sequence of objects are accessed in c++?
A. Iterators
B. Pointers
C. Both Iterators & Pointers
D. Objects
Solution: A range is any sequence of objects that can be accessed through iterators or pointers, such as an array or an instance of some of the STL containers.
Q: How many parameters are present in mismatch method in non-sequence modifying algorithm?
A. 1
B. 2
C. 3
D. 3 or 4
Solution: There are two definitions of mismatch with either three or four parameters. They are first1, last1, first2 and optional predicate.
Q: What will happen in ‘all_of’ method if the range is empty?
A. Return true
B. Return false
C. Return nothing
D. Return error
Solution: Returns true if pred returns true for all the elements in the range [first, last) or if the range is empty, and false otherwise.
Q: To what kind of elements does non-modifying sequence algorithm can be applied?
A. Range
B. Vector
C. List
D. Methods
Solution: Non-modifying sequence algorithm can be applied to list and vector for example the “find” function can be applied to list and vector.
Q: Pick out the incorrect method in non-modifying sequence algorithm?
A. find-if
B. none-of
C. any-of
D. like
Solution: find-if, none-of, any-of are used as non-modifying sequence algorithms.
Q: What is the use of middle parameter in the rotate method?
A. Marks the begining of a sequence
B. Marks the ending of a sequence
C. Marks the elements in a sequence
D. Marks the digits in a sequence
Solution: Forward iterator pointing to the element within the range and that can be moved to the first position in the range.
Q: What kind of object is modifying sequence algorithm?
A. Function template
B. Class template
C. Method
D. Iterator
Solution: It is a group of functions and implemented under algorithm header file.
Q: How the sequence of objects can be accessed?
A. Iterators
B. Pointers
C. Both Iterators & Pointers
D. Library
Solution: A range is any sequence of objects that can be accessed through iterators or pointers, such as an array or an instance of some of the STL containers.
Q: How many kind of operation can be applied to transform method in c++?
A. 1
B. 2
C. 3
D. 4
Solution: There are two kinds of operations. They are unary and binary operation.
Q: What operator is used to remove the dupplicates in the range?
A. )
B. ^
C. %
D. ==
Solution: The function uses operator== to compare the pairs of elements.

You Have Score    /10