1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. Which iterator category does std::sort require?

Added 30 Nov -0001

Which iterator category does std::sort require?

  1. Bidirectional iterators
  2. Input iterators alone
  3. Random-access iterators Correct answer
  4. Forward iterators only

Correct answer

C. Random-access iterators

11 views

MCQSEXAM

Explanation

std::sort runs introsort and therefore needs random-access iterators, as supplied by vector and deque.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C++ and Object-Oriented Programming MCQs

Practise all C++ and Object-Oriented Programming MCQs

Similar MCQs