1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. Which standard container gives average constant-time…

Added 30 Nov -0001

Which standard container gives average constant-time lookup by key?

  1. std::list
  2. std::unordered_map Correct answer
  3. std::map
  4. std::vector

Correct answer

B. std::unordered_map

16 views

MCQSEXAM

Explanation

std::unordered_map is a hash table, so lookups take constant time on average.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? 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