STL Algorithms and Iterators interview questions

15 real STL Algorithms and Iterators questions from the C++ bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is std::sort?

Junior
  1. A.an algorithm that orders a random-access range in place, typically in n-log-n comparisons using introsort
  2. B.an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  3. C.a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
  4. D.a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.std::sort — an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  2. B.std::sort — an algorithm that orders a random-access range in place, typically in n-log-n comparisons using introsort
  3. C.std::sort — a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
  4. D.std::sort — a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
Reveal the answer + AI explanation — free account

4. What is std::find?

Junior
  1. A.an algorithm that orders a random-access range in place, typically in n-log-n comparisons using introsort
  2. B.an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  3. C.a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
  4. D.a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
Reveal the answer + AI explanation — free account

5. Which term means: "a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches"?

Junior
  1. A.std::find
  2. B.Lambda expression
  3. C.Ranges library (C++20)
  4. D.std::sort
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.std::find — an algorithm that orders a random-access range in place, typically in n-log-n comparisons using introsort
  2. B.std::find — a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
  3. C.std::find — an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  4. D.std::find — a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
Reveal the answer + AI explanation — free account

7. What is Lambda expression?

Junior
  1. A.a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
  2. B.a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
  3. C.an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  4. D.a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Junior
  1. A.Lambda expression — a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
  2. B.Lambda expression — an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  3. C.Lambda expression — a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
  4. D.Lambda expression — a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
Reveal the answer + AI explanation — free account

10. What is Ranges library (C++20)?

Senior
  1. A.a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
  2. B.a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
  3. C.a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
  4. D.an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Senior
  1. A.Ranges library (C++20) — an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  2. B.Ranges library (C++20) — a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
  3. C.Ranges library (C++20) — an algorithm that orders a random-access range in place, typically in n-log-n comparisons using introsort
  4. D.Ranges library (C++20) — a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
Reveal the answer + AI explanation — free account

13. What is End iterator?

Mid
  1. A.a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
  2. B.a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
  3. C.an algorithm that orders a random-access range in place, typically in n-log-n comparisons using introsort
  4. D.a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
Reveal the answer + AI explanation — free account

14. Which term means: "a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced"?

Mid
  1. A.std::sort
  2. B.Ranges library (C++20)
  3. C.Lambda expression
  4. D.End iterator
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.End iterator — a facility allowing algorithms to operate on whole ranges and composable lazy views via the pipe operator
  2. B.End iterator — a linear-scan algorithm returning an iterator to the first element equal to a target or the end iterator when none matches
  3. C.End iterator — an inline anonymous function object with an optional capture list, enabling closures passed directly to algorithms
  4. D.End iterator — a sentinel position one past the last element, used to denote a range's bound and a not-found result; it must never be dereferenced
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice STL Algorithms and Iterators free