Olete.in
Articles
Mock Tests
đź§Ş ADO.Net MCQ Quiz Hub
ADO.Net Multiple Choice Questions
Choose a topic to test your knowledge and improve your ADO.Net skills
1. What is the default value for the Method attribute in an ASP.NET server-side Form control
GET
POST
SOAP
SMTP
2. Which property allows ASP.NET controls to maintain their values when a page is posted to itself.
EnableViewState
maintain value
SaveValue
AutoPostBack
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
By comparing the old value with the new value
By checking the NewValue property of the TextBox control
By handling the TextBox control’s TextChanged event
By checking the HasChanged property of the TextBox
4. Which statement among the ones below is correct
The Params and Forms collection of the HTTPRequest class are exactly the same and the theForms collection has been provided only for backward compatibility
The HTTPRequest class does include the Params collection
The HTTPRequest class does include the Forms collection
The difference between the Params and Forms collection of the HTTPRequest class is that the Params collection also represents QueryStrings, ServerVariables, and cookies
5. Which statement among the ones below is correct
If you use the server-side version of the tag, you cannot post the form to a different page.
You can modify the Action attribute of the server-side version of the tag to post the form to a different page
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
6. If a form is posted to a different page, the you can retrieve the values of the form elements by
Using the properties of the ASP.Net controls
Using the GetElementByID(. method
Using Request.Params
The values cannot be retrieved
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
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.
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
The error messages in the Validation control can only be displayed in a popup
The Validation controls cannot be used in the given scenario
8. How do view states work
Using Cookies
Using a hidden form field
Using Session variables
Using Application variables
9. You need to dynamically add a TextBox control to a page and display it at specific location
Place a Label control at the required location in the page and add the control by manipulating the Text property of the Label control
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
Build the HTML for the entire page in a String and insert the HTML code for required control in the required place
You cannot add a control to a page dynamically
10. You require to create an ASP.NET page with the functionality to allow a user to upload a file to the server
You need to use the System.Web.Upload namespace
You need to use a COM component to save the file on the server
You need to use the SaveAs method of the HttpPostedFile class
The ASP.Net application automatically loops through all the and saves the uploaded files to a virtual folder called “uploads”
11. You need to programmatically add a user control without using the Register directive in your code
Use AddUserControl
Use cannot programmatically add a user control
Use UserControl.Add
Use LoadControl
12. You need to develop a business component myComp.dll in .Net and use it in your ASP.NET page
You require to register the component using regsvr32.exe
You require to register the component using TlbExp.exe
You require to copy the component to the /bin directory in your applications root directory
You require to copy the component to the /bin directory in your applications root directory and register the component using regsvr32.exe
13. How is a ASP.NET presentation page associated with its code-behind
The presentation page includes the code-behind file using #include
The presentation page includes the code-behind file using
The presentation page inherits from the code-behind
The ASP.NET presentation page and the code-behind page have the same name and hence are automatically associated with each other
14. Which namespace would you use if you need to create an ASP.NET application with Microsoft SQL Server 2000 as the database.
System.Data.SQLServer
System.Data.SQLClient
System.Data.OleDb
System.Data.Microsoft
15. Which namespace would you use if you need to create an ASP.NET application with Oracle as the database.
System.Data.SQLServer
System.Data.SQLClient
System.Data.OleDb
System.Data.NonMS
16. Which statement among the following is correct while opening a connection using theSQLConnection class
You cannot specify a connection string
You need to specify a Provider parameter for the connection string
You need to use a System DSN
You cannot use a DSN
17. 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
ExecuteScalar(.
ExecuteReader(.
ExecuteSingle(.
ExecuteNonQuery(.
18. Which are the two things you need to take care of in your ASP.Net application to take advantage of connection pooling
You need to set the Pooling property of the Connection object to True
You need to use the same exact connection string whenever you open a database connection
You need to call the ReleaseToPool(. method after the connection is closed
none
19. You have created a ASP.Net page Transaction by using
If a transaction already exists, the page will execute within the context of the transaction. However, it will not create a new transaction
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
Creates a new transaction for each request
You cannot created a ASP.Net page Transaction by using
20. 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
Use the GetSchemaTable(. method of the DataReader in conjunction withCommandBehaviour.SchemaOnly
Use the SchemaOnly property of the Command class
Use the GetSchemaOnly(. method of the DataReader
You cannot retrieve only schema information without retrieving data
21. What will be the values assigned to the two Label controls lblMessage1 & lblMessage2 respectively
2 & 3
3 & 3
3 & 4
4 & 4
22. You need to customize the display format of the DataList control
Set the DisplayFormat property of the DataList control to Custom
Set the CustomFormat property of the DataList control to True
Item Template will allow you to format the appearance of each DataList item
The display format of the DataList control is predefined and cannot be customized
23. 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.
Set CommandName=” delete” in the LinkButton
Set the OnDelete property of the DataList to the ID of the LinkButton
A DataList control cannot raise an event in response to events raised by its child controls
A DataList control cannot contain child controls
24. 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.
In the DataList control set PrimaryKeyField=” ProductID”
In the DataList control set DataKeyField=” ProductID”
In the DataList control set KeyField=” ProductID”
In the DataList control set id=” ProductID”
25. You need to enable paging for a DataGrid control
You can use a DataReader
You can use a DataTable
You can use either the DataReader or DataTable
A DataGrid does not support paging
26. Can you use a DataView to filter rows in a DataTable
Yes, by setting the Filter property of the DataView
Yes, by setting the RowFilter property of the DataView
Yes, by using the SetFilter(. method of the DataView
No, a DataView cannot be used to filter rows in a DataTable
27. Which statement is an accurate description of the code below (dtsDataset is a DataSet. Cache(“myCachedDataSet”. = dstDataset
Adds a DataSet to the application’s cache in the server’s memory, automatically preserving it between page requests.
Adds a DataSet to the cache in the client’s memory, automatically preserving it between page requests.
The Cache object cannot be used to cache a DataSet, it can only cache a DataTable
The code block is syntactically incorrect and should actually be Set Cache(“myCachedDataSet”. = dstDataset
28. How can you load an XML file directly into a DataSet
By setting the XML property of the DataSet class
By using the GetXML(. method of the DataSet class
By using the ReadXml(. method of the DataSet class
You cannot load an XML file directly into a DataSet
29. 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
Create an ISAPI filter to do the above task
Create an entry in the section of the Web. Config file
Use the Application. Config file
Handle the Application_BeginRequest event and use the RewritePath(. method
30. Which statement about the Web. Config file is the most accurate
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
The Web. Config file can only be placed in the root of a particular virtual directory
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
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 th
31. The settings in the Web. Config file can be configured to apply to
An application
An application or a particular directory
An application or a particular directory or even an individual file
The Web. Config file always applies to all pages in the current directory and its subdirectories
32. Is there a way to prevent configuration settings in a Web. Config file from being overridden by aWeb.Config file located below it
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
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
If a Web. Config file exist at a particular level then all settings in the Web. Config file located above it are always ignored
You cannot have more than one Web. Config file in an ASP.NET application
33. If you have an ASP.NET application with cookieless sessions enabled, which statement among the
You cannot use relative URL’s with cookieless sessions
You cannot use absolute URL’s with cookieless sessions
Cookieless sessions have no relation with the URL’s D. You cannot have cookieless sessions with an ASP.NET application
You cannot have cookieless sessions with an ASP.NET application
34. 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
The application will run correctly and will use the settings in the Web.config file, ignoring theMachine.config settings
The application will run correctly and will use the settings in the Machine.config file, ignoring the Web.config settings
The application will not run correctly until you either remove the Web.config file or delete the settings from the Machine.config file
The application will run correctly, using only the settings that are identical in the Web. configand Machine.config files
35. 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..
Set the VirtualDirectory property in the Properties window.
Select the Web Application Folder in the File System Editor.
Select the AccountManagerDeploy project in the Solution Explorer.
Both (A) and (B)
36. 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
TextWriterTraceListener
DefaultTraceListener
EventLogTraceListener
TraceSwitch
37. The XSLT processor copies the elements of the stylesheet until it finds a command in the format:
SELECT … FROM … WHERE.
{item, action}
{for-each select}.
none.
38. What standard, protocol or language was generalized to become a standard protocol for sending messages of any type, using any protocol?
SOAP
SGML
SQL
ADO
39. Which of the following statements is not true about XML Schemas:
They are used to define the content and structure of data.
They define a set of symbols and the relationships of those symbols.
They are themselves XML documents.
They have their own syntax.
40. The most popular way to materialize XML documents is to use:
DTD
XSLT
HTML
SOAP
41. With XML:
views are not limited to one multi-valued path only.
documents can automatically be generated from database data only.
database data can automatically be extracted from XML documents only.
With XML, all of the above are true.
42. To eliminate definition duplication, XML Schemas define:
an intersection table.
global elements
a normalized definition table
None of the above is correct.
43. What is not true about SOAP?
SOAP originally meant a Simple Object Access Protocol.
SOAP was defined as an XML-based standard for providing remote procedure calls over the Internet.
SOAP now is just a name, not an acronym
SOAP was an early form of XML.
44. XML Schemas consist of:
properties and methods.
elements and attributes.
structure and data.
tables and relationships.
45. The expression FOR XML RAW tells SQL Server to:
place the values of the columns as attributes in the resulting XML document.
place the values of the columns into elements rather than attributes.
place some columns into elements and others into attributes.
None of the above is correct.
46. ADO.NET provides the ability to create and process in-memory databases called:
views
relations
tables
datasets
47. An XML component that defines the structure of a document is known as a(n.:
DOCTYPE.
DTD.
#PCDATA
HTML Stylesheet.
48. HTML is an application of a more robust document markup language called:
XHTML.
XML.
SGML.
None of the above is correct.
49. XSLT processors evaluate each statement in the context of the match that has been made. That is, XSLT processors are:
context oriented.
procedural oriented.
object oriented.
relational oriented.
50. The DTD begins with the word:
#PCDATA.
XML.
DOCTYPE.
HTTPS
51. What is not true about XML?
Web page display is the most important application of XML.
With XML, there is a clear separation between document structure, content and materialization.
XML is more powerful than HTML.
XML documents have two sections.
52. If the XML data instance conforms to the DTD, the document is said to be:
type-invalid.
type-valid.
not-type-valid.
an HTML document.
53. The document that is used by XSLT to indicate how to transform the elements of the XML document to another format is a(n.:
HTML page.
DOCTYPE procedure.
stylesheet
stored procedure.
54. If an XML document does not have a DTD, then by definition it is:
not-type-valid.
type-valid.
an HTML document.
None of the above is correct.
55. Using Which Datasource Control Can Access Oracle DataBase ?
xmlDatasource
sqlDataSource
ObjectDatasource
All of the above
Submit