C# DataType MCQs

Question 16: What is the size of a decimal?

Question 17: Value types are passed by ______ and reference types are passed by _____.

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

public static void Main()
{
	string name = "Steve";
	Change(name);
	Console.WriteLine(name);
}
	
static void Change(string str)
{
	str = "Bill";
}

Question 19: What will the output of the following program?

   class Program
{
    static void Main(string[] args)
    {
        int myNum = 10;
        ProcessNumber(ref myNum); 
           
        Console.WriteLine(myNum);
        Console.ReadLine();
    }
 
    public static void ProcessNumber(ref int num)
    {
        num = 100;
    }
           
}

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

public class Program
{
	public static void Main(string[] args)
 	{
		String str = "Steve";
		object o = "Bill";
		
		Change(str);
		Console.Write(str + ", ");

		Change(o);
		Console.Write(o + ", ");
		
	}

	static void Change(object obj)
	{ 
		obj = obj + " Gates";
	}
		
	static void Change(string str)
	{ 
		str = str + " Jobs";
	}
}