C# Interview Questions & Answers, Part 2
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).
asp.net questions and answers
Whether azure supports all OS?
No it supports Windows 7, Vista, Windows 2008 server.
What is the difference between document.getElementById('<%= btnMakeUpdate.ClientID %>').name AND document.getElementById('<%= btnMakeUpdate.UniqueID %>')?
There is no difference. Both will use control's id seperated using $ sign.
MaintainScrollPositionOnPostback will work in Ajax Postback.
NOTE: This is objective type question, Please click question title for correct answer.
You are going to deploy a website on live server. Which build option you will select while building the website? 1. Debug 2. Release
You should select Release .
Your site is deployed on testing server and you make some change in web.config file stored on the server. What will happen to the user's who are accessing site at that time?
When you make any change in web.config file then IIS restarts automatically so all the session and application variables get reset. This can affect user drastically as their session is lost.
Can you add title to browser history point?
Yes, we can add.
Can you hash state information of URL ?
NOTE: This is objective type question, Please click question title for correct answer.
Can you have multiple form tags in a page?
YES.
Page can have multiple form tags but only one of them can contain runat=”server” atrribute at a time.
C# Interview Questions & 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.
asp.net question: Whether inline, embedded and external style sheets are same?
No, they are different.
External Style Sheet :
An external style sheet is a seperate style sheet file used by many pages.
Internal Style Sheet :
An internal style sheet used specifically for a single page within the page
Inline Styles :
This can be achieved by the style property of each control.
Microsoft – C# Interview Questionsv
1. How do you inherit from a class in C#?
2. What is .NET Framework?
3. How we handle sql exceptions? What is the class that handles SqlServer exceptions?
4. What is the advantage of serialization?
5. how to fill datalist usinf XML file and how to bind it,code behind language is c#
6. What is the difference between const and static read-only?
7. Is it mandatory to implement all the methods which are there in abstract class if we inherit that abstract
8. Why do I get a "CS5001: does not have an entry point defined" error when compiling?
9. What's the implicit name of the parameter that gets passed into the class' set method?
10. What is indexer? Where it is used explain
11. Does C# support multiple inheritance?
12. When you inherit a protected class-level variable, who is it available to?
13. Are private class-level variables inherited?
14. Describe the accessibility modifier protected internal.
15. What is the implicit name of the parameter that gets passed into the class set method?
16. What's the top .NET class that everything is derived from?
17. How's method overriding different from overloading?
18. What does the keyword virtual mean in the method definition?
19. What is an abstract class?
20. What is the data provider name to connect to Access database?
asp.net questions and answers
What are the various ways of securing a web site that could prevent from hacking etc .. ?
1) Authentication/Authorization
2) Encryption/Decryption
3) Maintaining web servers outside the corporate firewall. etc.,
Name the validation control available in asp.net?.
RequiredField, RangeValidator,RegularExpression,Custom validator,compare Validator
What is a PostBack?
The process in which a Web page sends data back to the same page on the server.
what is Reflection in dotNet
Reflection is the feature in .Net, which enables us to get some information about object in runtime. That information contains data of the class. Also it can get the names of the methods that are inside the class and constructors of that object.
program should use the reflection derived from namespace System.Reflection .
using reflection can dynamically load assembly