Thursday, April 2, 2009

.Net Interview Questions Part VI

51 What is the difference between CONST and READONLY?

Ans. Both are meant for constant values. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used.
readonly int b;
public X()
public X(string s)
public X(string s, int i)
Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants, as in the following example:
public static readonly uint l1 = (uint) DateTime.Now.Ticks; (this can't be possible with const)

52. What is the difference between ref & out parameters?

Ans. An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.

53. What is the difference between Array and LinkedList?

54. What is the difference between Array and Arraylist?

Ans. As elements are added to an ArrayList, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly.

55. What is Jagged Arrays?

Ans. A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array-of-arrays."

56. What are indexers?

Ans. Indexers are similar to properties, except that the get and set accessors of indexers take parameters, while property accessors do not.

57. What is Asynchronous call and how it can be implemented using delegates?

58. How to create events for a control? What is custom events? How to create it?

59. If you want to write your own dot net language, what steps you will u take care?

60. Describe the difference between inline and code behind - which is best in a loosely coupled solution?

61. how dot net compiled code will become platform independent?

62. without modifying source code if we compile again, will it be generated MSIL again?

63. C++ & C# differences

No comments: