Multiple choice technology programming languages

Constants cannot be marked with which of the below keywords

  1. Public.

  2. Private.

  3. Protected.

  4. static.

  5. Internal.

  6. ProtectedInternal.

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

In C#, constants (marked with 'const' keyword) are implicitly static and cannot be marked with the 'static' keyword explicitly. Access modifiers like public, private, protected, and internal are all valid for constants - they control visibility. ProtectedInternal is also valid. Attempting to mark a constant as static would cause a compilation error.

AI explanation

A const member in C#/.NET is implicitly a compile-time constant that belongs to the type itself, not to instances, and the compiler already treats it as static — you're not allowed to redundantly (and conflictingly) mark it static yourself. Access modifiers like public, private, protected, and internal (including protected internal) are all still valid on a constant.