Wednesday, November 14, 2007

Dot Net Interview Questions - Part 3

  1. What is the difference between CONST and READONLY?
    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()
    {
    b=1;
    }
    public X(string s)
    {
    b=5;
    }
    public X(string s, int i)
    {
    b=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)
  2. What is the difference between ref & out parameters?
    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.
  3. What is the difference between Array and LinkedList?
  4. What is the difference between Array and Arraylist?
    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.
  5. What is Jagged Arrays?
    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."
  6. What are indexers?
    Indexers are similar to properties, except that the get and set accessors of indexers take parameters, while property accessors do not.
  7. What is Asynchronous call and how it can be implemented using delegates?
  8. How to create events for a control? What is custom events? How to create it?
  9. If you want to write your own dot net language, what steps you will u take care?
  10. Describe the difference between inline and code behind - which is best in a loosely coupled solution?
  11. how dot net compiled code will become platform independent?
  12. without modifying source code if we compile again, will it be generated MSIL again?
  13. C++ & C# differences

  1. Interop Services?
    The common language runtime provides two mechanisms for interoperating with unmanaged code:
    • Platform invoke, which enables managed code to call functions exported from an unmanaged library.
    • COM interop, which enables managed code to interact with COM objects through interfaces.

Both platform invoke and COM interop use interop marshaling to accurately move method arguments between caller and callee and back, if required.

  1. How does u handle this COM components developed in other programming languages in .NET?
  2. What is RCW (Runtime Callable Wrappers)?
    The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.
  3. What is CCW (COM Callable Wrapper)

A proxy object generated by the common language runtime so that existing COM applications can use managed classes, including .NET Framework classes, transparently.

  1. How CCW and RCW is working?
  2. How will you register com+ services?
    The .NET Framework SDK provides the .NET Framework Services Installation Tool (Regsvcs.exe - a command-line tool) to manually register an assembly containing serviced components. You can also access these registration features programmatically with the System.EnterpriseServicesRegistrationHelper class by creating an instance of class RegistrationHelper and using the method InstallAssembly
What is use of ContextUtil class?
ContextUtil is the preferred class to use for obtaining COM+ context information.

No comments: