Tuesday, April 9, 2013

ASP.NET Interview Questions and Answers

=>
What is ASP.NET?

ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
ASP.NET provides increased performance by running compiled code.
=>
What is Difference between Namespace and Assembly?

Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.

=>
What is the difference between early binding and late binding?

Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

=>
What is the difference between Server.Transfer and response.Redirect?

The Server.Transfer () method stops the current page from executing, and runs the content on the specified page, when the execution is complete the control is passed back to the calling page.
While the Response.Redirect () method transfers the control on the specified page and the control is never passed back to calling page after execution.



=>
What is a PostBack?

The process in which a Web page sends data back to the same page on the server.

=>
What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page
=>
What is the differences between Server-side and Client-side code?

§  Server-side code executes on the server.
§  Client-side code executes in the client’s browser.
=>
What is the difference between static or dynamic assemblies?

Assemblies can be static or dynamic.

Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files.

Dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.
=>
What are the difference between Structure and Class?

§  Structures are value type and Classes are reference type
§  Structures can not have constructor or destructors.
§  Classes can have both constructor and destructors.
§  Structures do not support Inheritance, while Classes support Inheritance.
=>
What is the differences between dataset.clone and dataset.copy?

Dataset.clone copies just the structure of dataset (including all the datatables, schemas,     relations and constraints.); however it doesn’t copy the data.
Dataset.copy, copies both the dataset structure and the data.
=>
What is the difference between Custom Control and User Control?

Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application. 
User Controls
 are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files.

=>
What is the difference between ASP Session State and ASP.Net Session State?

ASP session state relies on cookies, Serialize all requests from a client, does not survive process shutdown, Can not maintained across machines in a Web farm.

=>
What is ViewState?

ViewState is a .Net mechanism to store the posted data among post backs. ViewState allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.

=>
What is Authentication and Authorization?

Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication.
Authorization
 is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

=>
What are the types of Authentication?

There are 3 types of Authentication. Windows, Forms and Passport Authentication.
§  Windows authentication uses the security features integrated into the Windows NT and Windows XP operating systems to authenticate and authorize Web application users.
§  Forms authentication allows you to create your own list/database of users and validate the identity of those users when they visit your Web site.
§  Passport authentication uses the Microsoft centralized authentication provider to identify users. Passport provides a way to for users to use a single identity across multiple Web applications. To use Passport authentication in your Web application, you must install the Passport SDK.
=>
What is datagrid?

The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.

=>
How do you hide the columns?

One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s “Visible” property.

=>
Which method do you use to redirect the user to another page without performing a round trip to the client?

§ 
           Server.Transfer
Server.Execute.

=>
What data type does the RangeValidator control support?

§  Integer
§  String.
§  Date.

=>
What is cookies?

Cookies are small pieces of text, stored on the client’s computer to be used only by the website setting the cookies. This allows webapplications to save information for the user, and then re-use it on each page if needed
=>
Which method do you use to redirect the user to another page without performing a round trip to the client?

Server.transfer

=>
What tag do you use to add a hyperlink column to the DataGrid?

< asp:HyperLinkColumn > < / asp:HyperLinkColumn >

=>
How do you validate the controls in an ASP .NET page?

Using special validation controls that are meant for this. We have Range Validator, Email Validator
=>
What is boxing and unboxing?

Implicit conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion. 
Conversion of reference type variable back to value type is called as UnBoxing.

=>
What is garbage collection?

Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy.

=>
What is serialization?

Serialization is the process of converting an object into a stream of bytes.
Deserialization is the opposite process of creating an object from a stream of bytes. Serialization / Deserialization is mostly used to transport objects.
=>
What is difference between constants, readonly and, static?
         
§  Constants: The value can’t be changed.
§  Read-only: The value will be initialized only once from the constructor of the class.
§  Static: Value can be initialized once.
=>
What is Intermediate Language?

MSIL are also known as Microsoft Intermediate Language is the CPU-independent instruction set into which .Net framework programs are compiled. It contains instructions for loading, storing initializing, and calling methods on objects.

=>
What is CTS?

The Common type system is a rich type system, built into the common language runtime, which supports the types and operations found in most programming languages.
=>
Can we disable ViewState, If, yes how?

ViewState can be disabled by using "EnableViewState" property set to false.

=>
Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?

All the global declarations or the variables used commonly across the application can be deployed under Application_Start. All the user specific tasks or declarations can be dealt in the Session_Start subroutine.
=>
What’s the use of “GLOBAL.ASAX” file?

It allows to executing ASP.NET application level events and setting application-level variables.

=>
What is a SESSION and APPLICATION object?

Session object store information between HTTP requests for a particular user. 
Session variables are used to store user specific information where as in application variables we can’t store user specific information.
while application object are global across users.
=>
How is method overriding different from overloading?

When Overriding, you change the method behavior for a derived class.
Overloading
 simply involves having a method with the same name within the class.

=>
What is the difference between System.String and System.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.

=>
What is the differences between Server-side and Clientside code?

§  Server side code is executed at the server side on IIS in ASP.NET framework.
§  while client side code is executed on the browser.

=>
What’s an interface?

It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
=>
What is a DataSet?

A DataSet is an in memory representation of data loaded from any data source.

=>
What is a DataTable?

A DataTable is a class in .NET Framework and in simple words a DataTable object represents a table from a database.

=>
What is a life span of a static variable?

A static variable’s life span is till the class is in memory

=>
What is the difference between an abstract method & virtual method?

An Abstract method does not provide an implementation and forces overriding to the deriving class (unless the deriving class also an abstract class), 
Virtual
 method has an implementation and leaves an option to override it in the deriving class. Thus Virtual method has an implementation & provides the derived class with the option of overriding it. Abstract method does not provide an implementation & forces the derived class to override the method.
=>
What is AutoPostback?

AutoPostBack automatically posts the page back to the server when state of the control is changed.

=>
What is Globalization?

Globalization is the process of creating multilingual application by defining culture specific features like currency, date and time format, calendar and other issues.

=>
What is the main difference between Asp.net and Vb.net?

§  Asp.net is a web technology used for designing webforms and Vb.net is a programming language
§  ASP.NET is a powerful technology for writing dynamic web pages.
§  ASP.NET is a way of creating dynamic web pages while making use of the innovations present in .NET.
§  VB.NET is a language.But ASP.NET is the Environment where we can create websites or webpages.

=>
Is string a value type or a reference type?

Srting is a Reference type.It can create a new instance at every time.

=>
What base class do all Web Forms inherit from?

System.web.UI.Page class

=>
What is the difference between “Web.config” and “Machine.Config”?

§  “Web.config” files apply settings to each web application.
§  While “Machine.config” file apply settings to all ASP.NET applications.
=>
What are the various security methods which IIS Provides apart from .NET?

The various security methods which IIS provides are :
§  Authentication Modes.
§  IP Address and Domain Name Restriction.
§  DNS Lookups DNS Lookups.
§  Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
§  The Network ID and Subnet Mask.
§  SSL.

=>
What are Master Pages in ASP.NET?

ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages in your application. You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.

=>
What is a web server?

A web server delivers requested web pages to users who enter the URL in a web browser. Every computer on the Internet that contains a web site must have a web server program.

=>
What are Cascading style sheets?

Cascading style sheets (CSS) collect and organize all of the formatting information applied to HTML elements on a Web form. Because they keep this information in a single location, style sheets make it easy to adjust the appearance of Web applications.

=>
What is the base class of .net?

System.object

=>
What is difference between abstract classes and interfaces?

Abstract classes can have concrete methods while interfaces have no methods implemented.
Interfaces
 do not come in inheriting chain, while abstract classes come in inheritance.

=>
What is GAC or Global Assembly Cache?

Global Assembly Cache (GAC) is a common place to share the .NET assemblies across many applications. GAC caches all strong named assembly references within it. All System assemblies that come with the .NET framework reside in the GAC.

=>
What is a HashTable?

The Hashtable object contains items in key/value pairs. The keys are used as indexes, and very quick searches can be made for values by searching through their keys.

=>
What is CAS or Code Access Security?

Code Access Security - CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running.

=>
What is the Composite Custom Control?

Combination of existing HTML and Server Controls.

=>
What base class do all Web Forms inherit from?

System.web.UI.Page class

=>
What is 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.
=>
What are the different types of Validation Controls?

There are six types of validation controls available :
§  RequiredFieldValidator
§  RangeValidator
§  RegularExpressionValidator
§  CompareValidator
§  CustomValidator
§  ValidationSummary

=>
What is the Web User Control?

Combines existing Server and/or HTML controls by using VS.Net to create functional units that encapsulate some aspects of UI. Resides in Content Files, which must be included in project in which the controls are used.

=>
What namespaces are necessary to create a localized application?

§  System.Globalization
§  System.Resources

=>
How to Manage State in ASP.Net?

There are several ways to manage a state.
§  ViewState
§  QueryString
§  Cookies
§  Session
§  Application

=>
What are the different types of Caching?

There are three types of Caching :
§  Output Caching: stores the responses from an asp.net page.
§  Fragment Caching: Only caches/stores the portion of page (User Control)
§  Data Caching: is Programmatic way to Cache objects for performance.
=>
What is Delegates?

Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it. Delegates are generally used as basis of events, which allow any delegate to easily be registered for as event.
=>
What is the difference between Value Types and Reference Types?

Value Types uses Stack to store the data. 
where as Reference type uses the Heap to store the data.

=>
What is the difference between HTTP-Post and HTTP-Get?

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.

=>
What’s the difference between Response.Write () and Response.Output.Write()?

Response.Outout.Write allows us to write the formatted out put.

=>
What is the difference between inline and code behind?

Inline code written along with the html and design blocks in an .aspx page. 
Code-behind is code written in a separate file (.cs or .vb) and referenced by the .aspx page.

=>
What is the top .NET class that everything is derived from?

System.Object

=>
What is Marshalling?

Marshaling is a process of making an object in one process (the server) available to another process (the client). There are two ways to achieve the marshalling.
§  Marshal by value
§  Marshal by reference.

=>
What is a Static class?

Static class is a class which can be used or accessed without creating an instance of the class.

=>
What is sealed class

§  Sealed classes are those classes which can not be inherited and thus any sealed class member can not be derived in any other class.
§  A sealed class cannot also be an abstract class.

=>
What are the components of web form in ASP.NET?

§  Server controls
§  HTML controls
§  Data controls
§  System components.

=>
What is the top .NET class that everything is derived from?

System.Object

=>
What is Marshalling?

Marshaling is a process of making an object in one process (the server) available to another process (the client). There are two ways to achieve the marshalling.
§  Marshal by value
§  Marshal by reference.

=>
What is a Static class?

Static class is a class which can be used or accessed without creating an instance of the class.

=>
What is sealed class

§  Sealed classes are those classes which can not be inherited and thus any sealed class member can not be derived in any other class.
§  A sealed class cannot also be an abstract class.

=>
What are the components of web form in ASP.NET?

§  Server controls
§  HTML controls
§  Data controls
§  System components.

=>
What is the base class of Asp.net?

system.Web.UI

=>
what is use of web.config?

§  Web.config is used connect database from front end to back end.
§  Web.config is used to maintain the Appsettimgs instead of static variables.

=>
What is RangeValidator?

RangeValidator - checks whether a value falls within a given range of number, date or string.



No comments:

Post a Comment