Home Interview Questions and AnswersTechnical Interview Questions and Answers.NETC# CSharp Interview Questions and Answers For Freshers Part-5

c-sharp-img41.What is polymorphism?
The word polymorphism means having many forms. In object-oriented programming paradigm, polymorphism is often expressed as ‘one interface, multiple functions’.

42.What is the difference between static polymorphism and dynamic polymorphism?
Polymorphism can be static or dynamic. In static polymorphism, the response to a function is determined at the compile time. In dynamic polymorphism, it is decided at run-time.

43.How C# supports static polymorphism?
C# provides two techniques to implement static polymorphism. They are:

Function overloading

Operator overloading

44.What is early binding?
The mechanism of linking a function with an object during compile time is called early binding. It is also called static binding.

45.What is function overloading?
You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You cannot overload function declarations that differ only by return type.

46.How C# supports dynamic polymorphism?
Dynamic polymorphism is implemented by abstract classes and virtual functions.

47.What is a sealed class in C#?
When a class is declared sealed, it cannot be inherited.

48.How will you create sealed abstract class in C#?
No! It can not be created as abstract classes cannot be declared sealed.

49.What are virtual functions in C#?
When you have a function defined in a class that you want to be implemented in an inherited class(es), you use virtual functions. The virtual functions could be implemented differently in different inherited class and the call to these functions will be decided at runtime.

50.Is operator overloading supported in C#?
You can redefine or overload most of the built-in operators available in C#. Thus a programmer can use operators with user-defined types as well.

Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. Similar to any other function, an overloaded operator has a return type and a parameter list.


You may also like

Leave a Comment