100 Top ADO.Net Multiple Choice Questions and Answers

ADO.Net Multiple Choice Questions:-

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

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

3. In an 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
Answer:- C

4. Which statement among the ones below is correct
A. The Params and Forms collection of the HTTPRequest class are exactly the same and the 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, and cookies
Answer:- D

5. Which statement among the ones below is correct
a. If you use the server-side version of the tag, you cannot post the form to a different page.
b. You can modify the Action attribute of the server-side version of the 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 tag to post the form to a different paged
. You can use the SetAction(. method of the server-side version of the tag to post the form to a different page
Answer:- 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
Answer:- 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
Answer:- A

8. How do view states work
A. Using Cookies
B. Using a hidden form field
C. Using Session variables
D. Using Application variables
Answer:- 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 the required place
D. You cannot add a control to a page dynamically
Answer:- 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 and saves the uploaded files to a virtual folder called “uploads”
Answer:- C

11. You need to programmatically add a user control without using the Register directive in your code
A. Use AddUserControl
B. Use cannot programmatically add a user control
C. Use UserControl.Add
D. Use LoadControl
Answer:- D

12. You need to develop a business component myComp.dll in .Net and use it in your ASP.NET page
a. You require to register the component using regsvr32.exe
b. You require to register the component using TlbExp.exe
c. You require to copy the component to the /bin directory in your applications root directory
d. You require to copy the component to the /bin directory in your applications root directory and register the component using regsvr32.exe
Answer:- C

13. Is it possible for multiple aspx pages to use the same code-behind file, if required
A. Yes
B. No
Answer:- A

14. How is a ASP.NET presentation page associated with its code-behind
A. The presentation page includes the code-behind file using #include
B. The presentation page includes the code-behind file using
C. The presentation page inherits from the code-behind
D. The ASP.NET presentation page and the code-behind page have the same name and hence are automatically associated with each other
Answer:- C

15. Which namespace would you use if you need to create an ASP.NET application with Microsoft SQL Server 2000 as the database.
A. System.Data.SQLServer
B. System.Data.SQLClient
C. System.Data.OleDb
D. System.Data.Microsoft
Answer:- B

16. Which namespace would you use if you need to create an ASP.NET application with Oracle as the database.
A. System.Data.SQLServer
B. System.Data.SQLClient
C. System.Data.OleDb
D. System.Data.NonMS
Answer:- C

17. Which statement among the following is correct while opening a connection using theSQLConnection class
A. You cannot specify a connection string
B. You need to specify a Provider parameter for the connection string
C. You need to use a System DSN
D. You cannot use a DSN
Answer:- C

18. What method of the Command object would you use if you need to retrieve a single value (for example an aggregate value. from a database
A. ExecuteScalar(.
B. ExecuteReader(.
C. ExecuteSingle(.
D. ExecuteNonQuery(.
Answer:- A

19. Which are the two things you need to take care of in your ASP.Net application to take advantage of connection pooling (select two.
A. You need to set the Pooling property of the Connection object to True
B. You need to use the same exact connection string whenever you open a database connection
C. You need to call the ReleaseToPool(. method after the connection is closed
D. You need to explicitly close the connection with the Close(. method
Answer:- B, D

20. You have created a ASP.Net page Transaction by using
A. If a transaction already exists, the page will execute within the context of the transaction. However, it will not create a new transaction
B. If a transaction already exists, the page will execute within the context of the transaction. If a transaction does not exist, it will create a new one
C. Creates a new transaction for each request
D. You cannot created a ASP.Net page Transaction by using
Answer:- B

21. You need to retrieve only schema information about the columns contained in a database table without retrieving data. Which of the following is the best way to retrieve it
A. Use the GetSchemaTable(. method of the DataReader in conjunction withCommandBehaviour.SchemaOnly
B. Use the SchemaOnly property of the Command class
C. Use the GetSchemaOnly(. method of the DataReader
D. You cannot retrieve only schema information without retrieving data
Answer:- A

23. What will be the values assigned to the two Label controls lblMessage1 & lblMessage2 respectively
A. 2 & 3
B. 3 & 3
C. 3 & 4
D. 4 & 4
Answer:- C

23. You need to customize the display format of the DataList control
A. Set the DisplayFormat property of the DataList control to Custom
B. Set the CustomFormat property of the DataList control to True
C. ItemTemplate will allow you to format the appearance of each DataList item
D. The display format of the DataList control is predefined and cannot be customized
Answer:- C

24. You have a DataList control containing a LinkButton. What would you do to raise a theDeleteCommand event in the DataList by clicking on the LinkButton.
A. Set CommandName=” delete” in the LinkButton
B. Set the OnDelete property of the DataList to the ID of the LinkButton
C. A DataList control cannot raise an event in response to events raised by its child controls
D. A DataList control cannot contain child controls
Answer:- A

25. The Products table has a column named ProductName and a primary key column namedProductID. When a user selects an item in the DataList, you want to retrieve the value of theProductID column associated with it.
A. In the DataList control set PrimaryKeyField=” ProductID”
B. In the DataList control set DataKeyField=” ProductID”
C. In the DataList control set KeyField=” ProductID”
D. In the DataList control set id=” ProductID”
Answer:- B

26. You need to enable paging for a DataGrid control
A. You can use a DataReader
B. You can use a DataTable
C. You can use either the DataReader or DataTable
D. A DataGrid does not support paging
Answer:- B

27. Can you use a DataView to filter rows in a DataTable
A. Yes, by setting the Filter property of the DataView
B. Yes, by setting the RowFilter property of the DataView
C. Yes, by using the SetFilter(. method of the DataView
D. No, a DataView cannot be used to filter rows in a DataTable
Answer:- B

28. Which statement is an accurate description of the code below (dtsDataset is a DataSet.
Cache(“myCachedDataSet”. = dstDataset
a. Adds a DataSet to the application’s cache in the server’s memory, automatically preserving it between page requests.
b. Adds a DataSet to the cache in the client’s memory, automatically preserving it between page requests.
c. The Cache object cannot be used to cache a DataSet, it can only cache a DataTable
d. The code block is syntactically incorrect and should actually be
Set Cache(“myCachedDataSet”. = dstDataset
Answer:- A

29. How can you load an XML file directly into a DataSet
A. By setting the XML property of the DataSet class
B. By using the GetXML(. method of the DataSet class
C. By using the ReadXml(. method of the DataSet class
D. You cannot load an XML file directly into a DataSet
Answer:- C

30. Your site has been restructured and the paths of few pages have changed. Which method would you use to redirect users requesting for a pages using the old URL
A. Create an ISAPI filter to do the above task
B. Create an entry in the section of the Web. Config file
C. Use the Application. Config file
D. Handle the Application_BeginRequest event and use the RewritePath(. method
Answer:- D
31. Which statement about the Web. Config file is the most accurate
A. The Web. Config file can be only placed in the root of a Web Site to override settings in theMachine.Config file for all applications in a particular Web Site
B. The Web. Config file can only be placed in the root of a particular virtual directory
C. The Web. Config file can be placed in the root of the Web Site and the root of a virtual directory. The settings from the file in the virtual directory overrides the settings from the file in the Web Site
D. The Web. Config file can be placed in the root of the Web Site and the root of a virtual directory and in any subdirectory of an application. The settings from a file at a particular level override the settings from the ones above it.
Answer:- D

32. The settings in the Web. Config file are case-sensitive
A. True
B. False
Answer:-

33. The settings in the Web. Config file can be configured to apply to
A. An application
B. An application or a particular directory
C. An application or a particular directory or even an individual file
D. The Web. Config file always applies to all pages in the current directory and its subdirectories
Answer:- C

34. Is there a way to prevent configuration settings in a Web. Config file from being overridden by aWeb.Config file located below it
A. Yes, you can use the allowOverride attribute in the tag to prevent configuration settings in a Web. Config file from being overridden by a Web.Config file located below it
B. Yes, you can use the tag to prevent configuration settings in aWeb.Config file from being overridden by a Web.Config file located below it
C. If a Web. Config file exist at a particular level then all settings in the Web. Config file located above it are always ignored
D. You cannot have more than one Web. Config file in an ASP.NET application
Answer:- A

35. If you have an ASP.NET application with cookieless sessions enabled, which statement among the
A. You cannot use relative URL’s with cookieless sessions
B. You cannot use absolute URL’s with cookieless sessions
C. Cookieless sessions have no relation with the URL’s
D. You cannot have cookieless sessions with an ASP.NET application
Answer:- B

ADO.Net Objective Questions Pdf Free Download ::

36. You are part of a team that is using Visual Studio .NET to develop a Web application. You have placed a number of configuration settings for the application in the server’s Machine.config file. You learn in a meeting that one of your co-workers has created a Web.config file to store these settings, though in comparing notes you realize that you and your co-worker have used different settings.
Which of the following describes what will happen when you execute the application
a. The application will run correctly and will use the settings in the Web.config file, ignoring theMachine.config settings
b. The application will run correctly and will use the settings in the Machine.config file, ignoring the Web.config settings
c. The application will not run correctly until you either remove the Web.config file or delete the settings from the Machine.config file
d. The application will run correctly, using only the settings that are identical in the Web. configand Machine.config files
e. The application will not run correctly until you modify either the Web.config file or theMachine.config file so that the application settings are identical
Answer:- A

37. You are preparing to deploy an ASP.NET Web application. You are currently creating the deployment project. You have started the Web setup project, which is namedAccountManagerDeploy, and added the application output to the project, and now you need to set the directory on the Web server to which the application will be installed. Which of the following procedures should you use to do so (Choose two. Each correct answer presents part of the solution..
A. Set the VirtualDirectory property in the Properties window.
B. Select the Web Application Folder in the File System Editor.
C. Select the AccountManagerDeploy project in the Solution Explorer.
D. Set the Folder property in the Properties window.
E. Select the Primary output from AccountManagerDeploy icon in the Solution Explorer.
Answer:- A, B

38. You are part of a team that is using Visual Studio .NET to develop a Web application. You are looking through the files in the application, and you see the following files:
createmembership.aspx
createmembership.aspx.vb
Which two of the following statements most accurately describe these two files (Select two..
A. The createmembership.aspx.a vb file is a Web form, which displays a user interface to the user
B. The createmembership.aspx file is a code file, which contains code that interacts with the user interface in the Web form
C. The createmembership.aspx file is an uncompiled file that will become createmembership.aspx.vb when it is compiled
D. The createmembership.aspx.vb file is a code file, which contains code that interacts with the user interface in the Web form
E. The createmembership.aspx file is a Web form, which displays a user interface to the user
F. The createmembership.aspx.vb file is the compiled version of createmembership.aspx
Answer:- D, E

39. You are using Visual Studio .NET to develop a Web application. You are beginning to debug your application, and you would like to store debug messages in the Windows event log as you proceed with testing. Which of the following will allow you to do so
A. TextWriterTraceListener
B. DefaultTraceListener
C. EventLogTraceListener
D. TraceSwitch
Answer:- C

40. You are using Visual Studio .NET to develop a Web application for a large video rental store. The titles, as well as other information about the store’s videotapes, laser disks, DVDs, and audio books, are stored in a SQL Server 2000 database.
The store wants to allow visitors to its Web site to browse the list of titles sorted in various ways, such as by medium (VHS, DVD, etc.., genre, director, and so on. You have created a number of stored procedures to facilitate the different ways of presenting the data.
Given an existing DataSet named dsVids and a Connection named conn, which of the following code examples illustrates the correct way to call the stored procedure named ListDVDTitles that returns the list of DVD titles
A. Dim daDVDList as New SqlDataAdapter(.
daDVDList.SelectCommand = New SqlCommand(.
daDVDList.SelectCommand.Connection = conn
daDVDList.SelectCommand.CommandText = “ListDVDTitles”
daDVDList.SelectCommand.CommandType = CommandType.StoredProcedure
daDVDList.Fill(dsVids, “Titles”.

B. Dim daDVDList as New SqlDataAdapter(.
daDVDList.SelectCommand = New StoredProcedure(.
daDVDList.SelectCommand.Connection = conn
daDVDList.SelectCommand.CommandText = “ListDVDTitles”
daDVDList.SelectCommand.CommandType = CommandType.SQLCommand
daDVDList.Fill(dsVids, “Titles”.

C. Dim daDVDList as New SqlDataAdapter(.
daDVDList.SelectCommand = New SqlCommand(.
daDVDList.SelectCommand.Connection = “ListDVDTitles”
daDVDList.SelectCommand.CommandType = CommandType.StoredProcedure
daDVDList.Fill(dsVids, “Titles”.

D. Dim daDVDList as New SqlDataAdapter(.
daDVDList.SelectCommand = New SqlCommand(.
daDVDList.SelectCommand.CommandText = “ListDVDTitles”
daDVDList.SelectCommand.CommandType = CommandType.StoredProcedure
daDVDList.Fill(dsVids, “Titles”.
Answer:- A

42. You are creating a Web service that will include a Web method. You want the method to return its data to the caller as it is created and put into a serial stream, rather than waiting for all of the data to be prepared before returning it. Which of the following WebMethod attributes should you set to enable this
A.
B.
C.
Answer:- B

43. The XSLT processor copies the elements of the stylesheet until it finds a command in the format:
A. SELECT … FROM … WHERE.
B. {item, action}.
C. {for-each select}.
D. none.
Answer:- B

44. What standard, protocol or language was generalized to become a standard protocol for sending messages of any type, using any protocol?
A. SOAP
B. SGML
C. SQL
D. ADO
Answer: A

45. Which of the following statements is not true about XML Schemas:
A. They are used to define the content and structure of data.
B. They define a set of symbols and the relationships of those symbols.
C. They are themselves XML documents.
D. They have their own syntax.
Answer:- D

46. The most popular way to materialize XML documents is to use:
A. DTD.
B. XSLT.
C. HTML.
D. SOAP.
Answer:- B

47. With XML:
A. views are not limited to one multi-valued path only.
B. documents can automatically be generated from database data only.
C. database data can automatically be extracted from XML documents only.
D. With XML, all of the above are true.
Answer:- D

48. To eliminate definition duplication, XML Schemas define:
A. an intersection table.
B. global elements.
C. a normalized definition table.
D. None of the above is correct.
Answer:- B

48. What is not true about SOAP?
A. SOAP originally meant a Simple Object Access Protocol.
B. SOAP was defined as an XML-based standard for providing remote procedure calls over the Internet.
C. SOAP now is just a name, not an acronym
D. SOAP was an early form of XML.
Answer:- D

49. XML Schemas consist of:
A. properties and methods.
B. elements and attributes.
C. structure and data.
D. tables and relationships.
Answer:- B

50. The expression FOR XML RAW tells SQL Server to:
A. place the values of the columns as attributes in the resulting XML document.
B. place the values of the columns into elements rather than attributes.
C. place some columns into elements and others into attributes.
D. None of the above is correct.
Answer:- A

51. ADO.NET provides the ability to create and process in-memory databases called:
A. views.
B. relations.
C. tables.
D. datasets.
Answer:- D

52. An XML component that defines the structure of a document is known as a(n.:
A. DOCTYPE.
B. DTD.
C. #PCDATA.
D. HTML Stylesheet.
Answer:- B

53. HTML is an application of a more robust document markup language called:
A. XHTML.
B. XML.
C. SGML.
D. None of the above is correct.
Answer:- C

54. XSLT processors evaluate each statement in the context of the match that has been made. That is, XSLT processors are:
A. context oriented.
B. procedural oriented.
C. object oriented.
D. relational oriented.
Answer:- A

55. The DTD begins with the word:
A. #PCDATA.
B. XML.
C. DOCTYPE.
D. HTTPS.
Answer:- C

56. What is not true about XML?
A. Web page display is the most important application of XML.
B. With XML, there is a clear separation between document structure, content and materialization.
C. XML is more powerful than HTML.
D. XML documents have two sections.
Answer:- A

57. What is not true about XSLT?
A. XSLT is a declarative transformation language.
B. XSLT uses a set of rules that govern how a document is to be materialized is created.
C. XSLT uses a set of procedures that specify how a document is to be programmed.
D. XSLT is used to transform the input document into another document.
Answer:- C

58. If the XML data instance conforms to the DTD, the document is said to be:
A. type-invalid.
B. type-valid.
C. not-type-valid.
D. an HTML document.
Answer:- B

59. The document that is used by XSLT to indicate how to transform the elements of the XML document to another format is a(n.:
A. HTML page.
B. DOCTYPE procedure.
C. stylesheet.
D. stored procedure.
Answer:- C

60. If an XML document does not have a DTD, then by definition it is:
A. not-type-valid.
B. type-valid.
C. an HTML document.
D. None of the above is correct.
Answer:- A

61. Using Which Datasource Control Can Access Oracle DataBase ?
a. xmlDatasource
b. sqlDataSource
c. ObjectDatasource
d. All of the Aboove
Answer:- C

62. How to get the current user Name ?
a. Identity.UserName
b. CurrentUser.Identity.Name
c. User.Identity.Name
d. Based on the Session Variable Name
Answer:- C

63. Which is Incorrect ?
a. Session objecy is Private to user
b. Application Object is global
c. Caching can be global or Private
d. Application object vaues are accessed accross the application
Answer:- C

64. Which is Correct ?
a. sql cache invalidation is a new feature in asp.net2.0
b. sql cache invalidation is an existing feature with enhancement
c. sql cache invalidation is an existing feature
d. sql cache invalidation is a bug in the prior version
Answer:- D

65. Which is correct ?
a. DataTable is a member of a DataSet
b. DataTable is a member of a System. Data
c. DataTable is a member of a System.Data.SqlClient
d. Dataadapter
Answer:- B

66. Which is correct ?
a. System.String and System. Text are the same. System.text is a synonym of system. string
b. System. String is the data type System. Text is Class
c. System. String is the data type System. Text is namespace
d. Non of the abve is right
Answer:- D