Question 1: Which of the following statements are TRUE?
Question 2: How to define a delegate which points to the following methods?
public static string ToNumberString(int num)
{
return String.Format("{0,-12:N0}", num);
}
public static string ToMoneyString(int money)
{
return String.Format("$ {0:C}", money);
}
Question 3: How to pass a function as a parameter in C#?
Question 4: What will be the output of the following program?
public delegate void Display(int value);
static void Main(string[] args)
{
Display displayDel = DisplayNum;
displayDel += DisplayMoney;
displayDel.Invoke(100000);
}
public static void DisplayNum(int num)
{
Console.WriteLine("Number: {0,-12:N0}", num);
}
public static void DisplayMoney(int money)
{
Console.WriteLine("Money: {0:C}", money);
}
Question 5: Which of the following statement is TRUE?