Monday, March 9, 2009

C# InterviewQuestions- Part 5

41. How can we achieve multiple inheritance in c#?

a ) Using interfaces.

42. An interface is a value type or reference type?

a ) An interface is a reference type.

43. Does an interface extend classes?

a ) No

44. Can we write constructors and destructors for an interface?

a ) No.

45. What are the default modifiers of members of an interface?

a ) Public and abstract

46. What are the differences between an abstract class and an interface?

a ) Abstract class

1. it can contain implementation to some methods.

2. we can apply access modifiers to one or more methods in an abstract class

3. a class can not inherit more than one abstract class

4. an abstract class can have fields and constants defined

Interface

1. it just contains declarations. No implementation for any method.

2. we can not apply access modifiers to methods inside an interface

3. a class can inherit more than one interface

4. interface does not contain any field definition.

47. Can an interface is implemented by any number of classes?

a ) Yes.

48. What are the types of polymorphism?

a ) 2 types

1. operation polymorphism

2. inclusion polymorphism

49. How we achieve operation polymorphism and inclusion polymorphism?

a ) Operation polymorphism is achieved using overloaded methods and operators

And inclusion polymorphism is achieved using virtual functions.

50. what do you mean by compile time polymorphism?

a ) It is a process of selecting and binding the appropriate method to the object for a particular call at compile time.

2 comments:

dhimas said...

very good, keep going
visit back please at http://gohealthcare.blogspot.com

Unknown said...

Interesting posts.

Please visit http://kiwiriverman.blogspot.com and the rest of the blogging team/