adplus-dvertising

Welcome to the Interfaces,Inheritance and Polymorphism MCQs Page

Dive deep into the fascinating world of Interfaces,Inheritance and Polymorphism with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Interfaces,Inheritance and Polymorphism, a crucial aspect of C# Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Interfaces,Inheritance and Polymorphism, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Interfaces,Inheritance and Polymorphism. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Interfaces,Inheritance and Polymorphism. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Interfaces,Inheritance and Polymorphism MCQs | Page 10 of 20

Explore more Topics under C# Programming

Q91.
If base class consist of two private integers,one static integer and derived class consist of two static integers and one private integer.What would be the size of derived class object?
Discuss
Answer: (a).size of object depends on sizes of its non static data members
Discuss
Answer: (a).Declaring existing class as sealed
Discuss
Answer: (c).While creating the object firstly constructor of class sample 1 will be called followed by constructor of class sample
Q94.
Which form of inheritance is not supported directly by C# .NET?
Discuss
Answer: (a).Multiple inheritance
Q95.
If no access modifier for a class is specified,then class accessibility is defined as?
Discuss
Answer: (c).private
Q96.
Select the correct output for the given set of code?
class sample
 {
     public  int i;
     void display() 
     {
         Console.WriteLine(i);
     }
}    
class sample1 : sample 
{
    public  int j;
    public void display() 
    {
        Console.WriteLine(j);
    }
}    
class Program
{
    static void Main(string[] args)
    {
        sample1 obj = new sample1();
        obj.i = 1;
        obj.j = 2;
        obj.display();
        Console.ReadLine();
    }
}
Discuss
Answer: (c).2
Q97.
Correct statement about C#.NET code is?
class sample
{
    protected int index;
    public sample()
    {
        index = 0;
    }
}
class sample 1: sample
{
    public void add()
    {
        index += 1;
    }
}
class Program
{
    static void Main(string[] args)
    {
        sample 1 z = new sample 1();
        z . add();
    }
}
Discuss
Answer: (d).All of the mentioned
Q98.
The following set of code is run on single level of inheritance. Find correct statement about the 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();
     }
 }
Discuss
Answer: (c).compile time error
Q99.
What will be size of the object created depicted by csharp code snippet?
class baseclass
 {
     private int a;
     protected int b;
     public int c;
 }
 class derived : baseclass
 {
     private int x;
     protected int y;
     public int z;
 }
 class Program
 {
     static Void Main(string[] args)
     {
         derived a = new derived();
     }
 }
Discuss
Answer: (d).24 bytes
Q100.
What would be output of the following set of code?
class sample
{
    public sample()
    {
        Console.WriteLine("THIS IS BASE CLASS constructor");
    }
 }    
public class sample1 : sample 
{
 
}    
class Program
{
    static void Main(string[] args)
    {
        sample1 obj = new sample1();
        Console.ReadLine();
    }
}
Discuss
Answer: (c).Compile time error

Suggested Topics

Are you eager to expand your knowledge beyond C# Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!