Multiple choice technology programming languages

We can initialize following type of variables in class declaration.

  1. static

  2. const

  3. extern

  4. none

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In C++ class declarations, you cannot initialize static, const, or extern variables directly in the class declaration (with some exceptions for static const integral types in C++11 and later). The question states 'none' as correct, which is technically accurate for traditional C++ where these types require separate definition outside the class. However, modern C++ (C++11 and later) does allow inline initialization for static const members of integral types, and constexpr static members. The question appears to be testing older C++ rules.