C++20 sections · 1024 units
Open in Course

Quiz: Vector Problems

Test your understanding

Check Your Understanding

To find the sum of a vector, what's the best loop approach?

  1. A.for (int i = 1; i <= v.size(); i++)
  2. B.for (int num : v) sum += num;
  3. C.while (v.size() > 0) sum += v.pop_back();
  4. D.for (int i = 0; i < v.capacity(); i++)
Start the roadmap to answer the quizzes and solve the challenges