Interview Qn's

 Asp.net interview Questions

1. Asp_wp.exe in the page loading process...?
Ans: Intetinfo.exe is the microsoft IIS server running, handling ASP.NET requests among other things. when an asp.net request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual, worker process aspnet_wp.exe.
2. Whats the different between Response.Write() and Responce.Output.Write()..?
Ans: Response.Write.Output.Write() allows you to write formated output.
3. Whats methods are fired during the page_load..?
Ans: Init() - When the page is Instantiated.
        Load() - When the page is Loaded into Server memorey.
        Prerender() - The breaf moment before the page is displayed to the user as HTML.
        Unload() - When page finishes loading.      
4. When during the page processing cycle is viewstate available..?
Ans: After the Init() and before the Page_Load or Unload for A control.
5. What namespace does the web page belong in the .Net frame work class hierarchy..?
Ans: System.Web.UI.Page.
6. Where do you store the information about the users local..?
Ans. Syste.Web.UI.Page.Culture.
7. Whats is the difference between Code Behind = "Mycode.aspx.cs" and src="MyCode.aspx.cs"..?
Ans: Codebehind is relevant to Visiual Studio .Net only.
8. What is a Bubbled Event..?
Ans: When you have a complex control, like DataGrid, Writing an event processing routine for each subject (cell, button, row etc) is quite tedious. The Control can bubble up their event handlers allowing the main datagrid event handler to take care of its constituents.
9. Suppose you want a certain ASP.NET function Executed OnMouseOver for a certain button. Where do  you add an event handler..?
Ans: Add an event handler to OnMouseOver attribute to the Button.
       Example: btnSubmit.Attribute.Add("onmouseover","SomeJavascriptFunction()");
10. What Data Type to the Range validater Control Support..?
Ans: Integer, String and Date.
11. Explain the Difference between Server-side code and client-side code..?
Ans. Server-side code executed on the server and page will be posted back. Client-side code executed in the client's browsers such as javascript functions and styles.
12. Should user input data validation occur server-side or client side..? Why..?
Ans: All user input data validation should occur on the server at a minimum. Additionally client side validation can be performed where deemed appopriate and feasable to provide a richer, more responsive experience for the user.
13. What is the difference between Server.Transfer and Responce.Redirect..? Why would I choose one over the other..?
Ans: Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is  used to redirect the user's browser to another page or site. This performs as a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.
14. What is Global.asax used for..?
Ans: The Global.asax (Including Global.asax.cs file) is used to implement application and session level events.
15. What are the application_start and session_start subroutines used for..?
Ans: This is where you can set the specific varibles for the application and session objects.
16. Describe the difference between Inline Code and Code Behind..?
Ans: Inline code written along side the html in a page. Code-Behind is code written in a separate file and referenced by the .aspx page.
17. What MSIL, and why should my developers need an appreciation of it if at all..?
Ans: MSIL is the Microsoft Intermediate Language. All .Net compatible languges will get converted to MSIL. MSIL also allows the .Net framework to JIT compile the Assemply on the installed computer.
18. Which Method do you invoke on the DataAdapter Control to Load your generated dateset with data..?
Ans: The Fill() Method.
19. Can you edit data in Repeater Control..?
Ans: No, It just reads the information from its Data source.
20. Which template you must provide, in order to display data in a repeater control..?
Ans: ItemTemplate.
21. How can you provide an alternating color scheme in a repeater control..?
Ans: Use the AlternatingItemTemplate.
22. What property must you set, and what method mustg you call in your code, in order to bind the data from a data source to the repeater control..?
Ans: You must set the DataSource Property and call DataBind Method.
23. Name two properties common in every Validation Control..?
Ans: ControlToValidate property and Text Property.
24. Which property on a ComboBox do you set with a column name, prior to setting the DataSource, to display data in the ComboBox..?
Ans: DataTextField property.
25. Which control would you use if you needed to make sure the values in two different controls matched..?
Ans: CompareValidator control.
26. How many classes can a single .Net DLL Contain..?
Ans: It can contain many classes.
27. What is Viewstate..?
Ans: ViewState allows the state of object to be stored in a hidden field on the page. Viewstate is transported to the client and back to the server, and is not stored on the server or any other external source. Viewstate is used to retain the state of server-side objects between postbacks.
28. What is the lifespan for items stored in Viewstate..?
Ans: Item stored in viewstate exist for the life of the current page. This includes postabacks (to the same page).
29. What is Boxing and UnBoxing..?
Ans: Boxing is implicit conversion of ValueTypes to Reference Types (object). UnBoxing is explicit conversion of reference types (object) to its equivalent ValueTypes. It Requires type-casting.
30. What is Assembly and Types..?
Ans: Assemblies are the building block of the .net framework and assemplies are 3 types.
Private, Public/Shared and Satellite Assamblies.
Private: Assembly used with in an applicatioin is known as private assemblies.
Public/Shared: Assembly which can be shared across application is known as shared assemblies. Strong name has to be created to create a shared assembly. This can be done using SN.EXE. The same as to be registred using GACUTIL.exe (Global Assembly Cache).
Satellite: Theese assemblies contain resoure files pertaining to a locale (Culture + Language). These assemblies are used in deploying an Global application for different languages.
31. What are User Controls and Custom Controls..?
Ans: Custom Controls: A control authored by a user or a third-party software vender that does not belong to the .Net framework class library. This is a generic term that includes user controls. A Custom Server control is used in web forms (Asp.Net pages). A Custom Client controls is used in windows forms applications.
User Controls: In Asp.Net a user authored server control that enables an Asp.Net page to be re-used as a server control. An Asp.Net user control is authored declaratively and persisted as a text file with an .ascx extension. The Asp.Net page framework compiles a user control on the fly to a class that derves from the System.Web.UI.UserControl class.
32. What are the validation controls..?
Ans: A set of server controls included with Asp.Net that test input in HTML and web server controls for programmer-defined requirements. Validation controls perform input checking in server code. If user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.
33. What are the different types of Caching..?
Ans: Caching is a technique widely used in computing used in crease performance by keeping frequently accessed or expensive data in memory. In context of web application, caching is used to retain the pages or data across HTTP requests and reuse them without the expense of recreating them. Asp.Net has 3 kinds of Caching strategles Output Caching, Fragment Caching, Data Caching.
Output Caching: Caches the dynamic output generated by a request. Some times it is useful to cache the output of a website even for a minute, which will result in a better performance. For caching the whole page the page should have OutputChache directive. <% OutputCache Duration="60" VeryByParam="State" %>.
Fragment Caching: Caches the portion of the page generated by the request. Some times it is not practical to cache the entire page, in such cases we can cache a portion of page<%@ OutputCache Duration="120" VeryByParam="CategoryID;SelectedID" %>.
DataCaching: Caches the objects programmatically. For data caching Asp.Net provides a cache object for eg: cache["States"] = dsStates;
34. What do you mean by Authentication and Authorization..?
Ans: Authentication is the process of validating a user on the credentials (username and password) and Authroziation performs after authentication. After Authentication a user will be verified for performing the various tasks, Its access is limited it is known as Authorization.
35. What event handlers can I include in Global.asax..?
Ans: Application_Start, Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Applicatiion_Error, Application_ PostRequestHandlerExecute, Application_PreRequestHandlerExecute, Session_Start, Session_End etc, etc.
36. What is differrent between web.config.xml and Machineconfig.xml..?
Ans: Web.config & Machine.config both are configuration files. Web.config contains settings specific to an application where  as machine.config contains settings to a computer. The configuration system first searches settings in machine.config file & then looks in application configuration files. Web.config, can appear in applies configuration settings to application server.
37. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines..?
Ans: The Application_Start event is guaranted to occur only once throughout the lifetime of the application. It's a good place to initialize global variables.
38. What are the Advantages and Disadvantages of viewstate..?
Ans: Advantages: Simplicity, There is no need to write possible complex code to store from data between page submissions. Flexibility, It is a possible to enable, configure, and disable viewstate on a control-by-control basis, choosing to persist the values of some fields but not others.
Disadvantages: Does not track across pages. Viewstate information does not autimatically transfer from page to page. With session approach, values can be stored in the session and accessed from another pages.
39. What Method do you use explicity kill a user a session..?
Ans: You can dump (Kill) the session yourself by calling the method Session.Abandon.
40. What is Role Based Security..?
Ans: Role based security lets you identify groups of users to allow or deny based on their role in the organization.
41. What is Web.config file..?
Ans: Web.config file is the configuration file for the Asp.Net web Application. There is one web.config file for one asp.net application which configures the particular applicatioin. Web.config file is written in XML with specific tags having specific meanings. It includes database includes connectiions, session states, error handing, security etc..
42. Difference between Asp and Asp.Net..?
Ans: (Active Server Pages) and Asp.Net are both server side technologies for building web sites and web application, Asp.Net is fully Object oriented. Asp.Net has been entirely re-architected to provide a highly productive programming experience based on the .Net framework, and a robust infrastructure for building reliable and scalable web applications.
43. What are the Validation Controls available in Asp.net..?
Ans: RequiredField, Range Validator, RegularExpression, CustomValidator,CompareValidators available.
44.What does aspnet_regiis -i do..?
Ans: Aspnet_regiis.exe is the ASP.NET IIS Registration tool allows an administrator or installation program to easily update the script maps for an Asp.Net application to to the Asp.Net ISAPI version associated with the tool. The tool can also be used to display the status of all installed versions of Asp.Net.
45. What is a PostBack..?
Ans: Process in which a web page sends data back to the same page on the server.
46. What three Session State providers are available in Asp.Net..?
Ans: Asp.Net Provides Three distinct ways to store session data for your application.
In-Process: When using the In-process Session mode, Session state data lost if aspnet_wp.exe or the application domain restarts. In-Process session state is by far the fastest solution. If you are storing only small amounts of volatle data in session state, It is recommended that you use the In-Process provider.
Out-of-Process: The state server simply stores session state in memory when in Out-of-Process mode. In this mode worker process talks directly to the state server.
Sql Mode: Session states are stored i n a Sql Server Database and the worker process talks directly to SQL.
47. What is the difference between HTTP-Post and HTTP-Get..?
Ans: Both HTTP Get and HTTP Post use HTTP as their underlying protocal. Both of theese methods encode request parameters as name/value pairs in the http request . The Get Method Creates a query string and appends it to the script's URL on the server that handles the request. The Post method creates a name/value pairs that are passed in the body of the HTTP request message.

Web service Questions
48. What is the Transport Protocal you use to call a Web Service..?
Ans: SOAP (Simple Object Access Protocal) is the preferred protocal.
49. What does WSDL Stand for..?
Ans: Web Service Description Language.
50. What are the Various ways of accessing a Web Service..?
Ans: 1) Asynchronous 2) Synchronous.
Asynchronous: Application can make a call to the webservice and then continue todo watever it wants to do. When the service is ready it will notify the asynchronous call to the webmethod. The Easiest and most powerful way to implement an asynchoronous call is using  a delegate object.
Synchronous Call:  Application has to wait until execution has completed.

C# Interview Questions
51. Does C# Support Multiple Inhertance..?
Ans: No;
52. Who is a protected class-level variable available to..?
Ans: It is available to any sub-class (a class inheriting this class).
53. Describe the accessibility modifier Protected Internal..?
Ans: It is available to classes that are within the same assembly and derived from the specified base class.
54. What's the top .Net class that everything is derived from..?
Ans: System.Object.
55. What's the difference between System.String and System.Text.StringBuilder classes..?
Ans: System.String is Immutable. System.StringBuilder was designed with the purpose of having a mutable string where a varity of operations can be performed.
56. What does the term immutable mean..?
Ans: 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.
57. What's the advantage of using System.Text.StringBuilder over System.String..?
Ans: StringBuilder is more effcient 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.
58. Can you store multiple datatypes in System.Array..?
Ans: No.
59. What's the Difference between the System.Array.CopyTo() and System.Array.Clone()..?
Ans: 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 arry.
60. How can you sort the elements of the array in descending..?
Ans: By Calling Sort() and then Reverse() Methods.
61. What is the .Net collection classes that allows an element to be accessed using a unique key..?
Ans: HashTable.
62. What class is underneath the SortedList class..?
Ans: A sorted HashTable.
63. Will the Finally block get executed if an exception has not occurred..?
Ans: Yes.
64. Can multiple catch blocks be executed for a single try statement..?
Ans:  No. Once the proper catch block processed, Control is transferred to the finally block (if there are any).
65. What is the Syntax to Inherit from a class in C#..?
Ans: Place a colon and then the name of the base class.
Ex: class MyClass : MyBaseClass.
66. What are the difference between Debug class and Trace class..?
Ans: Documents looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
67. What is Reflection..?
Ans: Asp.Net Compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection.
68. What is Globalization and localization..?
Ans: Globalization is the process of creating an application that meets the needs of users from multiple cultures. It includes using the correct currency, date and time format, calendar, writing direction, sorting rules, and other issues. Accommodating these cultural differences in an application is called localization.
69. Difference between Dispose and Finalize method..?
Ans: Finalize method is used to free the memory used by some unmanaged resouces like window handles. Its similar to the destructor syntax in c#. But in some cases we may need release the memory used by the resources explicitely. To relese the memory explicitly we need to implement the dispose method of IDisposable interface.
70. Why do you need to serialize..?
Ans: If you want to pass object from one computer/application domain to another. Process of converting complex objects into stream of bytes.
80. What is Managed Code and UnManaged Code..?
Ans: Managed Code is compiled for the .Net run-time environment. It runs in the CLR, which is the heart of the .Net framework. The CLR provides services such as security, memory, management, and cross-language integration.
Advantages of Managed Code: Includes automatic garbage collection, Memory Management, secury, type checking, versioning.
UnManaged Code: Includes all code written before the .Net framework was introduced. This includes code written to use COM, Native Win32, and visual basic 6. Because it does not run inside the .Net environment, Unmanaged code cannot make use of any .Net managed facilities.
81. What is Side-by-Side execution?
Ans: Side-by-Side execution is the ability to tun multiple versions of an application or component on the same computer. You can have multiple versions of the common language runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time.
82. How do Assemblies find each other..?
Ans: By searching directory path.
83. What is the difference between Constants, Readonly and Static..?
Ans: Constants: The value can't be changed.
Readonly: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.
84. How many classes can a single .Net DLL contain..?
Ans: Unlimited.
85. What are the Delegates? Where are they used..?
Ans: A Delegate defines a reference type that can be used to encapsulate a method with a specific signature. A delegate instance encapsulates a static or an instance method.
86. What are Class Access modifiers..?
Ans: Access Modifiers are keywords used to specify the declared accessibility of a member or a type. This section introduces the frou access modifiers.
Public: Access is not Restricted.
Protected: Accessis is limited to the containing class or types derived from the containing class.
Internal: Access is Limited to the current assembly.
Protected Internal:  Access is limited to the current assembly or types derived from the containing class.
Private: Access is limited to the containing type.
87. What is value type and reference type in .Net..?
Ans: ValueType: A variable of a vlue type always contains a value of that type. The assignment to a variable of a value type creates a copy of the assigned value, while the assignment to a variable of a reference type creates a copy of the reference but not of the referenced object.
ValueTypes Consist of two main categories.(Stuct Type, Enumeration Type)
Reference Type: variables of reference types, Reffered to as objects, store references to the actual data. This section introduces the following keywords used to declare reference types. (Class, Interface, Delegate)
88. What is Smart Navigation..?
Ans: The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
89. What are the Asp.Net Authentication Providers..?
Ans:  Asp.Net Providing 3 types of Authentication.(Windows, Form, Passport)
Windows Authentication: If you select windows authentication for your ASP.NET application, you also have to configure authentication whe IIS. This is because IIS providers windows authentication.
(Anonymous, basic digest and windows )
If you select anonymous authentication. Iss doesn't perform any authentication, any one is allowed to access the ASP.NET application.
If you select basic authentication, User must provide a windows username and password to connect. How ever this information is sent over the network in clear text, which makes basic authentication very much insecure over the internet.
If you select digest authentication, users must still provide a windows username and password to connect. However the passsword is hashed before it is sent across the network, Digest authentication requires that all users be running internet explorer 5 or later and that windows accounts to stored in active directory.
Passport Authentication: To use passport authentication you have to download the passport software development kit and install it on your server.
Forms Authentication: Form authentication provides you with a way to handle authentication using your own custom logic with in an Asp.Net application.
90. What is Strong Name..?
Ans: A strong name includes the name of the assembly, version number, culture identy, and a public key token.
100. What is Partial Class..?
Ans: Partial class can alsobe split into two or more class. We can also say that a class be phisycally separated into other parts of the class but with in the same namespace and also one more importent thing the part must use the partial keyword. And other class should also have the same access modifier. When Compile is done all the partial classes will be treated as a single class.
101. Difference Between a Website and a Web Application..?
Ans: A web site is like a foundation and can host several web application.
       A web application serves a specific function such a shopping cart or a blogging application.
       A web application can be a website and a website can be a web application.
       A web application is an interactive tool that you can use to accomplish something - an online email client is one example of a web application.
       A website is mainly used for content deliver.
102. What is Gorbage Collection..?
Ans: The Gorbage collector is responsble for cleaning up the unused objects in the run time environment. Objects are genrally created in Managed Heap. Here the term managed Implies that it is cleaned implicitly by the Gorbage Collector.

.Net Framework Questions
103. What is .Net Framework..?
Ans: The Microsoft .Net framework is platform for Building, deploying and running web services and application. It provides a highly productive. Standard Based, Multi language environement for Integrating Exising investment with next generation of application.  The .Net framework Consists of 3 Main parts.. 1) The  Common Language Runtime (CLR), 2)  a hierarchical set of unified class libraries. 3) Componized version of Active Server Pages called Asp.Net.
104. What is CLR..?
Ans: The CLR is the excution engine for .net framework applications. It provides a number of services including the following.
  Code Management (loading and execution)
  Application Memory Isolation.
  Verification of Type safty.
  Conversion of IL to Native code.
  Access to Meta data (enhanced type information)
  Managing Memory Mangement for Objects.
  Exception Handing including cross language executions.
  Support for developper services. (profiling debuging and so on..).
105. What is Common Type System (CTS)..?
Ans: The Common Type System is a rich type system. Build into the CLR that supports the type and oprations found in most programming languages. The CTS supports the complet implementation of a wide range of programming languages.
106. What is Common Language Specification (CLS)..?
Ans: The CLS is a set of Construsts and Constrains that serves as a guide for library writer and compiler writers. The CLS is a subset of the CTS.
107. What is HTTP Handlers..?
Ans: An Http handler can be either synchronous or asynochronous. A synochronous handler does not return until it finishes processing http request for which it is called. An asynchoronous handler usally launches a process that can be lengthy and returns before the process finishes. After writing and compiling the code to implement an http handler, you must register the handler using your application web.config file.

Oops Related Questions
108. What is Sealed Class..?
Ans: It can be applied on a class and methods. A sealed class cannot be inherited. A sealed class cannot be a abstract class. A compile time error is thrown if you try to specify sealed class as a base class.
109. What is Encapsulation..?
Ans: Encapsulation is the ability to hide the  internal workings of an object's behavior and its. data.
110. What does the Keyword VIRTUAL declare for a method or property..?
Ans: The method or property can be overriden.
111. How is method Overriding different from method Overloading..?
Ans: When Overrideing a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name whthin the class.
112. Can you declare an override method to be static if the original method is not static..?
Ans: No, The signature of the virtual method must remain the same. ( Note: Only the keyword virtual is changed to keyword override).
113. What are the different methods can be Overloaded..?
Ans: Different Parameter data types, different number of parameters, different order of parameters.
114. What is Abstract Class..?
Ans: An Abstract class is a parent class that allows Inheritience but can never be Instantiated. Abstract Classes cantain one or more abstract methods that do not have implementation. Abstract classes allow specifilation of Inherited classes.
115. What is Interface..?
Ans: Interfaces, Like classes define a set of properties, Methods, and events.. But unlike classes, Interfaces do not provide Implementation. They are implemented by class, and define as a separate Entities from classes.
116. Difference between Interface and Abstract classes..?
Ans: Interfaces has know implementation, but they have to be implemented by class.
        Abstract class's methods can have implementations and they have to be extended.
        Abstract classes methods can not have implementations only when declared abstract.
        Interface can Inherited more then one interfaces.
        Abstract class can implement more then one interfaces, but can Inherit only one class.
        Abstract class must override all abstract method.
        Interface increase security by hiding the implementation.
117. When you have to create Interface or Abstrct..?
Ans: Use an abstract class when you want to Inherit only from the parent.
        Use an Interface when you want to Inherit from multiple sources.
118. What is Polymorphism..?
Ans: Polymorphism means same operations may behave differently on different classes and its two types
(Compile Time, Runtime).