C Sharp Polymorphism Questions and Answers

Take Exam

C Sharp Polymorphism questions with answers help developers and students understand one of the most important OOP (Object-Oriented Programming) concepts in C#. Polymorphism allows methods to perform different tasks based on the object that invokes them. This collection of programming questions and answers focuses on runtime and compile-time polymorphism, virtual methods, interfaces, and method overriding. Designed for those preparing for C# programming MCQ tests and interviews with TCS, Infosys, or Capgemini, these examples include detailed explanations and code snippets. Practicing such programming interview questions with answers will sharpen your technical problem-solving skills and deepen your understanding of polymorphism in real-world applications.

Learn about polymorphism in C# OOP. You might also find C# inheritance and interfaces .

C Sharp Polymorphism

Showing 10 of 15 questions

1. Which of the following unary operators can be overloaded? 1  true    2 false    3  +    4 new     is

  • 1, 2, 3
  • 3, 4, 5
  • 3 only
  • 5 only
Show Answer Report

2. A derived class can stop virtual inheritance by declaring an override as

  • inherits
  • extends
  • inheritable
  • not inheritable
Show Answer Report

3. Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member?

  • new
  • base
  • overloads
  • override
Show Answer Report

4. Which of the following statements is correct?

  • When used as a modifier, the new keyword explicitly hides a member inherited from a base class.
  • Operator overloading works in different ways for structures and classes.
  • It is not necessary that all operator overloads are static methods of the class.
  • The cast operator can be overloaded.
Show Answer Report

5. Which of the following keyword is used to overload user-defined types by defining static member functions?

  • op
  • opoverload
  • operator
  • operatoroverload
Show Answer Report

6. Which of the following statements is correct?

  • Static methods can be a virtual method.
  • Abstract methods can be a virtual method.
  • It is necessary to override a virtual method.
  • When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overriden.
Show Answer Report

7. Which of the following statements are correct?     All operators in C#.NET can be overloaded.     We can use the new modifier to modify a nested type if the nested type is hiding another type.     In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator.     Method overloading is used to create several methods with the same name that performs similar tasks on similar data types.     Operator overloading permits the use of symbols to represent computations for a type.

  • 1, 3
  • 2, 4
  • 2, 5
  • 3, 4
Show Answer Report

8. Which of the following statement is correct about the C#.NET code snippet given below? public class Sample {     public int x;     public virtual void fun()     { } } public class DerivedSample : Sample {     new public void fun()     { } }

  • DerivedSample class hides the fun() method of base class.
  • The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object.
  • The code replaces the DerivedSample class version of fun() method with its Sample class version.
  • It is not possible to hide Sample class version of fun() method without use of new in DerivedSample class.
Show Answer Report

9. Which of the following statements is correct?

  • The conditional logical operators cannot be overloaded.
  • When a binary operator is overloaded the corresponding assignment operator, if any, must be explicitly overloaded.
  • We can use the default equality operator in an overloaded implementation of the equality operator.
  • A public or nested public reference type does not overload the equality operator.
Show Answer Report

10. Which of the following operators cannot be overloaded?     true     false     new     ~     sizeof

  • 1, 3
  • 2, 4
  • 3, 5
  • All of the above
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test