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

Q1.
Which of the following statements is correct about the C#.NET code snippet given below?

interface IMyInterface
{ 
    void fun1(); 
    int fun2();
}
class MyClass: IMyInterface
{ 
    void fun1()
    { } 
    int IMyInterface.fun2()
    { } 
}
Discuss
Answer: (d).The definition of fun1() in class MyClass should be void IMyInterface.fun1().
Q2.
Which of the following can be declared in an interface?

1. Properties
2. Methods
3. Enumerations
4. Events
5. Structures
Discuss
Answer: (b).1, 2, 4
Q3.
A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?
Discuss
Answer: (b).24 bytes
Discuss
Answer: (d).Properties can be declared inside an interface.
Discuss
Answer: (b).Interfaces can be inherited.
Discuss
Answer: (a).If a class implements an interface partially, then it should be an abstract class.
Discuss
Answer: (c).A class that implements an interface can explicitly implement members of that interface.
Q8.
Which of the following statements are correct about an interface in C#.NET?

1. A class can implement multiple interfaces.
2. Structures cannot inherit a class but can implement an interface.
3. In C#.NET, : is used to signify that a class member implements a specific interface.
4. An interface can implement multiple classes.
5. The static attribute can be used with a method that implements an interface declaration.
Discuss
Answer: (a).1, 2, 3
Discuss
Answer: (d).class MyClass: IMyInterface
{
double IMyInterface.MyFun(Single i)
{
// Some code
}
}
Discuss
Answer: (c).Interfaces members are automatically public.
Page 1 of 20

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!