Interview Tips Interview Tips, Interview Questions and Answers

16Jun/100

ASP.NET Cookies Overview

A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site.

For example, if a user requests a page from your site and your application sends not just a page, but also a cookie containing the date and time, when the user's browser gets the page, the browser also gets the cookie, which it stores in a folder on the user's hard disk.

Later, if user requests a page from your site again, when the user enters the URL the browser looks on the local hard disk for a cookie associated with the URL. If the cookie exists, the browser sends the cookie to your site along with the page request. Your application can then determine the date and time that the user last visited the site. You might use the information to display a message to the user or check an expiration date.

Cookies are associated with a Web site, not with a specific page, so the browser and server will exchange cookie information no matter what page the user requests from your site. As the user visits different sites, each site might send a cookie to the user's browser as well; the browser stores all the cookies separately.

Cookies help Web sites store information about visitors. More generally, cookies are one way of maintaining continuity in a Web application—that is, of performing state management. Except for the brief time when they are actually exchanging information, the browser and Web server are disconnected. Each request a user makes to a Web server is treated independently of any other request. Many times, however, it's useful for the Web server to recognize users when they request a page. For example, the Web server on a shopping site keeps track of individual shoppers so the site can manage shopping carts and other user-specific information. A cookie therefore acts as a kind of calling card, presenting pertinent identification that helps an application know how to proceed.

Cookies are used for many purposes, all relating to helping the Web site remember users. For example, a site conducting a poll might use a cookie simply as a Boolean value to indicate whether a user's browser has already participated in voting so that the user cannot vote twice. A site that asks a user to log on might use a cookie to record that the user already logged on so that the user does not have to keep entering credentials.

Cookie Limitations

Most browsers support cookies of up to 4096 bytes. Because of this small limit, cookies are best used to store small amounts of data, or better yet, an identifier such as a user ID. The user ID can then be used to identify the user and read user information from a database or other data store. (See the section "Cookies and Security" below for information about security implications of storing user information.)

Browsers also impose limitations on how many cookies your site can store on the user's computer. Most browsers allow only 20 cookies per site; if you try to store more, the oldest cookies are discarded. Some browsers also put an absolute limit, usually 300, on the number of cookies they will accept from all sites combined.

A cookie limitation that you might encounter is that users can set their browser to refuse cookies. If you define a P3P privacy policy and place it in the root of your Web site, more browsers will accept cookies from your site. However, you might have to avoid cookies altogether and use a different mechanism to store user-specific information. A common method for storing user information is session state, but session state depends on cookies, as explained later in the section "Cookies and Session State."

1Jun/100

ASP.NET 2.0 Interview Questions

17. In the Design view in Visual Studio 2005 of an ASP.NET web page, what is the easiest way to create an event handler for the default event of a ASP.NET server control?
A. Open the code-behind page and write the code.
B. Right-click the control and select Create Handler.
C. Drag an event handler from the ToolBox to the desired control.
D. Double-click the control.
18. Which of the following represents the best use of the Table, TableRow, and Table-Cell controls?
A. To create and populate a Table in Design view
B. To create a customized control that needs to display data in a tabular fashion
C. To create and populate a Table with images
D. To display a tabular result set
19. For your ASP.NET web application your graphics designer created elaborate images that show the product lines of your company. Some of graphics of the product line are rectangular, circular, and others are having complex shapes. You need to use these images as a menu on your Web site. What is the best way of incorporating these images into your Web site?
A. Use ImageButton and use the x- and y-coordinates that are returned when the user clicks to figure out what product line the user clicked.
B. Use the Table, TableRow, and TableCell controls, break the image into pieces that are displayed in the cells, and use the TableCell control’s Click event to identify the product line that was clicked.
C. Use the MultiView control and break up the image into pieces that can be displayed in each View control for each product line. Use the Click event of the View to identify the product line that was clicked.
D. Use an ImageMap control and define hot spot areas for each of the product lines. Use the PostBackValue to identify the product line that was clicked.
20. You are writing ASP.NET 2.0 Web site that collects lots of data from users, and the data collection forms spreads over multiple ASP.NET Web pages. When the user reaches the last page, you need to gather all of data, validate the data, and save the data to the SQL Server database. You have noticed that it can be rather difficult to gather the data that is spread over multiple pages and you want to simplify this application. What is the easiest control to implement that can be used to collect the data on a single Web page?
A. The View control
B. The TextBox control
C. The Wizard control
D. The DataCollection control
21. In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?
A. Use the ImageMap control and randomly select a HotSpot to show or hide.
B. Use the Image control to hold the image and a Calendar control to randomly select a date for each image to be displayed.
C. Use the AdServer control and create an XML file with configuration of the control.
D. Use an ImageButton control to predict randomness of the image to be loaded based on the clicks of the control.
22. In your ASP.NET web application you want to display a list of clients on a Web page. The client list displays 10 clients at a time, and you require the ability to edit the clients. Which Web control is the best choice for this scenario?
A. The DetailsView control
B. The Table control
C. The GridView control
D. The FormView control
23. While developing ASP.NET 2.0 web application you want to display a list of parts in a master/detail scenario where the user can select a part number using a list that takes a minimum amount of space on the Web page. When the part is selected, a DetailsView control displays all the information about the part and allows the user to edit the part. Which Web control is the best choice to display the part number list for this scenario?
A. The DropDownList control
B. The RadioButtonList control
C. The FormView control
D. The TextBox control

17. In the Design view in Visual Studio 2005 of an ASP.NET web page, what is the easiest way to create an event handler for the default event of a ASP.NET server control? A. Open the code-behind page and write the code. B. Right-click the control and select Create Handler. C. Drag an event handler from the ToolBox to the desired control.D. Double-click the control.
18. Which of the following represents the best use of the Table, TableRow, and Table-Cell controls?A. To create and populate a Table in Design view B. To create a customized control that needs to display data in a tabular fashionC. To create and populate a Table with images D. To display a tabular result set
19. For your ASP.NET web application your graphics designer created elaborate images that show the product lines of your company. Some of graphics of the product line are rectangular, circular, and others are having complex shapes. You need to use these images as a menu on your Web site. What is the best way of incorporating these images into your Web site? A. Use ImageButton and use the x- and y-coordinates that are returned when the user clicks to figure out what product line the user clicked. B. Use the Table, TableRow, and TableCell controls, break the image into pieces that are displayed in the cells, and use the TableCell control’s Click event to identify the product line that was clicked. C. Use the MultiView control and break up the image into pieces that can be displayed in each View control for each product line. Use the Click event of the View to identify the product line that was clicked. D. Use an ImageMap control and define hot spot areas for each of the product lines. Use the PostBackValue to identify the product line that was clicked.
20. You are writing ASP.NET 2.0 Web site that collects lots of data from users, and the data collection forms spreads over multiple ASP.NET Web pages. When the user reaches the last page, you need to gather all of data, validate the data, and save the data to the SQL Server database. You have noticed that it can be rather difficult to gather the data that is spread over multiple pages and you want to simplify this application. What is the easiest control to implement that can be used to collect the data on a single Web page? A. The View control B. The TextBox control C. The Wizard control D. The DataCollection control
21. In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this? A. Use the ImageMap control and randomly select a HotSpot to show or hide. B. Use the Image control to hold the image and a Calendar control to randomly select a date for each image to be displayed. C. Use the AdServer control and create an XML file with configuration of the control. D. Use an ImageButton control to predict randomness of the image to be loaded based on the clicks of the control.
22. In your ASP.NET web application you want to display a list of clients on a Web page. The client list displays 10 clients at a time, and you require the ability to edit the clients. Which Web control is the best choice for this scenario? A. The DetailsView control B. The Table control C. The GridView control D. The FormView control
23. While developing ASP.NET 2.0 web application you want to display a list of parts in a master/detail scenario where the user can select a part number using a list that takes a minimum amount of space on the Web page. When the part is selected, a DetailsView control displays all the information about the part and allows the user to edit the part. Which Web control is the best choice to display the part number list for this scenario? A. The DropDownList control B. The RadioButtonList control C. The FormView control D. The TextBox control

30May/100

ASP.NET 2.0 Interview Questions

1. What is the name of the property of ASP.NET page that you can query to determine that a ASP.NET page is being requested not data being submitted to web server?
A. FirstGet
B. Initialized
C. IncludesData
D. IsPostBack
IsPostBack
2. While creating a Web site with the help of Visual Studio 2005 on a remote computer that does not have Front Page Server Extensions installed, which Web site type will you create in Visual Studio 2005?
A. Remote HTTP
B. File
C. FTP
D. Local HTTP
Hypertext Transfer Protocol (HTTP)
3. If you want to create a new Web site with the help of Visual Studio 2005 on a Web server that is hosted by your ISP (Internet Services provider) and the Web server has Front Page Server Extensions installed, what type of Web site type would you create in Visual Studio 2005?
A. Local HTTP
B. File
C. FTP
D. Remote HTTP
Hypertext Transfer Protocol (HTTP)
4. For separating server-side code from client-side code on a ASP.NET page, what programming model should you use?
A. Separation model
B. Code-Behind model
C. In-Line model
D. ClientServer model
5. Amit created a new Web site using Visual Studio 2005 in programming language C#. Later, Amit received an existing Web page from his boss, which consisted of the Contact.aspx file with the Contact.aspx.vb code-behind page. What must Amit do to use these files?
A. Amit can simply add the files Contact.aspx, Contact.aspx.vb into the existing Web site, because ASP.NET 2.0 supports Web sites that have Web pages that were programmed with different languages.
B. The Contact.aspx file will work, but Amit must rewrite the code-behind page using C#.
C. Both files Contact.aspx and Contact.aspx.vb must be rewritten in C#.
D. Amit must create a new Web site that contains these files Contact.aspx and Contact.aspx.vb. Set a Web reference to the new site.
6. If you want to make a configuration setting change in your server that will affect to all Web and Windows applications on the current machine. Where you will make the changes?
A. Global.asax
B. Web.config
C. Machine.config
D. Global.asax
7. If you want to make a configuration setting change that will affect only the current Web application. Which file will you change?
A. Web.config that is in the same folder as the Machine.config file
B. Web.config in the root of the Web application
C. Machine.config
D. Global.asax
8. For making a configuration setting change that will affect only the current Web application. Is there any tool that has a user-friendly Graphical User Interface (GUI)?
A. The Microsoft Management Utility
B. Microsoft Word
C. Visual Studio, using the Tools > Options path
D. Web Site Administration Tool

1. What is the name of the property of ASP.NET page that you can query to determine that a ASP.NET page is being requested not data being submitted to web server? A. FirstGet B. Initialized C. IncludesData D. IsPostBack
IsPostBack
2. While creating a Web site with the help of Visual Studio 2005 on a remote computer that does not have Front Page Server Extensions installed, which Web site type will you create in Visual Studio 2005? A. Remote HTTP B. File C. FTP D. Local HTTP
Hypertext Transfer Protocol (HTTP)
3. If you want to create a new Web site with the help of Visual Studio 2005 on a Web server that is hosted by your ISP (Internet Services provider) and the Web server has Front Page Server Extensions installed, what type of Web site type would you create in Visual Studio 2005? A. Local HTTP B. File C. FTP D. Remote HTTP
Hypertext Transfer Protocol (HTTP)
4. For separating server-side code from client-side code on a ASP.NET page, what programming model should you use? A. Separation model B. Code-Behind model C. In-Line model D. ClientServer model
5. Amit created a new Web site using Visual Studio 2005 in programming language C#. Later, Amit received an existing Web page from his boss, which consisted of the Contact.aspx file with the Contact.aspx.vb code-behind page. What must Amit do to use these files? A. Amit can simply add the files Contact.aspx, Contact.aspx.vb into the existing Web site, because ASP.NET 2.0 supports Web sites that have Web pages that were programmed with different languages. B. The Contact.aspx file will work, but Amit must rewrite the code-behind page using C#. C. Both files Contact.aspx and Contact.aspx.vb must be rewritten in C#. D. Amit must create a new Web site that contains these files Contact.aspx and Contact.aspx.vb. Set a Web reference to the new site.
6. If you want to make a configuration setting change in your server that will affect to all Web and Windows applications on the current machine. Where you will make the changes? A. Global.asax B. Web.config C. Machine.config D. Global.asax
7. If you want to make a configuration setting change that will affect only the current Web application. Which file will you change? A. Web.config that is in the same folder as the Machine.config file B. Web.config in the root of the Web application C. Machine.config D. Global.asax
8. For making a configuration setting change that will affect only the current Web application. Is there any tool that has a user-friendly Graphical User Interface (GUI)? A. The Microsoft Management Utility B. Microsoft Word C. Visual Studio, using the Tools > Options path D. Web Site Administration Tool

6Mar/100

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.