Question 11: Which of the following statements are TRUE about constructors in C#.NET?
Question 12: Is the constructor called multiple times during the lifetime of an object?
Question 13: You have defined the Employee class, which includes the GetSalary()
method. You need to ensure that the GetSalary()
method can be used only by the Employee
class or a class derived from it.
Which access modifier should you use for the GetSalary()
method?
Question 14: What will be the output of the following program?
public class Program
{
public static void Main(string[] args)
{
for(int i=0;i<4;i++)
Print(i);
}
public void Print(object o)
{
Console.WriteLine(o);
}
}
Question 15: Which of the following statements is TRUE?
Question 16: Which of the following statements is TRUE?
Question 17: What will be the output of the following program?
public static void Main(string[] args)
{
display();
}
static void display(int i =10){
Console.Write(i);
}
Question 18: What the following statement does?
Object.ReferenceEqual(obj1, obj2)
Question 19: What will be the output of the following program?
public static void Main(string[] args)
{
String str1, str2;
str1 = "Hello";
str2 = "Hello";
Console.Write(Object.ReferenceEquals(str1, str2));
}
Question 20: What will be the output of the following program?
public static void Main(string[] args)
{
string str1 = "Hi";
string str2 = String.Copy(str1);
Console.Write(Object.ReferenceEquals(str1, str2));
}