Monday, July 13, 2009

C# InterviewQuestions- Part 9

81. why we use the ref keyword?
a ) If you want to pass a parameter by reference you should use the keyword ref

82. If an out parameter is not assigned a value with in the body of the function does that method complile?
a ) No. it won't compile

83. How can you make write a read only property?
a ) A property can made a read only by omitting the set accessor from the property defination.

84. When a static constructor is executed?
a ) It is executed when the class is loaded.

85. How many preprocessor directives exists in c#?
a ) They are #define, #undef, #if, #elif, #else, #endif, #error, #warning, #region, #endregion, #pragma etc

86. When an instance constructor is executed?
a ) It is executed when an instance is created.

87. Where you can assign values to a read only field?
a ) We can assign inside a constructor

88. Why we use the sixeof operator?
a ) If we want to know the size of any data type you can use sizeof operator.

89. What are the disadvantages of distructors in c#?
a ) 1. They are non deterministic. means there is no way to know when an object's destructor will actually execute.
2. Implementation of destructor delays the final removal of an object from memory. means objects that have destructors are removed in 2 passes. in the 1st pass only the destructor will be called with out removing object and then the 2nd pass removes the object, which is time taking and which may effect the performance.

90. What is the default access modifier of an interface members?
a) public

5 comments:

Unknown said...

guest blogger invitation

Hello,

This is Rose writing from www.huliq.com. I visited your blog and liked your content.

Would you be interested to send us a guest post on any of the issues related to the topics that you cover in your blog. We will publish it in our site www.huliq.com

In return with each guest blog we will give one link in the author's byline back to your blog. We only ask that the guest post ( we prefer it be a news coverage, sources can be Google News, CNN, MSNBC, Yahoo News, BBC and others) be a unique story and not be published in your blog.

HULIQ is indexed by Google News and Google requires that the length of the unique news is at least 5 paragraphs. We desire it to be at least 6 paragraphs if possible. And that all need to be a unique content. Once you send us a new story totally unique we will immediately publish it with you link in it, and within 15 minutes it should be indexed by Google News.

Also, please structure author byline as follows:

author's name:
author's e-mail:
author's blog url:

Please let me know if you may have any questions about www.huliq.com.

If you want to consult the topic with me first that's perfectly fine as well.

Many thanks
ruzik.mail@gmail.com

Clet Anni said...

This is interesting. i really love your work keep it up
well educative

ferdi kurniawan said...

Your blog is great pal!
i nver seen this kind of topic before...
i'm a computer student also..

Anonymous said...

whoa...
nice work..
kip it up...

Rahul said...

Thanks for gr8 information.
I found good resources of c#. Check this out

http://CSharpTalk.com