Which C++ Standard Library container provides a fixed-size array with useful member functions such as size()?

Options

  • A. std::array
  • B. std::fixed_array
  • C. std::static_array
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. std::array

Detailed Explanation

Answer: (A) std::array

std::array is a fixed-size container provided by the C++ Standard Library.

Example:

std::array<int, 5> a;

It stores exactly 5 integers and provides useful operations such as size(), front(), and back().

Unlike a built-in array, std::array behaves more like a standard library container and works conveniently with many STL algorithms.