Sunday, July 1, 2012

C# interview questions with answers, Part 2


C# developer interview questions with answers.


What is a delegate?

  1. A strongly typed function pointer.
  2. A light weight thread or process that can call a single method.
  3. A reference to an object in a different process.
  4. An inter-process message channel.
Answer :
1. A strongly typed function pointer.



How does assembly versioning in .NET prevent DLL Hell?

  1. The runtime checks to see that only one version of an assembly is on the machine at any one time.
  2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.
  3. The compiler offers compile time checking for backward compatibility.
  4. It doesn't.

Answer :
2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.



Which .Gang of Four. design pattern is shown below?
public class A {
    private A instance;
    private A() {
    }
    public
static A Instance {
        get
        {
            if ( A == null )
                A = new A();
            return instance;
        }
    }
}

  1. Factory
  2. Abstract Factory
  3. Singleton
  4. Builder


Answer :
3. Singleton



In the NUnit test framework, which attribute must adorn a test class in order for it to be picked up by the NUnit GUI?

  1. TestAttribute
  2. TestClassAttribute
  3. TestFixtureAttribute
  4. NUnitTestClassAttribute


Answer :
3. TestFixtureAttribute



Which of the following operations can you NOT perform on an ADO.NET DataSet?

  1. A DataSet can be synchronised with the database.
  2. A DataSet can be synchronised with a RecordSet.
  3. A DataSet can be converted to XML.
  4. You can infer the schema from a DataSet.

Answer :
2. A DataSet can be synchronised with a RecordSet.


In Object Oriented Programming, how would you describe encapsulation?

  1. The conversion of one type of object to another.
  2. The runtime resolution of method calls.
  3. The exposition of data.
  4. The separation of interface and implementation.
Answer :
4. The separation of interface and implementation.


No comments:

Post a Comment