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 17 of 20

Explore more Topics under C# programming

Q161.
Select the correct implementation of the interface which is mentioned below.
interface a1
{
    int fun(int i);
}
Discuss
Answer: (c).class a: a1
{
int a1.fun(int i)
{
}
}
Q162.
Which of these can be used to fully abstract a class from its implementation?
Discuss
Answer: (c).Interfaces
Q163.
Access specifiers which can be used for an interface are?
Discuss
Answer: (a).Public
Q164.
Correct statement about c#.NET code snippet given below is?
interface a1
{
    void f1();
    int f2();
}
class a :a1
{
    void f1()
    {
    }
    int a1.f2()
    {
    }
}
Discuss
Answer: (c).The definition of f1() in class a should be void a1.f1()
Discuss
Answer: (c).An interface could not contain signature of the indexer
Q166.
Choose the correct statement about following code snippet given below:
interface a1
 {
     void f1();
     void f2();
 }
 class a :a1
 { 
     private int i;
     void a1.f1()
     {
     }
 }
Discuss
Answer: (b).Class a is an abstract class
Q167.
Choose the correct statement about the following code snippet in C#.NET:
interface abc
 {
     String FirstName
     {
         get;
         set;
     }
    String LastName
    {
        get;
        set;
    }
    void print();
    void stock();
    int fun();
}
Discuss
Answer: (b).It is workable code
Q168.
What will be the output of the given code snippet?
interface calc
 {
     void cal(int i);
 }
 public  class maths :calc 
 {
     public int x;
     public void cal(int i) 
     {
         x = i * i;            
     }
 }
 class Program
 {
     public static void Main(string[] args)
     {            
         display arr = new display();
         arr.x = 0;      
         arr.cal(2);
         Console.WriteLine(arr.x);
         Console.ReadLine();
     }
 }
Discuss
Answer: (c).4
Q169.
What will be the output of the given code snippet?
interface calc
 {
     void cal(int i);
 }
 class displayA :calc 
 {
     public int x;
     public void cal(int i) 
     {
         x = i * i;            
     }
 }
 class displayB :calc
 {
     public int x;
     public void cal(int i)
     {
         x = i / i;
     }
 }
 class Program
 {
     public static void Main(string[] args)
     {            
         displayA arr1 = new displayA();
         displayB arr2 = new displayB();
         arr1.x = 0;
         arr2.x = 0;
         arr1.cal(2);
         arr2.cal(2);
         Console.WriteLine(arr1.x + " " + arr2.x);
         Console.ReadLine();
     }
 }
Discuss
Answer: (c).4 1
Q170.
Choose the correct output of the given code snippet?
interface i1
{
    void fun();
}
interface i2
{
    void fun();
}
public class maths :i1, i2
{
    void i1.fun()
    {
        Console.WriteLine("i1.fun");
    }
    void i2.fun()
    {
        Console.WriteLine("i2.fun");
    }
}
class Program
{
    static void Main(string[] args)
    {
        Sample obj = new Sample();
        i1 i = (i1) obj;
        i.fun();
        i2 ii = (i2) obj;
        ii.fun();
    }
}
Discuss
Answer: (d).i1.fun
i2.fun

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!