Govt. Exams
Entrance Exams
ref parameters must be initialized before being passed to a method, while out parameters don't require initialization beforehand. The method must assign a value to out parameters before returning.
Option B is correct as both branches return int (1 or 0). Option A has type mismatch (string in int). Option C has wrong syntax. Option D has type mismatch.
Method overloading requires different parameter types, count, or order. Return type alone is not enough. C# fully supports overloading.
char 'A' has ASCII value 65. Casting to int gives the numeric ASCII value.
var is implicitly typed. The type is inferred and set at compile-time based on the right-hand side assignment, providing type safety.
const creates a compile-time constant. readonly allows assignment only in constructor or at declaration. static makes it class-level, and fixed is for pointers.
Post-increment (x++) returns the current value first, then increments. So y gets 10, then x becomes 11.
The 'finally' block executes regardless of whether an exception is thrown or caught. It is used for cleanup operations like closing file streams or database connections.
LINQ (Language Integrated Query) provides a unified syntax for querying different data sources like collections, databases, XML, etc. It allows developers to write queries in C# syntax.
'abstract' keyword creates a class that serves as a blueprint for derived classes and cannot be instantiated directly. Abstract classes can contain abstract methods that must be implemented by derived classes.