Govt. Exams
Entrance Exams
C# 12 (2024) introduced advanced list patterns that allow filtering and deconstructing collections in pattern matching expressions, improving code readability and efficiency.
GetHashCode() on the same string returns the same hash code value, so comparison is true. Strings are immutable in C#.
C# has progressively introduced nullable reference types, required keyword (C# 11), and init-only properties (C# 9) for better null-safety and immutability.
The GetType().Name returns the type name as "Decimal" (capitalized). The 'm' suffix specifies a decimal literal. The output shows the CLR type name, which is "Decimal".
C# implements multiple interface inheritance by listing interfaces separated by commas after the class name: class MyClass : Interface1, Interface2. There is no 'extends' or 'implements' keyword in C#.
Post-increment (x++) returns the current value before incrementing. So y = 10, then x becomes 11. Output is '11, 10'.
Method overloading requires same method name but different parameter types, count, or order. Return type alone is insufficient for overloading.
The null-coalescing operator (??) returns the right operand if the left is null. Since text is null, it prints 'Default'.
The 'using' statement ensures that Dispose() is called on objects implementing IDisposable, preventing resource leaks. Importing namespaces is a different use of 'using'.
Method overloading allows same method name with different signatures (parameter types, count, or order). Return type alone cannot differentiate overloaded methods.