🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: STL Containers: all 9 questions

Quiz: STL Containers · Question 8 of 9

What is a pair<string, int most often used for?

What is a pair<string, int> most often used for?

  1. A.A container that holds any number of strings
  2. B.Keeping two related values together, such as a name and marks
  3. C.Storing a string twice
  4. D.Sorting a vector
Answer & explanation

Correct answer: Keeping two related values together, such as a name and marks

pair groups two values, accessed as first and second; map elements are pairs too.

Can you get the rest right without peeking?

Take the timed Quiz: STL Containers quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →