Govt. Exams
Entrance Exams
Since both 10 and 3 are integers, integer division occurs, resulting in 3 (the decimal part is truncated).
Option A is the correct C# syntax. Option B is C-style, Option C has wrong syntax, and Option D has incorrect keyword placement.
string is a reference type in C#, while int, float, and bool are value types.
The && operator requires both conditions to be true. (5 > 3) is true, but (3 < 2) is false. Since one condition is false, the entire expression evaluates to false.
Value types (int, double, struct, etc.) are stored on the stack memory. Reference types (class, interface) are stored on the heap. Value types don't require null checks like reference types.
The default access modifier for class members in C# is 'private'. This means the member is only accessible within the same class unless explicitly specified otherwise.
The 'const' keyword declares a constant whose value cannot be modified. Both 'const' and 'readonly' prevent changes, but 'const' is compile-time constant while 'readonly' is runtime constant.
string str = "Hello";
str = str + " World";
Console.WriteLine(str.Length);
"Hello" has 5 characters. After concatenation with " World" (6 characters including space), the total length is 11.
The '?' suffix is used to declare nullable value types in C#. int? means an integer that can also hold null values.
LINQ (Language Integrated Query) is available in the System.Linq namespace introduced in .NET 3.5.