Which data structure is described as a fixed-size, contiguous collection of elements of the same type in memory?

Prepare for the GATE General Aptitude and CS Test. Enhance your skills with multiple choice questions and detailed explanations. Elevate your readiness and boost your confidence for the exam!

Multiple Choice

Which data structure is described as a fixed-size, contiguous collection of elements of the same type in memory?

Explanation:
The concept being tested is the memory layout and sizing of a data structure. An array reserves a single block of memory large enough to hold a fixed number of elements, all of the same type. Because every element has the same size and sits directly after the previous one, the elements occupy contiguous memory. This arrangement gives direct, constant-time access to any element by its index, since you can compute the address as the base address plus the index scaled by the element size. The size is fixed at creation, so you can’t easily add or remove elements without creating a new array. This differs from a linked list, where elements (nodes) can be scattered in memory and connected via pointers, allowing easy growth or shrinkage but not requiring contiguity. Stack and queue describe usage patterns rather than a fixed memory layout; they can be implemented with arrays or linked lists, but the description here points to an array because of the fixed-size, contiguous memory arrangement.

The concept being tested is the memory layout and sizing of a data structure. An array reserves a single block of memory large enough to hold a fixed number of elements, all of the same type. Because every element has the same size and sits directly after the previous one, the elements occupy contiguous memory. This arrangement gives direct, constant-time access to any element by its index, since you can compute the address as the base address plus the index scaled by the element size. The size is fixed at creation, so you can’t easily add or remove elements without creating a new array.

This differs from a linked list, where elements (nodes) can be scattered in memory and connected via pointers, allowing easy growth or shrinkage but not requiring contiguity. Stack and queue describe usage patterns rather than a fixed memory layout; they can be implemented with arrays or linked lists, but the description here points to an array because of the fixed-size, contiguous memory arrangement.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy