1.

Which of the following is a logical unary functor?(a) logical_or f;(b) logical_and f;(c) logical_not f;(d) negate f;The question was asked during an online exam.Origin of the question is Functors in chapter Algorithms, Objects & Iterators in C++ of C++

Answer»

The correct choice is (c) logical_not f;

To EXPLAIN I would say: logical_and and logical_or requires two ARGUMENTS to act upon whereas negate and logical_not requires only ONE argument but negate also produces non-logical results like negate of a NUMBER, therefore, it is not logical hence logical_not f; is an only logical functor.



Discussion

No Comment Found

Related InterviewSolutions