Multiple choice technology programming languages

What is the default access specifier for a Top-level Class, which are not nested into other Classes?

  1. protected

  2. private

  3. internal

  4. public

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

In C#, non-nested classes default to internal access, making them accessible only within the same assembly unless explicitly declared public or another access modifier. Protected is not a valid default for top-level classes.

AI explanation

In languages like C#, a top-level class that isn't explicitly given an access modifier defaults to internal, meaning it's visible only within its own assembly. This differs from nested classes, which default to private, and from public/protected, which must be stated explicitly to grant broader visibility.