Skip to main content

Dotnet Interview Questions and Answers

  1. Does C# support multiple-inheritance?
    No. 
  2. Who is a protected class-level variable available to?
    It is available to any sub-class (a class inheriting this class). 
  3. Are private class-level variables inherited?
    Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.  
  4. Describe the accessibility modifier "protected internal".
    It is available to classes that are within the same assembly and derived from the specified base class.  
  5. What's the top .NET class that everything is derived from?
    System.Object.  
  6. What does the term immutable mean?
    The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.  
  7. What's the difference between System.String and System.Text.StringBuilder classes?
    System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.  
  8. What's the advantage of using System.Text.StringBuilder over System.String?
    StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time a string is changed, a new instance in memory is created. 
  9. Can you store multiple data types in System.Array?
    No.  
  10. What's the difference between the System.Array.CopyTo() and System.Array.Clone()?
    The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object. 
  11. How can you sort the elements of the array in descending order?
    By calling Sort() and then Reverse() methods.  
  12. What's the .NET collection class that allows an element to be accessed using a unique key?
    HashTable.  
  13. What class is underneath the SortedList class?
    A sorted HashTable.  
  14. Will the finally block get executed if an exception has not occurred?­
    Yes. 
  15. What's the C# syntax to catch any possible exception?
    A catch block that catches the exception of type System.Exception.  You can also omit the parameter data type in this case and just write catch {}.  
  16. Can multiple catch blocks be executed for a single try statement?
    No.  Once the proper catch block processed, control is transferred to the finally block (if there are any).  
  17. Explain the three services model commonly know as a three-tier application.
    Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources). 

Taken from Mark Wagner's site



Comments

Post a Comment

Popular posts from this blog

Http 500.50 URL Rewrite Error

Symptoms: HTTP Error 500.50 - URL Rewrite Module Error. Error Information Module- RewriteModule Images are broken and not displayed in wordpress, Images are displayed when you edit them,Wordpress Images Broken, Wordpress Images Upload Issue This post if for the people who are searching all the pages over internet for " HTTP Error 500.50 - URL Rewrite Module Error". You might be searching for the pages which will give you solution to install/uninstall the url rewrite module.When you are running Wordpress on Windows server 2008 these types of error pops up.  So I scratched my head and started searching and found out one website which is useful in this type of error. Then I filtered everything and prepared a process for this.This will reduce your turn around time. Step-1: Open PHP.ini and search for  "upload_tmp_dir" and change the value to windows temp directory "C:\Windows\Temp" Step-2: Right click On the Windows/Temp folder and assi...

DotNetNuke

What is DotNetNuke ? DNN (DotNetNuke) is the leading web Content Management System (CMS) for Microsoft, powering over 700,000 production web sites worldwide. DotNetNuke was written in VB.Net. It is distributed under both a Community Edition MIT license and commercial proprietary licenses i.e., Professional and Enterprise Editions. You can download the DotNetNuke Trial Edition from the below link http://www.dotnetnuke.com/Products/Professional-Edition-Trial.aspx Below link provides a quick overview of how to get up and running with DotNetNuke. http://www.dotnetnuke.com/Resources/Video-Library/Viewer/Video/449/View/Details/DotNetNuke-6-2-Getting-Started.aspx

Usage of Ternary Operator

You can optimize the code by using the ternary operator, pass a parameter to this function it will compare the salary with the given value and if the condition satisfied It will print the value before the colon and if not satisfied it will print the value after colon. Ternary Operator (?:) condition ? condition satisfied : Condition not satisfied string TernaryOperatorUsage(int Salary) {     return salary >= 5000 ? "Congratulations! You are eligible for a pay hike." :                        "Sorry! You're not eligible for a pay hike."; } The above example illustrates the use of ternary operator in your code.