[Solved] In which of the following cases dynamic arrays are not preferred?

In which of the following cases dynamic arrays are not preferred?

a) If the size of the array is unknown
b) If the size of the array changes after a few iterations
c) If the memory reallocation takes more time i.e. expensive
d) If the array holds less number of elements

Answer: d
Explanation: Dynamic arrays are preferred when the size of the array is unknown during memory allocation or the size changes after a few iterations or the memory reallocation is expensive. If array holds less number of elements, the physical size is reduced and reduction takes more time. In that case, we can use normal arrays instead of dynamic arrays.

Comments