C# DataType MCQs

Question 36: What will be the output of the following program?

static void Main(string[] args)
{
    int? i = null;
    int j = 10;

    if (i < j)
        Console.WriteLine("i < j");
    else if( i > 10)
        Console.WriteLine("i > j");
    else if( i == 10)
        Console.WriteLine("i == j");
    else
        Console.WriteLine("Could not compare");
}

Question 37: What will be the output of the following program?

static void Main(string[] args)
{
    int? i = null;
    int j = 10;

    if (Nullable.Compare(i, j) < 0)
        Console.WriteLine("i < j");
    else if (Nullable.Compare(i, j) > 0)
        Console.WriteLine("i > j");
    else
        Console.WriteLine("i = j");
} 

Question 38: Which of the following statements is TRUE?

Question 39: What will be the output of the following program?

static void Main()
{
    object[] arr = new String[10];
    arr[0] = 100;
    
    Console.Write(arr[0]);
}

Question 40: What will be the output of the following program?

static void Main()
{
    var emp = new
    {
        Id = 1,
        Name = "Steve",
        isActive = true
    };

    emp.Name = "James";
    Console.Write(emp.Name);
}