What are the disadvantages of arrays?

a) Index value of an array can be negative
b) Elements are sequentially accessed
c) Data structure like queue or stack cannot be implemented
d) There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size is the correct answer.

Explanation:

  • Fixed size: Arrays have a fixed size, which means you need to specify the number of elements it can hold when you declare it.
  • Memory allocation: The system allocates a contiguous block of memory for the array based on the specified size.
  • Wastage: If you only need to store fewer elements than the allocated size, the remaining memory space in the array goes unused, leading to memory wastage.

Other options:

  • a) Index value of an array can be negative: This is incorrect. Array indices typically start from 0 and go up to the length of the array minus 1. Negative indices are not valid.
  • b) Elements are sequentially accessed: This is a characteristic of arrays, not a disadvantage. Sequential access means elements can be accessed one after the other, which is often efficient.
  • c) Data structure like queue or stack cannot be implemented: This is also incorrect. While arrays are not the optimal choice for implementing queues or stacks, it’s possible to do so with additional logic.

Therefore, the most significant disadvantage of arrays in terms of memory efficiency is the potential wastage of space when the array is not fully utilized.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top