Microsoft DotNet Interview Questions 2012

Recently I gave lot of interviews for Dot Net developer positions in various leading companies. I came across numerous good interview questions which sometimes confuse us. I would like to share with you all.

  1. What is Dependency Injection? Why is it required?
  2. Answer A brief introduction to dependency injection.

  3. Whether System.String class is a value type or reference type? Can we create an object of System.String class using new keyword?
  4. Answer Is string a value type or reference type in C#?

  5. What is the difference between System.String class and string keyword. Similarly what is the difference between int and System.Int32 etc.
  6. Answer What is the difference between String and string


  7. Why System.String class is immutable? What is the purpose behind this design by CLR?
  8. Answer Immutable types: understand their benefits and use them

  9. Are there any other types apart from System.String that are immutable? If yes which ones. If no then why this special treatment for System.String?
  10. Answer All core value types in framework like Byte, Int32, UInt32, Int64, UInt64, Single, Double, Decimal, BigInteger, Complex, all enums, and so on are immutable.

  11. How is StringBuilder class implemented internally? What is the best approach to create a custom StringBuilder class?

  12. Why cant methods be overloaded based on return type in C#. Is it allowed by CLR? Is this feature available in any other .NET language?

  13. DateTime is reference type or value type?
  14. Answer:DateTime type in C#

  15. What are the advantages or disadvantges of using a value type over reference type?

  16. What are the advantages or disadvantges of using a reference type over value type?

  17. What is the main benefit of using Generic types?
  18. Answer:Why use generics in C# dot net

  19. Explain how boxing process is done by CLR from memory standpoint.

  20. Explain how unboxing process is done by CLR from memory standpoint.

  21. How CLR assigns allocates memory to references types? What are the operations that happen in memory when a reference of a type is created. What operations get executed when a new instance is created using new keyword and assigned to the reference of a class?

  22. How/Where is memory allocated for Static variables?

  23. How does CLR calls virtual methods? How does it actually trace the address in memory of the overridden definition of a virtual method?

  24. If protected accessor means accessible in family and internal means assembly(accessible in same assembly) then protected internal means? “family or assembly” or “family and assembly?
  25. Answer: Its “family or assembly”. Other one is not supported by C#. Refer more here: Access modifiers in C#.NET

  26. Why cant someone create an object of static class in dotnet?
  27. Answer: This is because CLR does not emit a default constructor in IL for the static class. For more about static keyword please browse to What is Static keyword in C#.


  28. What is a Managed Module?

  29. What is Strongly Named assembly?How do we attach strong name to an assesmbly why should that be done?

  30. Is a strongly Named Assembly tamper proof? Consider someone opens the assembly in a notepad and changes the binary content of the assembly and saves the file. Will this corrupted assembly get loaded? If Not why?

  31. Can a assembly be unloaded? How can this be achieved?

  32. What is the main reason of introducing the concept of AppDomains?

  33. If there are 2 websites running under IIS and one of them crashes, will it imapct the other one?

  34. Suppose you have developed an assmbly and distributed to hundreds of clients. After one year you relese a new version of the assembly, then how would this new version be deployed in production at all applications?

  35. How Garbage Collector works internally? Briefly describe the generations approach used by GC.

  36. Can GC be called on demand? Will GC get called when GC.Collect() method is executed?

  37. How can you restrict types that are allowed to be used in a generic type? For example, can a List be restricted so that T can only be Employee type?



Please hold your breath I will add the answers to these questions in coming days. Till then feedback and answers are welcome in comments but do provide the question number.

Also read SQL server interview questions.

Shout it

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare

12 comments

  1. Microsoft DotNet Interview Questions 2012 | Tech Samosa…

    You’ve been kicked (a good thing) – Trackback from DotNetKicks.com…

  2. Microsoft DotNet Interview Questions 2012 | Tech Samosa…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…

  3. [...] In an earlier post Microsoft Dotnet Interview Questions, question no 10 was about benefits of generics. In this post I would answer [...]

  4. [...] In an earlier post Microsoft Dotnet Interview Questions 2012, question no. 7 was about DateTime type. In this post I would answer [...]

  5. [...] response to one of interview questions at the earlier post dot net interview questions,this post is dedicated to various access modifiers in [...]

  6. [...] read Microsoft dotnet interview questions 4 comments interview, SQL, [...]

  7. [...] This post will answer question no 1 of Microsoft DotNet Interview Questions 2012 [...]

  8. [...] post also provided the answer to dependency injection question in the post latest dot net interview questions Related [...]

  9. Sudhir says:

    Hi,
    Thanks for the questions. I find them very informative and useful. Please do add more questions.

  10. Sudhir Rao says:

    Very informative questions. Thanks a lot

Leave a Reply

Your email address will not be published. Required fields are marked *