Which one of the following is the correct definition of “is_array()” function…

2023

Which one of the following is the correct definition of “is_array()” function in C++?

  1. A.

    It checks that the specified variable is of the array or not

  2. B.

    It checks that the specified array is of single dimension or not

  3. C.

    It checks that the specified array is of multi-dimension or not

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 198 students.

Show answer & explanation

Correct answer: A

In C++, is_array() refers to the type trait std::is_array<T> defined in the <type_traits> header.

It is used at compile time, not as a regular runtime function.

It checks whether a given type T is an array type.

It returns true if the type is an array, and false otherwise.

It does not consider the dimensionality (single or multi-dimensional) of the array.

For example:
std::is_array<int[5]>::value // true
std::is_array::value // false

This type trait is commonly used in template metaprogramming for compile-time type checking.

So, Option A is correct (conceptually).

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs