Monday, February 23, 2009

C# InterviewQuestions- Part 3

Interview Questions

21. What are the properties of constant members?
a ) 1. They should use the modifier ‘ const’
2. Their value should be given when they are defined (it can’t be changed later)
3. They are implicitly static.

22. Why we use this keyword?
a ) This is used to distinguish local and instant variables that have the same name.

23. Does a copy of a static variable is created every time a class is instantiated?
a ) No.

24. What is a partial class?
a ) A partial class is a class which resides in multiple files. It should use 'partial' keyword. Generally it is used in situations where multiple developers need acess to the same class.

25. What is the name of the class from which all .net classes are derived?
a ) System.Object

26. Does c# support global variables?
a ) No. all declarations must be done inside a class.

27. Differences between property and indexer?
a ) Property
A property can be static member
The get accessor of a property corresponds to a method with no parameters
An indexer is always an instant member
The get accessor of an indexer corresponds to the same formal parameter list as the indexer.

28. Differences between overloading and overriding?
a ) Overloading
1. used we want a method with more than one definition with in the same scope
2. in overloading, methods will have same name but different number, types, order of arguments.
1. this is used when we have parent, child classes.
2. in overriding , methods will have same name with same arguments and same return type.

29. what is the order of the constructor execution in inheritance?
a ) They are executed from top(parent class) to bottom(child class)

30. what is the order of the destructors execution in inheritance?
a ) They are executed from bottom(child class) to top(parent/base class)


Vinay Rai said...

The tips will really help the students grasp the concepts very easily. Recommended for Dummies.

Topher said...

This is a very clear and concise way to describe, thanks for the explanations.

ericjogja said...

thank for your information
I want to learn asp some future time

FAUZI said...

hi ...
at this time I have visited your blog .... please visit my blog ... or

Dr. James said...

I am not clear on the subject. You need to make a real clear intriduction that helps thr reaber follow easier.