1.

Which of the following is an advantage of Forward iterator over input and output iterator?(a) Can be used as both accessing and assigning iterator(b) Forward iterator can be incremented or decremented(c) Can be used with relational operators also(d) Can be used with arithmetic operators alsoThis question was posed to me in an interview.The origin of the question is Iterators topic in section Algorithms, Objects & Iterators in C++ of C++

Answer»

Correct option is (a) Can be USED as both accessing and assigning ITERATOR

To explain: FORWARD iterator is a combination of both input and output iterator, therefore, can be used as both accessing and assigning iterator. Just like Input and output iterator this can also be not used with all relational and arithmetic OPERATORS and can be incremented only.



Discussion

No Comment Found

Related InterviewSolutions