31.
Wrong statement about inheritance in C# .NET?

33.
Select the sequence of execution of function f1(), f2() & f3() in C# .NET CODE?
class base
{
    public void f1() {}
    public virtual void f2() {}
    public virtual  void f3() {}
}
class derived :base
{
    new public void f1() {}
    public override void f2() {}
    public new void f3() {}
} 
class Program
{
    static void Main(string[] args)
    {
        baseclass b = new derived();
        b.f1 ();
        b.f2 ();
        b.f3 ();
    }
}

34.
The following C# code is run on single level of inheritance. What will be the Correct statement in the following C# code?
class sample
{
    int i = 10;
    int j = 20;
    public void display() 
    {
        Console.WriteLine("base method ");
    }
}    
class sample1 : sample 
{
    public  int s = 30;
}    
class Program
{
    static void Main(string[] args)
    {
        sample1 obj = new sample1();
        Console.WriteLine("{0}, {1}, {2}", obj.i,  obj.j,  obj.s);
        obj.display();
        Console.ReadLine();
    }
}

37.
What will be the output of the following C# code?
public static void Main(string[] args)
{
    p();
    void p()
    {
        Console.WriteLine("hi");
    }
}

Read More Section(Classes and Objects in C Sharp)

Each Section contains maximum 100 MCQs question on Classes and Objects in C Sharp. To get more questions visit other sections.