Dot Net Interview Questions

.NET Remoting questions and answers

  1. What’s a Windows process? It’s an application that’s running and had been allocated memory.
  2. What’s typical about a Windows process in regards to memory allocation? Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
  3. Why do you call it a process? What’s different between process and application in .NET, not common computer usage, terminology? A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.

.NET Remoting questions and answers II

  1. What is a formatter? A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
  2. Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs? Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.
  3. What’s SingleCall activation mode used for? If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.

.NET interview questions - Windows Forms


  1. I am constantly writing the drawing procedures with System.Drawing.Graphics, but having to use the try and dispose blocks is too time-consuming with Graphics objects. Can I automate this?
    Yes, the code

    System.Drawing.Graphics canvas = new System.Drawing.Graphics();
    try
    {
      //some code
    }
    finally
      canvas.Dispose();

    is functionally equivalent to

    using (System.Drawing.Graphics canvas = new System.Drawing.Graphics())
    {
      //some code
    }  //canvas.Dispose() gets called automatically
  2. How do you trigger the Paint event in System.Drawing?Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.

.NET Windows Forms basics

  1. Write a simple Windows Forms MessageBox statement.
    System.Windows.Forms.MessageBox.Show
      ("Hello, Windows Forms");
  2. Can you write a class without specifying namespace? Which namespace does it belong to by default??
    Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you wouldn’t want global namespace.
  3. You are designing a GUI application with a windows and several widgets on it. The user then resizes the app window and sees a lot of grey space, while the widgets stay in place. What’s the problem? One should use anchoring for correct resizing. Otherwise the default property of a widget on a form is top-left, so it stays at the same location when resized.

C# and .NET interview questions

1. How big is the datatype int in .NET? 32 bits.

2. How big is the char?
16 bits (Unicode).

3. How do you initiate a string without escaping each backslash? Put an @ sign in front of the double-quoted string.

4. What are valid signatures for the Main function?
* public static void Main()
* public static int Main()
* public static void Main( string[] args )
* public static int Main(string[] args )

5. Does Main() always have to be public? No.

Pages (13): « First ... « 6 7 8 [9] 10 11 12 » ... Last »