Difficulty: Medium
Correct Answer: 1, 2, 4
Explanation:
Introduction / Context:This question assesses understanding of different operators in C#.NET, including conditional, casting, pointer, and array operators.
Given Data / Assumptions:
Concept / Approach:Cross-check each statement with the C# specification for operators.
Step-by-Step Solution:
Statement 1: Correct — ?: is ternary operator returning one of two values. Statement 2: Correct — as operator safely attempts conversion to a reference/nullable type, returns null if incompatible. Statement 3: Incorrect — The operator is *, not &*, for pointer operations. Statement 4: Correct — -> is used in unsafe pointer code. Statement 5: Incorrect — [] are for array indexing; casts use ().Verification / Alternative check:Simple tests with arrays, pointers (in unsafe code), and casting confirm these behaviors.
Why Other Options Are Wrong:Options including 3 or 5 rely on incorrect statements.
Common Pitfalls:Confusing [] with type casting or misremembering pointer operators from C++ vs C#.
Final Answer:1, 2, 4
Discussion & Comments