Difficulty: Medium
Correct Answer: 2 only
Explanation:
Introduction / Context:This item tests nuanced understanding of how C# organizes types into namespaces, including the special global namespace. It also addresses misconceptions about files and using directives.
Given Data / Assumptions:
Concept / Approach:Examine each statement independently and compare it with C# language rules. The global namespace counts as a namespace context even when the code lacks an explicit namespace declaration.
Step-by-Step Solution:
1) False. Neither classes nor structs are required to have an explicit namespace; both can live in the global namespace.2) True. Every type belongs to some namespace—explicit or the implicit global one.3) False. Namespaces can be spread over multiple files and assemblies.4) False. If omitted, types go to the global namespace, not a project-named namespace.5) False. using directives are optional if you use fully qualified names.Verification / Alternative check:Create a class with no namespace and call it via its global name; the code compiles, demonstrating statements 1, 4, and 5 are misconceptions.
Why Other Options Are Wrong:A and C include false statements; D claims a project-name default (not true); E includes the false requirement for using.
Common Pitfalls:Equating project name with namespace and assuming files constrain namespace membership.
Final Answer:2 only
Discussion & Comments