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

What is the difference between stack and heap allocation?

  1. A Stack allocation is fast and automatically released at scope exit; heap allocation is slower and must be released explicitly
  2. B Heap allocation is faster
  3. C Stack memory is unlimited
  4. D Heap memory is released at scope exit
Answer

Stack allocation is fast and automatically released at scope exit; heap allocation is slower and must be released explicitly

Prefer the stack. Use the heap only when the object is too large, its size is only known at runtime, or it must outlive the scope.

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