Wednesday, 25 January 2012

ASP.net Interview Questions And Answers

Ques: 41 Explain Web Services?

Ans:Web services are programmable business logic components that provide access to
 functionality through the Internet. Web services are given the .asmx extension.
Standard protocols like HTTP can be used to access them. Web services are based on 
the Simple Object Access Protocol (SOAP), which is an application of XML.In .Net 
FrameWork Web services convert your application in to Web Application.which 
published their functionality to whole world on internet.Web Services like a 
software system  that designed to support interoperable machine-to-machine 
interaction over a Internet. 

Ques: 42 What is Postback in Asp.net?

Ans:When Frist time reqest to the server PostBack is False.When request or an action
 occurs (like button click), the page containing all the controls within the 
<FORM... > tag performs an HTTP POST, while having itself as the target URL.
 This is called Postback.We can say its a mechanism to allow the communication
 between client side and server side.
Ques: 43 Explain the differences between server-side and client-side code in Asp.Net?
Ans:In Asp.Net Environment Server side code or scripting means the script wil
l executed by server as interpreted needed.Server side scripting done the bussines
 logic like transaction and fetching data to Sever.
     Client side scripting means that the script will be executed immediately in 
the browser such as form field validation, clock, email validation, etc. Client 
side scripting is usually done in VBScript or JavaScript. Since the code is 
included in the HTML page, anyone can see the code by viewing the page source. 

Ques: 44 What is the ASP.NET validation controls?
Ans:Validation controls applied on client side scripting.List of Validations:
1. RequiredFieldValidator:Makes a input control to required field.
2. RangeValidator:Chek the values falls between to values.
3. CompareValidator:Compares the value of one input control to the value of 
      another input control or to a fixed value.
4. RegularExpressionValidator:Input value matches a specific pattern.
5. CustomValidator:Write a Method to validat input.
6. ValidationSummary:Displays a report of all validation errors occurred in a Web
  page.
Ques: 45 Describe Paging in ASP.NET?
Ans:"In computer operating systems there are various ways in which the operating
  system can store and retrieve data from secondary storage for use in main memory". One such memory 
management scheme is referred to as paging.In ASP.Net the DataGrid control in 
ASP.NET enables easy 
paging of the data. The AllowPaging property of the DataGrid can be set to True to
 perform paging. 
ASP.NET automatically performs paging and provides the hyperlinks to the other 
pages in different styles,
 based on the property that has been set for PagerStyle.Mode.

Ques: 46 What is the difference between Server.Transfer and Response.Redirect?
Ans:Response.Redirect:This tells the browser that the requested page can be found at a 
new location. The browser then initiates another request to the new page loading 
its contents in the browser. 
Server.Transfer: It transfers execution from the first page to the second page on
 the server. As far as the browser client is concerned, it made one request and
the initial page is the one responding with content. The benefit of this approach 
is one less round trip to the server from the client browser.
 
Ques: 47 What is Data Binding?

 
 
Ans:Data Binding is binding controls to data from databases.Using Data binding a 
control to a particular column in a table from the database or we can bind the
 whole table to the data grid.
      In other words Data binding is a way used to connect values from a
 collection of data (e.g. DataSet) to the controls on a web form. The values 
 
from the dataset are automatically  displayed in the controls without having
 to write separate code to display them.
 
Ques: 48 Do Web controls support Cascading Style Sheets?

Ans:All Web controls inherit a property named CssClass from the base class
 "System.Web.UI. WebControls. WebControl" which can be used to control the
 properties of the web control.

Ques: 49 What classes are needed to send e-mail from an ASP.NET application?

Ans:Following Classes use to sent email from ASP.Net application:
1.MailMessage
2.SmtpMail  
Both are classes defined in the .NET Framework Class Library's 
"System. Web. Mail" namespace.
  
Ques: 50 What is ViewState?

Ans:State of the object to be stored in hidden field on the page.ViewState is not 
stored on the server or any other external source. ViewState transported to the 
client and back to the server. ViewState is used the retain the state of
 server-side objects between postabacks.Viewstate should be the first choice to
 save data to access across postbacks.

Ques: 51 Define ASP.Net page life cycle in brief ?
Ans:1. OnInit (Init): Initializes each child control.
2. LoadControlState: Loaded the ControlState of the control. To use this method
  the control must call the Page.RegisterRequiresControlState method in the
   OnInit method of the control.
3. LoadViewState: Loaded the ViewState of the control.
 retrieve the incoming form data and update the control According to there 
      properties.
5. Load (OnLoad): Allows actions that are common to every request to be placed 
here. control is stable at this time, it has been initialized and its state has 
been reconstructed.
6. RaisePostDataChangedEvent: Is defined on the interface IPostBackData-Handler.
7. RaisePostbackEvent: Handling the clien side event caused Postback to occur
8. PreRender (OnPreRender): Allows last-minute changes to the control. This event
 takes place before saving ViewState so any changes made here are saved.
9. SaveControlState: Saves the current control state to ViewState. 
10. SaveViewState: Saves the current data state of the control to ViewState.
11. Render: Generates the client-side HTML Dynamic Hypertext Markup Language 
(DHTML) and script that are necessary to properly display this control at the
 browser. In this stage any changes to the control are not persisted into
ViewState.
12. Dispose: Accepts cleanup code. Releases any unman-aged resources in this
 stage. Unmanaged resources are resources that are not handled by the .NET common 
language runtime such as file handles and database connections.
13. UnLoad
Ques: 52 What do you mean by three-tier architecture?
Ans:The three-tier architecture was improve management of code and contents and to
 improve the performance of the web based applications. There are mainly three 
layers in three-tier architecture.This architecture remove the many drawbacks of 
previous Cliet-Server architecture.
There are three stages in this Architecture;
(1)Presentation Layer: PL(Presentation Layer) Contains only client side scripting
like HTML, javascript and VB script etc.The input Validation validate on Cliet 
side.
(2)Business Logic Layer:BL(Business Logic Layer) contain the server side code for
 data transaction, query and communicate through Data Base,and Pass the data to 
the user interface.
(3)Database layer:Data Layer represents the data store like MS Access, SQL Server,
 an XML file, an Excel file or even a text file containing data also some 
additional database are also added to that layers.

Ques: 53 Write the code that creates a cookie containing the user name R4R and the current date to the user computer. Set the cookie to remain on the user computer for 30 days?
Ans:Code:
HttpCookie cookUserInfo = new HttpCookie("UserInfo");
CookUserInfo["Name"] = "R4R";
CookUserInfo["Time"] = DateTime.Now.ToString();
cookUserInfo.Expires = DateTime.Now.AddDays(30);
Response.Cookies.Add(cookUserInfo);

Description:
"HttpCookie" :The HttpCookie class is under System.Web namespace.
"CookUserInfo" :is the object of class HttpCookie
"Expires": is the property that sets the duration,when cookie expire.
 
Ques: 54 Describe the property of cookie in Asp.Net ?
Ans:Properties:
1. Domain: The domain associated with the cookie for example, aspx.superexpert.com
2. Expires: The expiration date for a persistent cookie.
3. HasKeys: A Boolean value that indicates whether the cookie is a cookie 
    dictionary.
4. Name: The name of the cookie.
5. Path: The path associated with the Cookie. The default value is /.
6. Secure: A value that indicates whether the cookie should be sent over an 
   encrypted connection only. The default value is False.
7. Value: The value of the Cookie.
8. Values: A NameValueCollection that represents all the key and value pairs 
   stored in a Cookie dictionary.

 
Ques: 55 Differences between Web and Windows applications? 
Ans:Web Forms:Web forms use server controls, HTML controls, user controls, or custom
 controls created specially for Web forms.Web applications are displayed in a
 browser.Web forms are instantiated on the server, sent to the browser, and 
destroyed immediately.
Windows Forms:Windows forms are instantiated, exist for as long as needed, 
and are destroyed. Windows applications run on the same machine they are displayed
 on.Windows applications display their own windows and have more control over 
how those windows are displayed.
 
Ques: 56 What is the main difference between the Button server control and the Button HTML control? 
Ans:The Button HTML control triggers the event procedure indicated in the button’s 
onclick attribute, which runs on the client.
When clicked, the Button server control triggers an ASP.NET Click event procedure
 
 on the server.
 
Ques: 57 What is the difference between web.config and Machine.config files?
Ans:1. Usually on a webserver there is only one Machine.config file whereas in a web
 application there is no of files,but in the root directory.
2. Web.config file settings will override machine.config settings.
3. Machine.config file specifies configuration settings for all of the websites 
on the web server.Web.config file specify configuration settings for a particular 
web application, and is located in the applications root directory .
 
Ques: 58 How do you require authentication using the Web.config file? 
Ans:Include the following &ltauthorization> element to require authentication:

<authorization>
  <deny users="?" />
</authorization>
 
Ques: 59 How to create Multivalued Cookie ?
Ans:<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    void btnSubmit_Click(Object s, EventArgs e)
    {
        Response.Cookies["preferences"]["firstName"] = txtFirstName.Text;
        Response.Cookies["preferences"]["lastName"] = txtLastName.Text;
        Response.Cookies["preferences"]["favoriteColor"] = txtFavoriteColor.Text;
        Response.Cookies["preferences"].Expires = DateTime.MaxValue;
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Set Cookie Values</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <asp:Label
        id="lblFirstName"
        Text="First Name:"
        AssociatedControlID="txtFirstName"
        Runat="server" />
    <br />
    <asp:TextBox
        id="txtFirstName"
        Runat="server" />
    <br /><br />
    <asp:Label
        id="lblLastName"
        Text="Last Name:"
        AssociatedControlID="txtFirstName"
        Runat="server" />
    <br />
    <asp:TextBox
        id="txtLastName"
        Runat="server" />
    <br /><br />
    <asp:Label
        id="lblFavoriteColor"
        Text="Favorite Color:"
        AssociatedControlID="txtFavoriteColor"
        Runat="server" />
    <br />
    <asp:TextBox
        id="txtFavoriteColor"
        Runat="server" />
    <br /><br />
    <asp:Button
        id="btnSubmit"
        Text="Submit"
        OnClick="btnSubmit_Click"
        Runat="server" />


    </div>
    </form>
</body>
</html>
 
Ques: 60 Define Error Events in Asp.Net?
Ans:In ASP.Net when any unhandled exception accurs in application then an event oc
cures,that event called Error event.Two types of Event:
1. Page_Error:When exception occures in a page then this event raised.
2. Application_error:Application_Error event raised when unhandled exceptions 
in the ASP.NET application and is implemented in global.asax.

The error event have two method:
1. GetLastError: Returns the last exception that occurred on the server.
2. ClearError: This method clear error and thus stop the error to trigger 
subsequent error event.


Ques: 61 Why the exception handling is important for an application?
 
 
 
      
      
      
   
 
Ans:Exception handling prevents the unusual error in the asp.net application,when apllication executed.If the exceptions are handled properly, the application will never get terminated abruptly.
  
Ques: 62 Explain the aim of using EnableViewState property?  

Ans:When the page is posted back to the server, the server control is recreated with the state stored in viewstate.It allows the page to save the users input on a form across postbacks. It saves all the server side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser.  


Ques: 63 What are the two levels of variable supported by Asp.net?

Ans:1. Page level variable:String ,int ,float. 2. Object level variable:Session level, Application level. 
 
Ques: 64 Difference between Session object and Profile object in ASP.NET? 

 Ans:Profile object: 1. Profile object is persistent. 2. Its uses the provider model to store information. 3. Strongly typed 4. Anonymous users used mostly. Session object: 1. Session object is non-persistant. 2. Session object uses the In Proc, Out Of Process or SQL Server Mode to store information. 3. Not strongly typed. 4. Only allowed for authenticated users. 
 
Ques: 65 What is the Default Expiration Period For Session and Cookies,and maximum size of viewstate? Ans:The default Expiration Period for Session is 20 minutes. The default Expiration Period for Cookie is 30 minutes. The maximum size of the viewstate is 25% of the page size  

Ques: 66 What is the use of Global.asax File in ASP.NET Application ? Ans:The Global.asax file, can be stored in root directory and accesible for web-sites,is an optional file.This Global.asax file contained in HttpApplicationClass.we can declare global variables like variables used in master pages because these variables can be used for different pages right.Importent feature is that its provides more security in comparision to other. It handle two event: 1.Application-level 2.Session-level events. Global.asax File itself configured but it can not be accessed.while one request is in processing it is impossible to send another request, we can not get response for other request and even we can not start a new session. while adding this Global.asax file to our application by default it contains five methods, Those methods are: 1.Application_Start. 2.Application_End. 3.Session_Start. 4.Session_End. 5.Application_Error.  

Ques: 67 What is the Purpose of System.Collections.Generic ? Ans:For more safty and better performance strongly typed collections are useful for the user. System.Collections.Generic having interfaces and classes which define strongly typed generic collections.  

Ques: 68 What is GAC and name of the utility used to add an assembly into the GAC ? Ans:GAC(Global Assembly Cache) for an effective sharing of assemblies.GAC refers to the machine-wide code cache in any of the computers that have been installed with common language runtime.Global Assembly Cache in .NET Framework acts as the central place for private registering assemblies. "gacutil.exe" utility used to add assembly in GAC  

Ques: 69 Whether we can use vbscript and javascript combination for validation? Ans:WE cant use them togather,since compiler are different.  

Ques: 70 What are the different states in ASP.NET? Ans:There are three types of state: 1. View state: Under the client-side state managment.The ViewState property provides a dictionary object for retaining values between multiple requests for the same page. When an ASP.NET page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field. 2. Application state:Under the server side state managment. ASP.NET allows you to save values using application state, a global storage mechanism that is accessible from all pages in the Web application. Application state is stored in the Application key/value dictionary. 3. Session state:Under server side state managment . ASP.NET allows you to save values using session state, a storage mechanism that is accessible from all pages requested by a single Web browser session. 
 
Ques: 71 Define State managment? Ans:This is passible to at a time many request occures.State management is the process by which maintained state and page information over multiple requests for the same or different pages. Two types of State Managment: 1. Client side state managment:This stores information on the client's computer by embedding the information into a Web page,uniform resource locator(url), or a cookie. 2. Server side state managment: There are two state Application State,Session State.

  Ques: 72 What is Authentication and Authorization ? Ans:An authentication system is how you identify yourself to the computer. The goal behind an authentication system is to verify that the user is actually who they say they are. Once the system knows who the user is through authentication, authorization is how the system decides what the user can do.  


Ques: 73 Discribe Client – Side State Management? Ans:Client side state managment have: a. Stores information on the client's computer by embedding the information into a Web page. b. A uniform resource locator(url). c. Cookie. To store the state information at the client end terms are: 1. View State:It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page.Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. 2. Control State:When user create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state. 3. Hidden fields:Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed. 4. Cookies: Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site. 5. Query Strings: Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.  

Ques: 74 Describe Server – Side State Management ?

Ans:Sever side state managment provied Better security,Reduced bandwidth. 1. Application State: This State information is available to all pages, regardless of which user requests a page. 2. Session State – Session State information is available to all pages opened by a user during a single visit.

Ques: 75 What is SessionID?

Ans:To identify the request from the browser used sessionID. SessionId value stored in a cookie. Configure the application to store SessionId in the URL for a "cookieless" session.  

Ques: 76 What is the Session Identifier?

Ans:Session Identifier is : 1. To identify session. 2. It has SessionID property. 3. When a page is requested, browser sends a cookie with a session identifier. 4. Session identifier is used by the web server to determine if it belongs to an existing session or not. If not, then Session ID is generated by the web server and sent along with the response.  
Ques: 77 Advantages of using Session State?  

Ans:Advantages: 1. It is easy to implement. 2. Ensures platform scalability,works in the multi-process configuration. 3. Ensures data durability, since session state retains data even if ASP.NET work process restarts as data in Session State is stored in other process space.

Ques: 78 Disadvantages of using Session State ?

Ans:Disadvatages: 1. It is not advisable to use session state when working with large sum of data.Because Data in session state is stored in server memory. 2. Too many variables in the memory effect performance. Because session state variable stays in memory until you destroy it.
 
Ques: 79 What are the Session State Modes? Define each Session State mode supported by ASP.NET.  

Ans:ASP.NET supports three Session State modes. 1. InProc:This mode stores the session data in the ASP.NET worker process and fastest among all of the storage modes.Its Also effects performance if the amount of data to be stored is large. 2. State Server:This mode maintained on a different system and session state is serialized and stored in memory in a separate process. State Server mode is serialization and de-serialization of objects. State Server mode is slower than InProc mode as this stores data in an external process. 3. SQL Server:This mode can be used in the web farms and reliable and secures storage of a session state.In this storage mode, the Session data is serialized and stored in a database table in the SQL Server database.
 
Ques: 80 What is a Master Page in Asp.Net? 

 Ans:For consistent layout for the pages in application used Master Pages.A single master page defines the look and feel and standard behavior that you want for all of the pages (or a group of pages) in your application.Then user create individual content pages that share all the information and lay out of a Master Page.




Ques: 81 What are the 2 important parts of a master page and file extension for a Master Page?
Ans:The following are the 2 important parts of a master page
1. The Master Page itself
2. One or more Content Pages
The file extention for Master Page is ".master".
Ques: 82 How do you identify a Master Page and how do you bind a Content Page to a Master Page?
Ans:The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages.
MasterPageFile attribute of a content page's @ Page directive is used to bind a Content Page to a Master Page.
Ques: 83 Can you dynaimically assign a Master Page?
Ans:PreInit stage using the Page class MasterPageFile property as shown in the code sample below. Using this you can assign a master page dynamically.

void Page_PreInit(Object sender, EventArgs e)
{
this.MasterPageFile = "~/MasterPage.master";
}
Ans:   void Page_PreInit(Object sender, EventArgs e) {
    
        if (Request.Browser.IsBrowser("IE")) {
           this.MasterPageFile = "ArticleMaster_IE.master";
        }
        else if (Request.Browser.IsBrowser("Mozilla")) {
           this.MasterPageFile = "ArticleMaster_FireFox.master";
        }
        else {
           this.MasterPageFile = "ArticleMaster.master";
        }
    }

Ques: 84 From the content page code how can you reference a control on the master page?
Ans:Use the FindControl() method as shown in the code sample below.
void Page_Load()
{
// Gets a reference to a TextBox control inside
// a ContentPlaceHolder
ContentPlaceHolder ContPlaceHldr = (ContentPlaceHolder)Master.FindControl ("ContentPlaceHolder1");
if(ContPlaceHldr != null)
{
TextBox TxtBox = (TextBox)ContPlaceHldr.FindControl("TextBox1");
if(TxtBox != null)
{
TxtBox.Text = "WHERE R4R";
}
}
// Gets a reference to a Label control that not in
// a ContentPlaceHolder
Label Lbl = (Label)Master.FindControl("Label1");
if(Lbl != null)
{
Lbl.Text = "R4R HERE";
}
}
Ques: 85 What is Globalization? 
Ans:Globalization is the process of creating an application that meets the needs of users from multiple cultures.
This process involves translating the user interface elements of an application into multiple languages, using the correct currency, date and time format, calendar, writing direction, sorting rules, and other issues. 
Ques: 86 What are the 3 different ways to globalize web applications?
Ans:Detect and redirect approach : In this approach we create a separate Web application for each supported culture, and then detect the user’s culture and redirect the request to the appropriate application. This approach is best for applications with lots of text content that requires translation and few executable components.

Run-time adjustment approach : In this approach we create a single Web application that detects the user’s culture and adjusts output at run time using format specifiers and other tools. This approach is best for simple applications that present limited amounts of content.

Satellite assemblies approach : In this approach we create a single Web application that stores culture-dependent strings in resource files that are compiled into satellite assemblies. At run time, detect the user’s culture and load strings from the appropriate assembly. This approach is best for applications that generate content at run time or that have large executable components.
Ques: 87 What are the steps to follow to get user's culture at run time?
Ans:1. Get the Request object’s UserLanguages property.
2. Use the returned value with the CultureInfo class to create an object representing the user’s current culture.

For example, the following code gets the user’s culture and displays the English name and the abbreviated name of the culture in a label the first time the page is displayed:

private void Page_Load(object sender, System.EventArgs e)
{
// Run the first time the page is displayed
if (!IsPostBack)
{
// Get the user's preferred language.
string sLang = Request.UserLanguages[0];
// Create a CultureInfo object from it.
CultureInfo CurrentCulture = new CultureInfo(sLang);
lblCulture.Text = CurrentCulture.EnglishName + ": " +
CurrentCulture.Name;
}
}
Ques: 88 What do you mean by neutral cultures?
Ans:Neutral cultures represent general languages, such as English or Spanish and a specific language and region.ASP.NET assigns that culture to all the threads running for that Web application.When user set culture attribute for a Web application in Web.config.ASP.NET maintains multiple threads for a Web application within the aspnet_wp.exe worker process. 
Ques: 89 What is the advantage of using Windows authentication in a Web application?
Ans:The advantage of Windows authentication:
1. Web application can use the exact same security that applies to your corporate network like user names, passwords, and permissions.
2. To access the Web application users logged on to the network. It is importent that user does'nt logged on again.
Ques: 90 What is the default authentication method when you create a new Web application project? 
Ans:Windows authentication is the default authentication method when you create a new Web application project.
Ques: 91 How do you get a User Identity?
Ans:Using the User object’s Identity property. The Identity property returns an object that includes the user name and role information, as shown in the following code:

private void Page_Load(object sender, System.EventArgs e)
{
Label1.Text = User.Identity.IsAuthenticated.ToString();
Label2.Text = User.Identity.Name;
Label3.Text = User.Identity.AuthenticationType;
}
Ques: 92 How do you determine, what is the role of the current user? 
Ans:The User object provides an IsInRole method to determine the role of the current user, as shown in the following example:
if(User.IsInRole("Administrators"))
{
///////
}
Ques: 93 Can you specify authorization settings both in Web.config and in IIS? 
Ans:Yes,It wil be done. For this, the IIS setting is evaluated first and then the setting in Web.config is evaluated. Hence we can say,the most restrictive setting will be used.
Ques: 94 What are the 2 Layouts supported by a Web form in ASP.NET?
Ans:1. Grid layout:  Pages using grid layout will not always display correctly in non-Microsoft browsers,and controls are placed exactly where they draw.It means they have absolute positions on the page. Use grid layout for Microsoft Windows–style applications, in which controls are not mixed with large amounts of text.
2. Flow layout: Controls relative to other elements on the page.
Controls that appear after the new element move down if you add elements at run time.
Flow layout for document-style applications, in which text and controls are intermingled.
Ques: 95 What is the difference between Literal and Lable Control?
Ans:We use literals control if we want to typed text using HTML formating and without using property.We typed HTML code in .cs file when used literals.
Lable control when displayed already formated.Typed text can not be formated in .cs file.
Ques: 96 What is smart navigation?
Ans:Smart navigation is, cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
Ques: 97 Explain the difference between a database administrator and a data administrator.
Ques: 98 What is the difference between Server.Transfer and Response.Redirect? 
Ans:1. Server.Transfer() performs server side redirection of the page avoiding extra round trip. While The Response .Redirect () method can be used to redirect the browser to specified url.
2. Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.
Ques: 99 Can you explain the difference between an ADO.NET Dataset and an ADO Recordset? 
Ans:1. A DataSet can represent an entire relational database in memory, complete with tables, relations, and views. 
2. A DataSet is designed to work without any continuing connection to the original data source. 
3. Data in a DataSet is bulk-loaded, rather than being loaded on demand. 
Ques: 100 Can you give an example of when you might use it? 
Ans:When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class. 


Ques: 101 Can the action attribute of a server-side <form> tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page. 
Ans:No, You have to use Server.Transfer to pass the data to another page.
Ques: 102 What is the role of global.asax.
Ans:Store global information about the application
Ques: 103 What’s a bubbled event? 
Ans:When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
Ques: 104 Describe the difference between inline 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. 
Ques: 105 Which method do you invoke on the DataAdapter control to load your generated dataset with data? 
Ans:The .Fill() method 
Ques: 106 Can you edit data in the Repeater control?
Ans:No, it just reads the information from its data source 
Ques: 107 Which template must you provide, in order to display data in a Repeater control? 
Ans:ItemTemplate 
Ques: 108 How can you provide an alternating color scheme in a Repeater control? 
Ans:Use the AlternatingItemTemplate 
Ques: 109 What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
Ans:You must set the DataSource property and call the DataBind method. 
Ques: 110 Name two properties common in every validation control?
Ans:ControlToValidate property and Text property
Ques: 111 Where does the Web page belong in the .NET Framework class hierarchy?
Ans:System.Web.UI.Page 
Ques: 112 Where do you store the information about the user’s locale? 
Ans:System.Web.UI.Page.Culture
Ques: 113 Can you give an example of what might be best suited to place in the Application Start and Session Start subroutines?  
Ans:This is where you can set the specific variables for the Application and Session objects.
Ques: 114 What is the transport protocol you use to call a Web service?
Ans: SOAP is the preferred protocol. 
Ques: 115 To test a Web service you must create a windows application or Web application to consume this service?
Ans:The webservice comes with a test page and it provides HTTP-GET method to test.
Ques: 116 What’s the difference between struct and class in C#?
Ans:1. Structs cannot be inherited. 
2. Structs are passed by value, not by reference. 
3. Struct is stored on the stack, not the heap.
Ques: 117 Where do the reference-type variables go in the RAM?
Ans:The references go on the stack, while the objects themselves go on the heap. However, in reality things are more elaborate. 
Ques: 118 What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
Ans:The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null. 
Ques: 119 What is main difference between Global.asax and Web.Config? 
Ans:ASP.NET uses the global.asax to establish any global objects that your Web application uses. The .asax extension denotes an application file rather than .aspx for a page file. Each ASP.NET application can contain at most one global.asax file. The file is compiled on the first page hit to your Web application. ASP.NET is also configured so that any attempts to browse to the global.asax page directly are rejected. However, you can specify application-wide settings in the web.config file. The web.config is an XML-formatted text file that resides in the Web site’s root directory. Through Web.config you can specify settings like custom 404 error pages, authentication and authorization settings for the Web site, compilation options for the ASP.NET Web pages, if tracing should be enabled, etc
Ques: 120 What is SOAP and how does it relate to XML?
Ans:The Simple Object Access Protocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and a convention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML. 
 
Post a Comment