Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

search topic

Tuesday, May 13, 2008

C# Interview Questions -3

Question What’s the difference between an interface and abstract class?
Answer: In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

Question How can you overload a method?
Answer: Different parameter data types, different number of parameters, different order of parameters.

Question If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Answer: Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Question What’s the difference between System.String and System.StringBuilder classes?
Answer: System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

Question What’s the advantage of using System.Text.StringBuilder over System.String?
Answer: StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.

Question Can you store multiple data types in System.Array?
Answer: No.

Question What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
Answer: The first one performs a deep copy of the array, the second one is shallow.

Question How can you sort the elements of the array in descending order?
Answer: By calling Sort() and then Reverse() methods.

Question What’s the .NET datatype that allows the retrieval of data by a unique key?
Answer: HashTable.

Question What’s class SortedList underneath?
Answer: A sorted HashTable.

Question Will finally block get executed if the exception had not occurred?
Answer: Yes.


Note: Above interview questions are same if your are looking for asp net c# interview questions, c# interview, c# interview question, c# interview questions, c# interview questions and answers and c# technical interview.

No comments: