Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Which standard library algorithm removes elements matching a predicate from a container?

  1. A std::remove_if alone
  2. B std::remove_if followed by container.erase
  3. C std::delete_if
  4. D container.remove_all
Answer

std::remove_if followed by container.erase

remove_if only shifts elements and returns a new logical end. The erase-remove idiom is needed to actually shrink the container.

All C++ MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as