← 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?
- A.A container that holds any number of strings
- B.Keeping two related values together, such as a name and marks
- C.Storing a string twice
- 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 →