Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $4.99 payment

Question: 1 / 575

What main advantage does dynamic memory allocation provide?

Unlimited memory usage

Memory is automatically managed

Control over object lifetime

Dynamic memory allocation does not provide unlimited memory usage as it can lead to memory leaks and fragmentation. Memory is also not automatically managed, as it requires explicit allocation and deallocation in order to avoid memory leaks and other issues. While it may offer some control over object lifetime, it does not directly affect the execution time of a program. Therefore, the main advantage of dynamic memory allocation is the control it provides over the lifetime of objects, ensuring that memory is only used when needed and properly released after use.

Faster execution time

Next

Report this question