C# developer interview questions

A representative of a high-tech company in United Kingdom sent this in today noting that the list was used for interviewing a C# .NET developer. Any corrections and suggestions would be forwarded to the author. I won’t disclose the name of the company, since as far as I know they might still be using this test for prospective employees. Correct answers are in green color.

1) The C# keyword ‘int’ maps to which .NET type?

  1. System.Int16

  2. System.Int32

  3. System.Int64

  4. System.Int128

2) Which of these string definitions will prevent escaping on backslashes in C#?

  1. string s = #”n Test string”;

  2. string s = “’n Test string”;

  3. string s = @”n Test string”;

  4. string s = “n Test string”;

3) Which of these statements correctly declares a two-dimensional array in C#?

  1. int[,] myArray;

  2. int[][] myArray;

  3. int[2] myArray;

  4. System.Array[2] myArray;

4) If a method is marked as protected internal who can access it?

  1. Classes that are both in the same assembly and derived from the declaring class.

  2. Only methods that are in the same class as the method in question.

  3. Internal methods can be only be called using reflection.

  4. Classes within the same assembly, and classes derived from the declaring class.

5) What is boxing?

a) Encapsulating an object in a value type.

b) Encapsulating a copy of an object in a value type.

c) Encapsulating a value type in an object.

d) Encapsulating a copy of a value type in an object.

6) What compiler switch creates an xml file from the xml comments in the files in an assembly?

  1. /text

  2. /doc

  3. /xml

  4. /help

7) What is a satellite Assembly?

  1. A peripheral assembly designed to monitor permissions requests from an application.

  2. Any DLL file used by an EXE file.

  3. An assembly containing localized resources for another assembly.

  4. An assembly designed to alter the appearance or ‘skin’ of an application.

8) 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.

9) 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.

10) 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

11) 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

12) 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.

13) 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.

This entry was posted in .NET, Database. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

20 Comments on C# developer interview questions

  1. tasa
    Posted 10/19/2004 at 5:50 am | Permalink

    The question number 10 isn’t correct. The class given in the question can’t be created under any circumstances. The c’tor in private so no instance can be created and the Instance() func isn’t static, so it can’t be called without instance of the class. It’s Singleton pattern only if the Instance() func is static and private member A is static too.

  2. Posted 10/21/2004 at 3:49 am | Permalink

    Well spotted. I’ll issue a change correcting this ‘deliberate’ mistake ;¬)

  3. Chandra
    Posted 10/21/2004 at 4:49 pm | Permalink

    Question 10 is incorrect. To create a Singleton class, question 10 should be changed as follows:

    public class A
    {
    static private A instance;
    private A()
    {
    }

    static public A GetInstance()
    {
    if ( instance == null )
    instance = new A();
    return instance;
    }
    }

  4. Leo Gan
    Posted 5/9/2005 at 7:35 pm | Permalink

    Question 3) has two correct answers (jagged array is second)
    3) Which of these statements correctly declares a two-dimensional array in C#?

    int[,] myArray;

    int[][] myArray;

    and Question 10) has a more shorter code:
    public sealed class Singleton
    {
    private static readonly Singleton instance = new Singleton();

    private Singleton(){}

    public static Singleton Instance
    {
    get
    {
    return instance;
    }
    }
    }
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpSingletonInCsharp.asp

  5. one from 4guys4mrola
    Posted 12/30/2005 at 12:42 am | Permalink

    I am sure, these question are from brainbench

  6. ziv
    Posted 3/20/2006 at 4:12 pm | Permalink

    question 10 should be:
    public class A
    {

    private static A instance;

    private A()
    {

    }

    public static A Instance
    {

    get
    {

    if (instance == null)

    instance = new A();

    return instance;

    }

    }

    }

  7. Posted 6/12/2006 at 1:26 am | Permalink

    This question paper is used in Tavant for recruitment.

  8. Posted 8/29/2006 at 5:53 am | Permalink

    What is a delegate?
    answer :
    A reference to an object in a different process

  9. anand
    Posted 9/22/2006 at 10:08 am | Permalink

    i want the difference between trace.write & debug.write?
    can any one help me regarding?

    2>
    suppose i am my project as three forms let it be form1 , form2 and form3
    i am calling form2 from from1 so how can the form2 can know that form1 is calling?

  10. C#Guru
    Posted 10/19/2006 at 5:25 pm | Permalink

    Hey,
    Its good to have question and answers but not sure how many might agree with me that many of the answers seems to mislead you coz take an example of this quetion
    Question 123. Does C# supports multiple inheritance?
    Ans : No

    My explanation : C# supports multiple inheritance in the form of interfaces .How many agree with me?

  11. deepak
    Posted 3/16/2007 at 2:19 am | Permalink

    My explanation : C# supports multiple inheritance in the form of interfaces .How many agree with me?

    I agree: C# supports multiple inheritance using interfaces.

  12. vivek
    Posted 4/6/2007 at 1:37 am | Permalink

    I agree: C# supports multiple inheritance using interfaces.

  13. Manoj Kumar Sharma
    Posted 7/10/2007 at 1:03 pm | Permalink

    I do not agree to the statement:
    “C# supports multiple inheritance using interfaces.”

    Interfaces are IMPLEMENTED. Not inherited into a Class. The Interface signatures are defined by the class that applies the interface. So, the statement that “Interfaces are inherited” is 100% wrong.

    But there is a concept of an interface being inherited into a class. Take a look at the following code:

    interface IOne
    {
    void Demo();
    }

    interface ITwo : IOne
    {
    void Something();
    }

    class XYZ : ITwo
    {
    public void Demo() { ... }

    public void Something { ...}
    }

    Now, in this example, you can see that the class “XYZ” is implementing the “ITwo” interface. But this interface itself is inherited from “IOne”. Hence, the class has to provide both the method signatures.

    Over here, the signatures are implemented IMPLICITLY.

    Now, take a look at the following code:

    interface IOne
    {
    void Demo();
    }

    interface ITwo : IOne
    {
    void Something();
    void Demo();
    }

    class XYZ : ITwo
    {
    public void Demo() { ... }

    public void Something { ...}
    }

    Over here, the “ITwo” interface also provides the Demo() method signature. But when the class “XYZ” receives the signature, even though it is receiving three signatures (1 from IOne and 2 from ITwo), it provides only one signature for the Demo() method.

    Once again, I am using the IMPLICIT implementation of the interface.

    But now, take a look at the modified code of the class XYZ:

    interface IOne
    {
    void Demo();
    }

    interface ITwo : IOne
    {
    void Something();
    void Demo();
    }

    class XYZ : ITwo
    {
    void IOne.Demo() { ... }

    void ITwo.Something { ...}

    void ITwo.Demo() { ... }
    }

    Over here, both the interfaces are implemented EXPLICITLY. The class “XYZ” has now received the IOne signature through the derived interface ITwo.

    Once again, the class “XYZ” is termed as implementing the interface. But the sentence reads as - the class is implementing the inherited interface.

    The keyword still is “implement”, not inherit.

    Thank you.

    MANOJ KUMAR SHARMA.

  14. Jim Lee
    Posted 7/13/2007 at 1:35 am | Permalink

    Can you store multiple data types in System.Array?

    The correct answer should be yes! For example:

    Dim test_data(3) as Object
    test_date(0)=”Hello World!”
    test_date(1)=2007.7
    test_date(2)=Datetime.Now

  15. Ajay Shankar
    Posted 8/28/2007 at 10:36 pm | Permalink

    What is the difference between is, as and typeof operator?

    Differece between static constructor, private constructor and copy constructor?

    Difference between user defined functions and stored procedure?

  16. Rengith GK
    Posted 12/21/2007 at 1:13 pm | Permalink

    Static constructor has no access specifier and parameters. It is independent of instance of an object.

    Private constructor cannot create an instance of a class. The instance of a private constructor class is created and used only by that class itself.

  17. Tisha
    Posted 7/7/2008 at 3:57 pm | Permalink

    Some interview questions that were asked to me.

    What does the “EnableViewState” property do? Why would I want it on or off?
    It allows page objects to save their state in a Base64 encoded string in the page HTML. One should only have it enabled when needed because it adds to the page size and can get fairly large for complex pages with many controls. (It takes longer to download the page).

    What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
    Server.Transfer transfers excution directly to another page. Response.Redirect sends a response to the client and directs the client (the browser) to load the new page (it causes a roundtrip). If you don’t need to execute code on the client, Transfer is more efficient.

    What is the difference between interface and abstract class?

    What is global assembly cache?

    What is Agile software methodology?

    What is the difference between using directive and using statement?
    Using statement generates a try / finally around the object being allocated and calls Dispose() for you

    The using directive has two uses:
    • Create an alias for a namespace (a using alias).
    • Permit the use of types in a namespace, such that, you do not have to qualify the use of a type in that namespace (a using directive).
    How many catch exceptions can you use? Multiple

    Does C# support multiple inheritance?

    How can you call javascript from codebehind file?

    Can you have multiple web.config files?

    Different ways of caching?
    http://support.microsoft.com/kb/323290
    http://www.aspnettutorials.com/tutorials/network/web-caching-csharp.aspx Web Caching

    Parse v/s Convert?
    Int32.parse(string)
    ————————-
    Int32.Parse (string s) method converts the string representation of a number to its 32-bit signed integer equivalent.
    When s is null reference, it will throw ArgumentNullException.
    If s is other than integer value, it will throw FormatException.
    When s represents a number less than MinValue or greater than MaxValue, it will throw OverflowException.

    Example:
    ——————
    string s1 = “1234″;
    string s2 = “1234.65″;
    string s3 = null;
    string s4 = “123456789123456789123456789123456789123456789″;

    int result;
    bool success;

    result = Int32.Parse(s1); //– 1234
    result = Int32.Parse(s2); //– FormatException
    result = Int32.Parse(s3); //– ArgumentNullException
    result = Int32.Parse(s4); //– OverflowException

    Convert.ToInt32(string)
    ———————————-
    Convert.ToInt32(string s) method converts the specified the string representation of 32-bit signed integer equivalent. This calls in turn Int32.Parse () method.
    When s is null reference, it will return 0 rather than throw ArgumentNullException
    If s is other than integer value, it will throw FormatException.
    When s represents a number less than MinValue or greater than MaxValue, it will throw OverflowException

    Example:
    result = Convert.ToInt32(s1); //– 1234
    result = Convert.ToInt32(s2); //– FormatException
    result = Convert.ToInt32(s3); //– 0
    result = Convert.ToInt32(s4); //– OverflowException

    Int32.TryParse(string, out int)
    ———————————————
    Int32.Parse(string, out int) method converts the specified the string representation of 32-bit signed integer equivalent to out variable, and returns true if it parsed successfully, false otherwise. This method is available in C# 2.0
    When s is null reference, it will return 0 rather than throw ArgumentNullException.
    If s is other than integer value, the out variable will have 0 rather than FormatException.
    When s represents a number less than MinValue or greater than MaxValue, the out variable will have 0 rather than OverflowException.

    Example:-
    ————-
    success = Int32.TryParse(s1, out result); //– success => true; result => 1234
    success = Int32.TryParse(s2, out result); //– success => false; result => 0
    success = Int32.TryParse(s3, out result); //– success => false; result => 0
    success = Int32.TryParse(s4, out result); //– success => false; result => 0

    Convert.ToInt32 is better than Int32.Parse, since it return 0 rather than exception. But, again according to the requirement this can be used. TryParse will be best since it handles exception itself always.

  18. Tisha
    Posted 7/7/2008 at 3:59 pm | Permalink

    In web services, what is proxy used for?
    The fist step when calling a web service in an application is to create a web service proxy. The proxy acts as a “mediator” between your program and the web service. The proxy can be created using a tool called wsdl.exe or by adding a web reference to it.

    A client and a Web service can communicate using SOAP messages, which encapsulate the input and output parameters as XML. A proxy class maps parameters to XML elements and then sends the SOAP messages over a network. In this way, the proxy class frees you from having to communicate with the Web service at the SOAP level and allows you to invoke Web service methods in any development environment that supports SOAP and Web service proxies.
    There are two ways to add a proxy class to your development project using the Microsoft .NET Framework: with the WSDL tool in the .NET Framework, and by adding a Web reference in Microsoft Visual Studio. The following sections discuss this subject in further detail.
    http://msdn.microsoft.com/en-us/library/ms155134.aspx

    In addition to testing the service with a basic browser call to the service asmx file, we can test it using SOAP as well. A client and a Web service can communicate using SOAP messages, which encapsulate the in and out parameters as XML. Fortunately, for Web service clients, the proxy class handles the work of mapping parameters to XML elements and then sending the SOAP message over the network.
    A proxy class is created to shield the client from the complexity involved in invoking the Web service. A proxy class is a class containing all of the methods and objects exposed by the Web service. These methods handle the marshalling of the parameters into SOAP, sending the SOAP request over HTTP, receiving the response from the Web service, and unmarshalling the return value. The proxy class allows the client program to call a Web service as if the Web service was a local component.
    A proxy class may be generated from a service description as long as it conforms to the Web Services Description Language (WSDL) standard. You can create a proxy class using the .NET command-line tool wsdl.exe. In turn, a Web service client may invoke proxy class methods, which communicate with a Web service over the network by processing the SOAP messages sent to and from the Web service.
    Because a proxy class communicates with the Web service across the Internet, it is a good idea to verify that the url property of the proxy class references a trusted destination. The following command uses the wsdl.exe tool to generate a proxy class for our service:
    wsdl /language:cs /protocol:soap http://localhost/WebServiceExample/Service1.asmx
    http://articles.techrepublic.com.com/5100-10878_11-5755966.html

    What is WSDL?
    WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services). -W3C
    Basically, the WSDL describes the methods that the web service supports and how to access them, hence its name Web Service Description Language

  19. Ritesh
    Posted 7/10/2008 at 11:28 pm | Permalink

    Q. How can you raise an event while editing a column of DataTable?
    Ans.
    ‘ Add a ColumnChanging event handler for the table.
    AddHandler table.ColumnChanging, New _
    DataColumnChangeEventHandler(AddressOf Column_Changing)

    Private Sub Column_Changing(ByVal sender As Object, _
    ByVal e As DataColumnChangeEventArgs)
    End Sub

    Similarly we can have event handler for Column_Changed,Row_Deleting,Row_Deleted events of DataTable

  20. jessy
    Posted 7/16/2008 at 12:34 am | Permalink

    why do we give classname at the time of overloading an unary operator in C#?

One Trackback

  1. By Riley : Dot Net Interview Questions on 7/6/2006 at 10:32 am

    [...] Dot Net Interview Questions The ability to do something does not imply that you can explain it conceptually, or even that you understand the concept of what you are doing. So I have prepared a list of questionstasks that I think would be useful to complete before going for a C# related job. I have also provided a separate page with questions AND answers for the first set of 173 questions, and another page for the answers to the rest of the questions (not including Scott’s questions). You can find the first link below the first set of questions and the second link at the bottom of the post - they are also directly below if you want to jump straight to them. http://www.toqc.com/entropy/TheAnswers1.html http://www.toqc.com/entropy/TheAnswers2.html Before you do the questions, make sure you follow these rules: Rule 1 - Don’t say to yourself “yeah I know that” and move on to the next question. Answer the question as if you were in an interview. Rule 2 - For the questions that require code - write the code yourself on a piece of paper, don’t use an IDE. The QuestionsTasks: Name 10 C# keywords. What is public accessibility? What is protected accessibility? What is internal accessibility? What is protected internal accessibility? What is private accessibility? What is the default accessibility for a class? What is the default accessibility for members of an interface? What is the default accessibility for members of a struct? Can the members of an interface be private? Methods must declare a return type, what is the keyword used when nothing is returned from the method? Class methods to should be marked with what keyword? Write some code using interfaces, virtual methods, and an abstract class. A class can have many mains, how does this work? Does an object need to be made to run main? Write a hello world console application. What are the two return types for main? What is a reference parameter? What is an out parameter? Write code to show how a method can accept a varying number of parameters. What is an overloaded method? What is recursion? What is a constructor? If I have a constructor with a parameter, do I need to explicitly create a default constructor? What is a destructor? Can you use access modifiers with destructors? What is a delegate? Write some code to use a delegate. What is a delegate useful for? What is an event? Are events synchronous of asynchronous? Events use a publisher/subscriber model. What is that? Can a subscriber subscribe to more than one publisher? What is a value type and a reference type? Name 5 built in types. string is an alias for what? Is string Unicode, ASCII, or something else? Strings are immutable, what does this mean? Name a few string properties. What is boxing and unboxing? Write some code to box and unbox a value type. What is a heap and a stack? What is a pointer? What does new do in terms of objects? How do you dereference an object? In terms of references, how do == and != (not overridden) work? What is a struct? Describe 5 numeric value types ranges. What is the default value for a bool? Write code for an enumeration. Write code for a case statement. Is a struct stored on the heap or stack? Can a struct have methods? What is checked { } and unchecked { }? Can C# have global overflow checking? What is explicit vs. implicit conversion? Give examples of both of the above. Can assignment operators be overloaded directly? What do operators is and as do? What is the difference between the new operator and modifier? Explain sizeof and typeof. What does the stackalloc operator do? Contrast ++count vs. count++. What are the names of the three types of operators? An operator declaration must include a public and static modifier, can it have other modifiers? Can operator parameters be reference parameters? Describe an operator from each of these categories: Arithmetic Logical (boolean and bitwise) String concatenation Increment, decrement Shift Relational Assignment Member access Indexing Cast Conditional Delegate concatenation and removal Object creation Type information Overflow exception control Indirection and Address What does operator order of precedence mean? What is special about the declaration of relational operators? Write some code to overload an operator. What operators cannot be overloaded? What is an exception? Can C# have multiple catch blocks? Can break exit a finally block? Can continue exit a finally block? Write some try…catch…finally code. What are expression and declaration statements? A block contains a statement list {s1;s2;} what is an empty statement list? Write some if… else if… code. What is a dangling else? Is switch case sensitive? Write some code for a for loop. Can you have multiple control variables in a for loop? Write some code for a while loop. Write some code for do… while. Write some code that declares an array on ints, assigns the values: 0,1,2 to that array and use a foreach to do something with those values. Write some code for a collection class. Describe Jump statements: break, continue, and goto. How do you declare a constant? What is the default index of an array? What is array rank? Can you resize an array at runtime? Does the size of an array need to be defined at compile time. Write some code to implement a multidimensional array. Write some code to implement a jagged array. What is an ArrayList? Can an ArrayList be ReadOnly? Write some code that uses an ArrayList. Write some code to implement an indexer. Can properties have an access modifier? Can properties hide base class members of the same name? What happens if you make a property static? Can a property be a ref or out parameter? Write some code to declare and use properties. What is an accessor? Can an interface have properties? What is early and late binding? What is polymorphism What is a nested class? What is a namespace? Can nested classes use any of the 5 types of accessibility? Can base constructors can be private? object is an alias for what? What is reflection? What namespace would you use for reflection? What does this do? Public Foo() : this(12, 0, 0) Do local values get garbage collected? Is object destruction deterministic? Describe garbage collection (in simple terms). What is the using statement for? How do you refer to a member in the base class? Can you derive from a struct? Does C# supports multiple inheritance? All classes derive from what? Is constructor or destructor inheritance explicit or implicit? What does this mean? Can different assemblies share internal access? Does C# have “friendship”? Can you inherit from multiple interfaces? In terms of constructors, what is the difference between: public MyDerived() : base() an public MyDerived() in a child class? Can abstract methods override virtual methods? What keyword would you use for scope name clashes? Can you have nested namespaces? What are attributes? Name 3 categories of predefined attributes. What are the 2 global attributes. Why would you mark something as Serializable? Write code to define and use your own custom attribute. List some custom attribute scopes and possible targets. List compiler directives? What is a thread? Do you spin off or spawn a thread? What is the volatile keyword used for? Write code to use threading and the lock keyword. What is Monitor? What is a semaphore? What mechanisms does C# have for the readers, writers problem? What is Mutex? What is an assembly? What is a DLL? What is an assembly identity? What does the assembly manifest contain? What is IDLASM used for? Where are private assemblies stored? Where are shared assemblies stored? What is DLL hell? In terms of assemblies, what is side-by-side execution? Name and describe 5 different documentation tags. What is unsafe code? What does the fixed statement do? How would you read and write using the console? Give examples of hex, currency, and fixed point console formatting. Given part of a stack trace: aspnet.debugging.BadForm.Page_Load(Object sender, EventArgs e) +34. What does the +34 mean? Are value types are slower to pass as method parameters? How can you implement a mutable string? What is a thread pool? Describe the CLR security model. What’s the difference between camel and pascal casing? What does marshalling mean? What is inlining? List the differences in C# 2.0. What are design patterns? Describe some common design patterns. What are the different diagrams in UML? What are they used for? The answers to these questions can be found here: http://www.toqc.com/entropy/TheAnswers1.html Ok, so you’ve done them and you want more? There’s a great list of ASP.NET related interview questions on Scott Hanselman’s blog @ http://www.hanselman.com/blog/ASPNETInterviewQuestions.aspx He also has another post with general .NET questions @ http://www.hanselman.com/blog/WhatAGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx I’m getting Javascript errors on his blog and IE keeps crashing so I have provided all of his questions below: First ASP.NET post: From constructor to destructor (taking into consideration Dispose() and the concept of non-deterministic finalization), what the are events fired as part of the ASP.NET System.Web.UI.Page lifecycle. Why are they important? What interesting things can you do at each? What are ASHX files? What are HttpHandlers? Where can they be configured? What is needed to configure a new extension for use in ASP.NET? For example, what if I wanted my system to serve ASPX files with a *.jsp extension? What events fire when binding data to a data grid? What are they good for? Explain how PostBacks work, on both the client-side and server-side. How do I chain my own JavaScript into the client side without losing PostBack functionality? How does ViewState work and why is it either useful or evil? What is the OO relationship between an ASPX page and its CS/VB code behind file in ASP.NET 1.1? in 2.0? What happens from the point an HTTP request is received on a TCP/IP port up until the Page fires the On_Load event? How does IIS communicate at runtime with ASP.NET? Where is ASP.NET at runtime in IIS5? IIS6? What is an assembly binding redirect? Where are the places an administrator or developer can affect how assembly binding policy is applied? Compare and contrast LoadLibrary(), CoCreateInstance(), CreateObject() and Assembly.Load(). Second .NET Post (What Great .NET Developers Ought To Know): Everyone who writes code Describe the difference between a Thread and a Process? What is a Windows Service and how does its lifecycle differ from a “standard” EXE? What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design? What is the difference between an EXE and a DLL? What is strong-typing versus weak-typing? Which is preferred? Why? Corillian’s product is a “Component Container.” Name at least 3 component containers that ship now with the Windows Server Family. What is a PID? How is it useful when troubleshooting a system? How many processes can listen on a single TCP/IP port? What is the GAC? What problem does it solve? Mid-Level .NET Developer Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming. Describe what an Interface is and how it’s different from a Class. What is Reflection? What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP? Are the type system represented by XmlSchema and the CLS isomorphic? Conceptually, what is the difference between early-binding and late-binding? Is using Assembly.Load a static reference or dynamic reference? When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate? What is an Asssembly Qualified Name? Is it a filename? How is it different? Is this valid? Assembly.Load(”foo.dll”); How is a strongly-named assembly different from one that isn’t strongly-named? Can DateTimes be null? What is the JIT? What is NGEN? What are limitations and benefits of each? How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization? What is the difference between Finalize() and Dispose()? How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization? What does this useful command line do? tasklist /m “mscor*” What is the difference between in-proc and out-of-proc? What technology enables out-of-proc communication in .NET? When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003? Senior Developers/Architects What’s wrong with a line like this? DateTime.Parse(myString); What are PDBs? Where must they be located for debugging to work? What is cyclomatic complexity and why is it important? Write a standard lock() plus “double check” to create a critical section around a variable access. What is FullTrust? Do GAC’ed assemblies have FullTrust? What benefit does your code receive if you decorate it with attributes demanding specific Security permissions? What does this do? gacutil /l find /i “Corillian” What does this do? sn -t foo.dll What ports must be open for DCOM over a firewall? What is the purpose of Port 135? Contrast OOP and SOA. What are tenets of each? How does the XmlSerializer work? What ACL permissions does a process using it require? Why is catch(Exception) almost always a bad idea? What is the difference between Debug.Write and Trace.Write? When should each be used? What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not? Does JITting occur per-assembly or per-method? How does this affect the working set? Contrast the use of an abstract base class against an interface? What is the difference between a.Equals(b) and a == b? In the context of a comparison, what is object identity versus object equivalence? How would one do a deep copy in .NET? Explain current thinking around IClonable. What is boxing? Is string a value type or a reference type? What is the significance of the “PropertySpecified” pattern used by the XmlSerializer? What problem does it attempt to solve? Why are out parameters a bad idea in .NET? Are they? Can attributes be placed on specific parameters to a method? Why is this useful? C# Component Developers Juxtapose the use of override with new. What is shadowing? Explain the use of virtual, sealed, override, and abstract. Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d Explain the differences between public, protected, private and internal. What benefit do you get from using a Primary Interop Assembly (PIA)? By what mechanism does NUnit know what methods to test? What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;} What is the difference between typeof(foo) and myFoo.GetType()? Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful? What is this? Can this be used within a static method? ASP.NET (UI) Developers Describe how a browser-based Form POST becomes a Server-Side event like Button1_OnClick. What is a PostBack? What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState? What is the element and what two ASP.NET technologies is it used for? What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each? What is Web Gardening? How would using it affect a design? Given one ASP.NET application, how many application objects does it have on a single proc box? A dual? A dual with Web Gardening enabled? How would this affect a design? Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should you use Thread Local storage with ASP.NET? Is the [ThreadStatic] attribute useful in ASP.NET? Are there side effects? Good or bad? Give an example of how using an HttpHandler could simplify an existing design that serves Check Images from an .aspx page. What kinds of events can an HttpModule subscribe to? What influence can they have on an implementation? What can be done without recompiling the ASP.NET Application? Describe ways to present an arbitrary endpoint (URL) and route requests to that endpoint to ASP.NET. Explain how cookies work. Give an example of Cookie abuse. Explain the importance of HttpRequest.ValidateInput()? What kind of data is passed via HTTP Headers? Juxtapose the HTTP verbs GET and POST. What is HEAD? Name and describe at least a half dozen HTTP Status Codes and what they express to the requesting client. How does if-not-modified-since work? How can it be programmatically implemented with ASP.NET?Explain <@OutputCache%> and the usage of VaryByParam, VaryByHeader. How does VaryByCustom work? How would one implement ASP.NET HTML output caching, caching outgoing versions of pages generated via all values of q= except where q=5 (as in http://localhost/page.aspx?q=5)? Developers using XML What is the purpose of XML Namespaces? When is the DOM appropriate for use? When is it not? Are there size limitations? What is the WS-I Basic Profile and why is it important? Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include elements from both namespace. What is the one fundamental difference between Elements and Attributes? What is the difference between Well-Formed XML and Valid XML? How would you validate XML using .NET? Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes(”//mynode”); Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax) What is the difference between XPathDocument and XmlDocument? Describe situations where one should be used over the other. What is the difference between an XML “Fragment” and an XML “Document.” What does it meant to say “the canonical” form of XML? Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve? Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why? Does System.Xml support DTDs? How? Can any XML Schema be represented as an object graph? Vice versa? Had enough yet? Here are some more general .NET questions: What is MSIL? What is the CLR and how is it different from a JVM? What is WinFX? What is Indigo? Explain the Remoting architecture. How would you write an asynchronous webservice? What is the Microsoft Enterprise Library? Discuss System.Collections Discuss System.Configuration Discuss System.Data Discuss System.Diagnostics Discuss System.DirectoryServcies Discuss System.Drawing Discuss System.EnterpriseServices Discuss System.Globalization Discuss System.IO Discuss System.Net System.Runtime contains System.Runtime.CompilerServcies, what else? Discuss System.Security Discuss System.Text Discuss System.Threading Discuss System.Web Discuss System.Windows.Forms Discuss System.XML Does VS.NET 2003 have a web browser (think about it)? How are VB.NET and C# different? Contrast .NET with J2EE. What benefit do you have by implementing IDisposable interface in .NET? Explain the difference between Application object and Session object in ASP.NET. Explain the difference between User controls and Custom controls in ASP.NET. Describe transaction control in ADO.NET. Describe transaction control in SQL Server. In .NET, what is an application domain? In SQL Server, what is an index? What is optimistic vs. pessimistic locking? What is the difference between a clustered and non-clustered index. In terms of remoting what is CAO and SAO? Remoting uses MarshallByRefObject, what does this mean? Write some code to use reflection, remoting, threading, and thread synchronization. If the interest is high enough I’ll publish the answers to the rest of these questions (i.e. Scott’s questions) in a future post. Please comment with any extra questions that you think should be added to this list, or any answers for the original 173 that are wrong or incomplete. Ah, what the hell - here are some more :) These next questions are taken from: http://blog.daveranck.com/archive/2005/01/20/355.aspx Misc Can you prevent your class from being inherited by another class? Explain the three tier or n-Tier model. What is SOA? Is XML case-sensitive? Can you explain some differences between an ADO.NET Dataset and an ADO Recordset? (Or describe some features of a Dataset). ASP.NET Explain the differences between Server-side and Client-side code? What does the “EnableViewState” property do? Why would I want it on or off? What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? What base class do all Web Forms inherit from? What does WSDL stand for? What does it do? Which WebForm Validator control would you use if you needed to make sure the values in two different WebForm controls matched? What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? Here are some questions from: http://www.techinterviews.com/?p=153 What is a satellite Assembly? In Object Oriented Programming, how would you describe encapsulation? More questions! This time from: http://blogs.wwwcoder.com/tsvmadhav/archive/2005/04/08/2882.aspx Can you store multiple data types in System.Array? What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? How can you sort the elements of the array in descending order? What’s the .NET collection class that allows an element to be accessed using a unique key? What class is underneath the SortedList class? Will the finally block get executed if an exception has not occurred?­ Can you prevent your class from being inherited by another class? If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor? What’s a multicast delegate? What’s the difference between // comments, /* */ comments and /// comments? How do you generate documentation from the C# file commented properly with a command-line compiler? What debugging tools come with the .NET SDK? What does assert() method do? What’s the difference between the Debug class and Trace class? Why are there five tracing levels in System.Diagnostics.TraceSwitcher? Where is the output of TextWriterTraceListener redirected? How do you debug an ASP.NET Web application? What are three test cases you should go through in unit testing? Can you change the value of a variable while debugging a C# application? What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? What is the wildcard character in SQL? Explain ACID rule of thumb for transactions. Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted? What are the ways to deploy an assembly? What namespaces are necessary to create a localized application? What is the smallest unit of execution in .NET? Ok - that’s me done - 360+ questions is enough. The second set of answers can be found at: http://www.toqc.com/entropy/TheAnswers2.html Published Friday, July 07, 2006 1:55 AM by Riley [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*