Govt. Exams
Entrance Exams
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.
Enum is a value type in C#. String, Interface, and Delegate are reference types.
string s = "Hello";
s = s + " World";
Console.WriteLine(s);
String concatenation using '+' operator joins the two strings. s becomes 'Hello World' after the concatenation.
Variable names in C# can contain letters, digits, and underscores. They cannot contain special characters like '$'. The variable name must start with a letter or underscore.
Console class is part of the System namespace. You need to include 'using System;' at the beginning of your code to use Console.WriteLine().
C# is case-sensitive. The lowercase keyword 'class' is used to define a class. 'Class' and 'CLASS' are not valid keywords.
C# uses the syntax 'type variableName = value;' to declare and initialize variables. The equals sign (=) is the assignment operator.