csharp Class Questions & Answers

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?

ADVERTISEMENT

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?