Govt. Exams
Entrance Exams
The default access modifier for class members is 'private'. For top-level classes, it's 'internal' by default.
The 'const' keyword creates a compile-time constant in C#. 'readonly' creates a runtime constant, 'static' defines class-level members, and 'immutable' is not a C# keyword.
Explicit casting from decimal to int truncates the decimal part, resulting in 10.
The ternary operator checks if x > y. Since 10 is not greater than 20, it returns y which is 20.
The 'const' keyword creates a constant that must be initialized at declaration and cannot be changed. 'readonly' allows initialization in constructor.
/* */ is used for multi-line comments in C#. // is for single-line comments.
Classes are reference types. byte, decimal are value types, and struct is also a value type.
Integer division in C# truncates the decimal part. 10 / 3 = 3 (not 3.33) because both operands are integers.
Only nullable types (using ?) can hold null values for value types. int? is a nullable integer that can hold null.
The default access modifier for class members in C# is private, meaning they are accessible only within the same class.