42. What is the purpose of the params keyword in C# method parameters?
43. In C#, which keyword is used to exit from a method without returning any value?
44. What is the correct syntax to define a method named GetMax that takes two integer parameters num1 and num2 and returns the maximum of the two numbers in C#?
45. Which of these methods is executed first before execution of any other thing that takes place in a program?
46. Which of these can be used to differentiate two or more methods having same name?
47. Which of these data types can be used for a method having a return statement in it?
48. What will be the output of the following C# code snippet?
class box
{
public int width;
public int height;
public int length;
public int volume1;
public void volume()
{
volume1 = width * height * length;
}
public void volume(int x)
{
volume1 = x;
}
}
class Program
{
static void Main(string[] args)
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(5);
Console.WriteLine(obj.volume1);
Console.ReadLine();
}
}
a) 0
class box
{
public int width;
public int height;
public int length;
public int volume1;
public void volume()
{
volume1 = width * height * length;
}
public void volume(int x)
{
volume1 = x;
}
}
class Program
{
static void Main(string[] args)
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(5);
Console.WriteLine(obj.volume1);
Console.ReadLine();
}
}
a) 0