Pages

Monday, 21 September 2015

Top 66 ADO.Net Objective type Questions and Answers

1. What is the default value for the Method attribute in a ASP.NET server-side Form control
A. GET
B. POST
C. SOAP
D. SMTP
Ans: B

2. Which property allows ASP.NET controls to maintain their values when a page is posted to itself.
A. EnableViewState
B. MaintainValue
C. SaveValue
D. AutoPostBack
Ans: A

3. In a ASP.NET page, which is the best way to find if the contents of a TextBox has changed after the form containing the TextBox has been posted back to the server
A. By comparing the old value with the new value
B. By checking the NewValue property of the TextBox control
C. By handling the TextBox control's TextChanged event
D. By checking the HasChanged property of the TextBox
Ans: C

4. Which statement among the ones below is correct
A. The Params and Forms collection of the HTTPRequest class are exactly same and theForms collection has been provided only for backward compatibility
B. The HTTPRequest class does include the Params collection
C. The HTTPRequest class does include the Forms collection
D. The difference between the Params and Forms collection of the HTTPRequest class is that the Params collection also represents QueryStrings, ServerVariables, andCookies
Ans: D

5. Which statement among the ones below is correct
a. If you use the server-side version of the <form> tag, you cannot post the form to a different page.
b. You can modify the Action attribute of the server-side version of the <form> tag to post the form to a different page
c. You have to set the Method and Action attributes of the server-side version of the <form>tag to post the form to a different page
d. You can use the SetAction() method of the server-side version of the <form> tag to post the form to a different page
Ans: A

6. If a form is posted to a different page, the you can retrieve the values of the form elements by
a. Using the properties of the ASP.Net controls
b. Using the GetElementByID() method
c. Using Request.Params
d. The values cannot be retrieved
Ans: C

7. You are performing Form validations with Validation controls. You need to group all the errors at the top of the page and also show error messages besides each element. The messages besides each element need to be detailed and hence different from the messages at top of the page
A. You can use the ValidationSummary Control to summarize the messages set in theErrorMessage property of the Validation controls. The messages set in the Text property of the Validation controls can be displayed besides each element.
B. The error messages set in the SummaryText property of each Validation control havingisSummary=true will be automatically grouped at the top of the page and the messages set in the Text property can be displayed besides each element.
C. The error messages in the Validation control can only be displayed in a popup
D. The Validation controls cannot be used in the given scenario
Ans: A

8. How do view states work
A. Using Cookies
B. Using a hidden form field
C. Using Session variables
D. Using Application variables
Ans: B

9. You need to dynamically add a TextBox control to a page and display it at specific location
A. Place a Label control at the required location in the page and add the control by manipulating the Text property of the Label control
B. Place a PlaceHolder control at the required location in the page. Use the Add method of theControls collection of the PlaceHolder control to dynamically add the required control
C. Build the HTML for the entire page in a String and insert the HTML code for required control in required place
D. You cannot add a control to a page dynamically
Ans: B

10. You require to create an ASP.NET page with the functionality to allow a user to upload a file to the server
A. You need to use the System.Web.Upload namespace
B. You need to use a COM component to save the file on the server
C. You need to use the SaveAs method of the HttpPostedFile class
D. The ASP.Net application automatically loops through all the <input type="File"> and saves the uploaded files to a virtual folder called "uploads"
Ans: C

More Questions & Answers:-
Page1 Page2 Page3 Page4 Page5 Page6 Page7

No comments:

Post a Comment