Difficulty: Easy
Correct Answer: Static functions are invoked using class.
Explanation:
Introduction / Context:Static members belong to the type itself rather than to any particular instance. Understanding how to call them and what they can access is a core C# concept.
Given Data / Assumptions:
Concept / Approach:Static methods are called on the type (for example, Math.Abs(…)), not on an instance. A static method cannot access instance fields or properties directly because it lacks a this reference. Static methods are defined within class (or struct) scope just like instance methods.
Step-by-Step Solution:
Evaluate A: False — static calls do not require (and should not use) an instance.Evaluate B: False — static methods cannot access instance data without an explicit instance reference passed in or obtained elsewhere.Evaluate C: False — static methods are members of a class; they are not “outside” the class.Evaluate D: True — the idiomatic and correct invocation is via the class:TypeName.StaticMethod().Verification / Alternative check:Attempt to reference an instance field from a static method; the compiler flags an error due to missing instance context.
Why Other Options Are Wrong:
Common Pitfalls:Creating an instance only to call a static method — unnecessary and misleading.
Final Answer:Static functions are invoked using class.
Discussion & Comments