Ans (C) Arrays
Buffers are implemented both as Contiguous memory cells -Arrays and Non Contiguous memory cells - Linked lists.
Both implementations have their own benefits in different scenarios.
Different Buffers:
1. Circular Buffer
Default: FIFO implementation over Arrays.
Each item is contiguous and has the correct data alignment, so software reading and writing these values can be faster than software that handles non-contiguous and non-aligned values.
Usage scenario 1: Queue with fixed maximum size.
Advantages: All Queue Operations take constant time.
Note: In some implementations of fixed size Circular Buffer, when Buffer is full,
(i) only the most recent data are stored
(ii) data are overwritten - The routines that manage the buffer could prevent overwriting the data and return an error or raise an exception. Whether or not data is overwritten is up to the semantics of the buffer routines or the application using the circular buffer.
Usage scenario 2: Queue with expanding size.
Disadvantage:
Expanding a circular buffer requires shifting memory, which is comparatively costly.
Solution: For arbitrarily expanding queues, a Linked list approach may be preferred instead.
2. Non-circular Buffer
Default: LIFO implementation over Arrays.
Reference link