1)

Select the output for the following set of code:

public static void Main(string[] args)
{
int i = 256;
object o = i;
i = 500;
System. Console. WriteLine("The value-type value = {0}", i);
System. Console. WriteLine("The object-type value = {0}", o);
Console. ReadLine();
}


A) 500, 256

B) 256, 500

C) 256, 256

D) 500, 500

Answer:

Option A

Explanation:

The concept of boxing is implemented here. The variable 'i' is value type and object is reference type. So even if we initialize the value of 'i' again, the object value remains the same. So the output will be 500, 256