Monday, March 2, 2009

C# InterviewQuestions- Part 4

Interview Questions
---------------------------
31. What are the inheritance types?
a ) 1. single level inheritance
2. multi level inheritance
3. multiple inheritance
4. hierarchical inheritance

32. Can we inherit the private members of a class
a ) Yes. But they are not accessible.

33. Why we use the keyword virtual?
a ) When you want to override a method of base class in derived class you should use this virtual keyword to the method in base class

34. Why we use override keyword?
a ) When you want to override a method of base class in derived class you should use this override keyword to the method in derived class

35. What are the abstract classes?
a ) Abstract classes are the classes for which we can not create objects. Means an abstract class can not be instantiated.

36. What are abstract methods?
a ) Abstract methods are the methods which does not contain their body part means they does not provide any implementation.

37. What are the properties of abstract methods?
a ) 1. they do not contain body part.
2. their definition/implementation should be given in non-abstract classes by overriding that method.
3. we can not use static modifier to it.

38. What are the sealed classes?
a ) If you want to prevent a class from being inherited you can use this keyword sealed to that particular class

39. What are sealed methods?
a ) A sealed method is a method which can not be overridden by its derived class.

40. Does a sealed class is an abstract class? Why?
a ) No a sealed class is not an abstract class. Because we can’t inherit a sealed class but we can inherit an abstract class.

7 comments:

Albert Opoku said...

i can see you are are blogging on interview questions, it would have been nice to have a welcome note that lets us know what your blog is actually offering

Mcgruder22 said...

Wow Ok your blog is very helpful keep up the good work

Anonymous said...

nice blog. Asp.Net Interview Questions are pretty useful

Unknown said...

your blog is very helpful keep up the good work ON Asp.Net Interview Questions

Unknown said...

the site content and interview questions are nice

upstatesc said...

Stopping in to say, "what a great blog".

Edward Roberts Jr. said...

Wow, kinda informative posts you have provided..