Upwork/oDesk ADO.NET 2003 Test
·
1. You have got a supplier data table
named "DTSupp." To display records specifically with sorting, you
employed a dataview as follows:
Dim DataViewSupp As DataView =
DTSupp.DefaultView
What is the 'DataViewSupp' table view
by default?
Answers:
• It is unfiltered and contains
references to the records included in the table
• It is filtered on ID
column and contains references to the records included in the table
• It is unfiltered and does not
contain references to the records included in the table
• It is filtered on ID column and does
not contain references to the records included in the table
2. You use a Command object to
retrieve employee names from the employee table in the database. Which of the
following will be returned when this command is executed using the
ExecuteReader method?
Answers:
• DataRow
• DataSet
• DataTable
• DataReader
3. Which of the following are true
Serializable objects (i.e. they implement ISerializable interface)?
Answers:
• DataSet and DataView
• DataRow and DataTable
• DataColumn and DataView
• DataSet and DataTable
4. You have to retrieve the details of
some members from the 'Member' table. The data reader is executed to get the
values. Which of the following helps go through the results?
Answers:
• DataReader.Next
• DataReader.Move
• DataReader.Read
• DataReader.MoveNext
5. You have following data table
structure:
Sales
-----------
SalemanId
OrderId
Price
How will you calculate the total
amount generated by a salesman (with SalemanID =2201) if the name of DataTable
is 'DatTab?'
Answers:
•
DatTab.Calculate("Sum(Price)", "SalemanID = 2201")
•
DatTab.Compute("Sum(Price)", "SalemanID = 2201")
• DatTab.Calculate("SalemanId =
2201","Sum(Price)")
• DatTab.Compute("SalemanId =
2201","Sum(Price)")
6. Which of the following represents
the possible values for the 'DataRowVersion' class?
Answers:
• Current,Revised,Original, and
Modified
• Revised,Default,Original, and
Modified
• Current,Default,Edited, and Proposed
• Current,Default,Original, and
Proposed
7. Which of the following is not a
valid property of the connection object?
Answers:
• LockType
• ConnectionString
• ConnectionTimeout
• Provider
8. Which of the following overloaded
methods is provided with data table object for sorting and filtering data?
Answers:
• Sort
• Select
• Filter
• Find
9. Read the following statements:
Dim dr As DataRow
Dim objCustReader As
Data.SqlClient.SqlDataReader
Dim dtCustomers As DataTable
With dtCustomers.Columns.Add(New
DataColumn("Customer ID"))
End With
What is wrong in above code?
Answers:
• Add is not a method of the Columns
collection
• Column collection should be used
instead of columns collection
• The Data Type of the column is a
required parameter of 'Add' method
• None of the above
10. Which of the following can not be
bound?
Answers:
• DataViewManager
• DataTable
• DataColumn
• DataView
• All of the above can be bound
11. You have written a function to
generate a unique bill number for every new bill:
1 Public Function getNewBillNo() As
Integer
2
Dim cm As New SqlCommand("select max(billno) from bill", con)
3
con.Open()
4
5
6 End Function
You want to return "1" as
new ID, if there exists no record in the database. Otherwise, the return value
should be the maximum bill number plus one. What should follow in line 4, if
you want to check for Null values as well?
Answers:
• Return (IIf(IsNull(cm.ExecuteNonQuery),
1, cm.ExecuteNonQuery +1))
• Return
(IIf(IsDBNull(cm.ExecuteScalar), 1, cm.ExecuteScalar +1 ))
• Return
(IIf(IsNull(cm.ExecuteScalar), 1, cm.ExecuteScalar))
• Return
(IIf(IsDBNull(cm.ExecuteNonQuery), cm.ExecuteNonQuery ,1))
12. DataSet is a sort of virtual
database which can maintain tables as well as relationships. Which of the
following have correct parameters for the add method of the relations
collection? (Select all which applies)
Answers:
• name as String
• relation as System.Data.DataRelation
• name as String,relation as
System.Data.DataRelation
• name as String, parentColumns() As
System.Data.DataColumn, childColumns() As System.Data.DataColumn
• parentColumns() As
System.Data.DataColumn, childColumns() As System.Data.DataColumn
13. Which of the following is not
correct with regard to DataReader and DataSet?
Answers:
• DataReader reads one row from the
database
• DataSet gets complete set of data
from the database
• DataReader can only get its data
from a data source through a managed provider
• DataReader closes its connection
automatically
14. You have got the data view of the
customer table named "ViewCust." Before displaying the records in the
grid, you want to retrieve the CustomerIDs with a value less than 50. How will
you do this?
Answers:
• ViewCust.RowFilter("CustomerID
< 50")
• ViewCust.Filter = "CustomerID
< 50"
• ViewCust.Filter("CustomerID
> 50")
• ViewCust.RowFilter =
"CustomerID > 50"
15. Which of the following is not true
about CommandType.TableDirect?
Answers:
• TableDirect is only supported by the
.NET Framework Data Provider for OLE DB
• Multiple table access is not
supported when CommandType is set to TableDirect
• TableDirect does not accept table as
a parameter
• None of the above
16. The data from a DataTable named
"Dealers" is retrieved in a DataSet named "ds". Following
is the structure of the table as used in the DataTable:
Dealer
--------------------
DealerID -Primary Key
DealerName
DealerAddress
DealerCity
DealerState
DealerPostcode
DealerPhone
DealerEmail
How will you retrieve the phone number
for the dealer in the 5 th row of the dataset, if the dataset used is 'typed'?
Answers:
• ds.Dealers(4).DealerPhone
• ds.Dealers(5).DealerPhone
•
ds.Tables("Dealers").Rows(4).Item("DealerPhone")
• ds.Tables("Dealers").Rows(5).Item("DealerPhone")
17. ADO.NET 2.0 provides a simple way
of copying the complete table from one data source(/database) to another. What
is the class providing this functionality known as?
Answers:
• BulkCopy
• SQLBulkCopy
• OleDbBulkCopy
• CopyTable
18. Which of the following statements
are correct?
(a)SQL statements are generally faster
than stored procedures
(b)The database engine works out the
execution plan for SQL statements at run time
Answers:
• Only (a) is true
• Only (b) is true
• Both (a) and (b) are true
• Both (a) and (b) are false
19. Which of the following statements
is incorrect with regard to ADO?
Answers:
• ADO uses recordset whereas ADO.NET
uses dataset
• ADO navigation approach is
non-sequential, whereas in ADO.NET it's sequential
• Disconnected access in ADO has to be
coded explicitly, whereas ADO.NET handles it with the adapter
• ADO offers hierarchical RecordSet
for relating multiple tables, whereas ADO.NET provides data relations
20. How you can you verify whether a
dataset has changed?
Answers:
• dataset.HasChanged
• dataset.HasChanges
• dataset.HasModification
• dataset.HasAltered
21. Which of the following is not
associated with the command��object in ADO.NET
2.0?
Answers:
• cmd.ExecuteScalar()
• cmd.ExecutePageReader()
• cmd.ExecuteReader()
• cmd.ExecuteXmlReader()
• cmd.Execute()
22. Which of the following is not a
valid method of DataAdapter?
Answers:
• Fill
• FillSchema
• HasChanges
• Update
23. Which of the following types of
cursors is available with ADO.NET DataReader object?
Answers:
• server-side, forward-only, and
read-write cursor
• server-side, forward-only, and
read-only cursor
• server-side, backward-only, and
read-write cursor
• server-side, bidirectional, and
read-only cursor
24. You have to update some values in
the database. Which of the following methods would you execute on a command
object named "cmdUpdate?"
Answers:
• cmdUpdate.ExecuteScalar()
• cmdUpdate.ExecuteNonQuery()
• cmdUpdate.ExecuteReader()
• cmdUpdate.Execute()
• ExecuteXmlReader()
25. What are the core components of
.Net framework data provider model?
Answers:
• DataAdapter and DataReader
• Connection and Command
• DataAdapter, Connection, and Command
• DataAdapter , DataReader,
Connection, and Command
26. You have two parent and child data
tables named 'DTOrder' and 'DTOrderDetail' respectively. Both are stored in a
data set named 'DS.' How will you make a relation 'DTOrder2DTOrderDetail'
between the two, using 'OrderId' as primary key?
Answers:
• DS.Relation.Add("DTOrder2DTOrderDetail",
DS.Tables["DTOrder"].Columns["OrderId"],
DS.Tables["DTOrderDetail"].Columns["OrderId"])
•
DS.Relations.Add("DTOrder2DTOrderDetail",
DS.Tables["DTOrder"].Columns["OrderId"],
DS.Tables["DTOrderDetail"].Columns["OrderId"])
•
DS.Relation.Add("DTOrder2DTOrderDetail",
DS.Tables["DTOrderDetail"].Columns["OrderId"],
DS.Tables["DTOrder"].Columns["OrderId"])
•
DS.Relations.Add("DTOrder2DTOrderDetail",
DS.Tables["DTOrderDetail"].Columns["OrderId"],
DS.Tables["DTOrder"].Columns["OrderId"])
27. Premium Finance Corp is involved
in the savings business with branches all over the country. They provide
flexible schemes which can be designed according the client's requirements. A
dataset maintains all schemes in separate tables. Whenever a new scheme is
created, the dataset creates a new table but it must be checked that the new
table name should not already exist. Which method of the Tables collection
should be used to check whether the table already exists?
Answers:
• Contains
• Exists
• Duplicate
• Created
28. ADO.NET 2.0 has a new feature that
allows you to run more than one DataReader from the same connection at the same
time. Which of the following properties must be true for multiple DataReaders?
Answers:
• MUDR
• OMDR
• MARS
• MDRC
29. You have a data table named
'ProdDT' and its modified version named 'ModProdDT.' Which of the following
would you use to update the changes, using 'ProdAdp' adapter and 'DS' data set?
Answers:
• ProdAdp.UpdateDataTable(ModProdDT)
DS.ProdDT.AcceptChanges()
• ProdAdp.UpdateDataTable(ModProdDT)
DS.ProdDT.Accept()
• ProdAdp.Update(ModProdDT)
DS.ProdDT.AcceptChanges()
• ProdAdp.Update(ModProdDT)
DS.ProdDT.Accept()
30. You have defined an SQL Command
object named "sqlComm" to run a stored procedure. The OUT parameter
is as follows:
Dim pm2 As New
SqlParameter("@Amount," SqlDbType.Money)
How will you add the OUT parameter
named pm2 to the command object?
Answers:
• sqlComm.Parameters.Add(pm2)
• sqlComm.Parameters.Add(pm2).Mode =
ParameterMode.Output
•
sqlComm.Parameters.Add(pm2).Direction = ParameterDirection.Output
•
sqlComm.Parameters.Add(pm2).Direction = ParameterDirection.ReturnValue
31. A stored procedure takes a single
parameter (storeid) and returns the product sales for that store. The user can
view the sales for that store. Which ADO object should you use to execute the
Sp_store_sales stored procedure in a situation where the user can repeat the
same action for different stores?
Answers:
• Parameter
• Recordset
• Connection
• Command
32. Which of the following is the
parent class of DataAdapter?
Answers:
• Component
• DataSet
• ComponentModel
• SqlClient
33. A stored procedure called
'FirstQTR' is used for generating the sales report of the first quarter. Apart
from other data, it returns the total sale seperately to make a hyperlink. For
this purpose you pass a parameter, TotalSale. Which of the following statements
suits for the parameter TotalSale?
Answers:
•
sqlComm.Parameters.Add(TotalSale,Out)
•
sqlComm.Parameters.Add(TotalSale).Mode = ParameterDirection.Output
•
sqlComm.Parameters.Add(TotalSale).Direction = Parameter.Output
•
sqlComm.Parameters.Add(TotalSale).Direction = ParameterDirection.Output
34. Which of the following statements
is correct with regard to a CommandBuilder object?
Answers:
• It creates update/delete command
based on the primary key column
• It creates update/delete command
based on all the identity columns
• It creates update/delete command
based on original values of all the selected columns
• It creates update/delete command
according to its internal algorithm
35. Which of the following are valid
methods of the SqlTransaction class?
Answers:
• Commit
• Terminate
• Save
• Close
• Rollback
36. Which of the following statements
with regard to DataSet is correct?
Answers:
• A DataSet can derive data from a
database
• A DataSet can derive data from an
xml file
• A DataSet can derive data from both
xml file and a database
• A DataSet can be used to view data
only
• Datasets store data in a
disconnected cache
37. We are iterating through the
results received in a data reader named 'DReaderOrder,' which is created by
using the connection 'SqlCon.' In between we need to retrieve some more values
from the database, so we executed another command in the same connection to get
the results in a new data reader named 'DReaderProduct.' What will be the
result if we are using ADO.NET 2.0? (Note:Multiple Active Result Sets (MARS) is
enabled in SQL Server 2005).
Answers:
• First data reader will immediately
stop and new data reader starts reading
• First data reader will halt till the
new data reader finishes reading
• Both will keep on reading records
independent of each other
• We receive an exception
'System.InvalidOperationException'
38. ADO.NET 2.0 provides a way to get
all the data from data reader into a DataTable. How is this special
functionality invoked?
Answers:
• DataTable.Load(DataReader)
• DataReader.Load(DataTable)
• DataTable.DataSource=DataReader
• DataReader.Fill(DataTable)
39. Which of the following options
should you use to copy the edited rows from a dataset called ProductInfo into
another dataset called ProductChanges?
Answers:
• productChanges = productInfo.GetChanges(DataRowState.Detached)
• productChanges =
productInfo.GetChanges()
• productChanges.Merge(productInfo,
true)
• productChanges.Merge(productInfo,
false)
40. Read the following statements:
Dim employeeDS As DataSet
employeeDS.Tables.Add(new
DataTable("FirstQTR"))
What will be the result of above code?
Answers:
• It will create a table named
FirstQTR
• It does nothing because the object
reference is not set to an instance of the dataset object
• It will produce an error because the
object reference is not set to an instance of the dataset object
• None of the above
41. PreFin101.com has a guest book
which uses an XML document. Initially, an XML file is uploaded into the
datatable. As records increase, the 'GuestID' column should be incremented.
Which properties of the column will be used to implement the auto increment
functionality?
Answers:
• AutoIncrementSeed
• AutoIncrementStep
• AutoIncrement
• AutoIncrementNumber
• AutoIncrementIndex
42. Which of the following methods is
ideally suited for retrieving a single row and single column from the database?
Answers:
• By using fill method of the data
adapter
• By using ExecuteReader method of the
command object
• By using ExecuteScalar method of the
command object
• All of the above
43. One of your forms displays the
list of all the Customers in a list box and all their details in the text
boxes. On selecting a Customer in the list box, text boxes should show details
of that customer. Which of the following is ideally suited for the purpose?
Answers:
•
Me.BindingContext(DataSet,TableName).Position
• Me.BindingContext(TableName,
DataSet).Position
• Me.BindingContext(DataSet,TableName)
• Me.BindingContext(TableName,
DataSet)
44. You have a data table named
'DTable.' You are writing a sub routine to validate the changes made by the
user. Which of the following would you use to get the changed table data?
Answers:
•
DTable.GetChanges(DataRowState.Modified)
• DTable.GetChanges(DataRowsModified)
• DTable.TableChanges(DataRowState.Modified)
•
DTable.TableChanges(DataRowsModified)
45. Which of the following statements
are correct?
(a)A DataReader doesn't have an
iterator or a rows collection
(b)When DataReader reaches the last
row, its Read() method will return false
Answers:
• Only (a) is true
• Only (b) is true
• Both (a) and (b) are true
• Both (a) and (b) are false
46. ADO.NET is known for disconnected
data extraction. Which of the following does not use the disconnected mechanism
while extracting data from the database?
Answers:
• DataAdapter
• DataReader
• DataSet
• None of the above
47. Premium Finance Corp is involved
in the savings business with branches all over the country. They provide
flexible schemes which can be designed according the client's requirements. A
dataset maintains all schemes in separate tables. You want to show all the
schemes in different datagrids which should be created in the same sequence as
the tables are in dataset. Which of the following is the most suitable method
in the current scenario?
Answers:
• Write a loop for the tables()
collection and call CreateDataReader for each table and bind with a dynamically
generated datagrid
• Call GetXMLSchema, create an XML
file and then bind with a dynamically generated datagrid
• Create datagrids for each table and
bind with the relevant table
• None of the above
48. You are using Visual Basic to retrieve
class information from a Microsoft SQL Server database named ClassList. The
database resides on a server named Neptune. Which code fragment will create a
connection to this data source?
Answers:
• Set conn = New SqlConnection; With
conn ; .Provider = "SqlOleDB" ; ConnectionString ="User
ID=sa;"&& "Data Source=Neptune;"&& "Initial
Catalog=ClassList"
• Set conn = New SqlConnection; With
conn ; .Provider = "Neptune" ; ConnectionString ="User
ID=sa;"&& "Data Source=Neptune;"&& "Initial
Catalog=ClassList"
• Set conn = New SqlConnection; With
conn ; .Provider = "SqlOleDB" ; ConnectionString ="User
ID=sa;"&& "Data Source= Neptune;"
49. We are iterating through the
results received in a data reader named 'DReaderOrder,' which is created by
using connection 'SqlCon.' In between, we need to retrieve some more values
from the database, so we executed another command using 'SqlCon,' to get the
results in another data reader 'DReaderProduct.' What will happen if we use
ADO.NET 1.1?
Answers:
• First data reader will immediately
stop and new data reader starts reading
• First data reader will halt till the
new data reader finishes reading
• Both will keep on reading records
independent of each other
• We receive an exception
'Systerm.InvalidOperationException'
50. Which of the following is not a
valid member of DataAdapter?
Answers:
• AcceptChanges
• acceptchangesDuringFill
• Container
• TableMappings
51. The WriteXml method of a DataSet
writes the data of the DataSet in an XML file. WriteXml accepts a parameter for
the different types of destinations. Which of the following is an invalid type
for the destination?
Answers:
• String
• System.IO.Stream
• System.IO.TextStream
• System.IO.TextWriter
• System.Xml.XmlWriter
52. How can you make a data reader
close connection automatically?
Answers:
• command.ExecuteReader()
•
command.ExecuteReader(CommandBehavior.Default)
• command.ExecuteReader(CommandBehavior.CloseConnection)
•
command.ExecuteReader(CommandBehavior.SingleRequest)
53. Which of the following is not a
member of the CommandType enumeration?
Answers:
• Table
• storedProcedure
• TableDirect
• Text
54. You have a table named 'FirstQTR'
and want to create another table 'SecondQTR' which is exactly the same as
'FirstQTR', including DataTable schema and constraints. Which of the following
methods fulfills the requirement?
Answers:
• Copy
• Clone
• Duplicate
• Equals
55. Premium Finance Corp is running a
home loans business. Sometimes a client just wants to see his total amount
paid. For this, the application runs a query which returns a single value.
Which of the following techniques will you prefer to use in the current
scenario?
Answers:
• DataReader
• DataAdapter
• Command object's ExecuteScalar
• None of the above
56. You defined a data adapter as
follows:
Dim adap As New
SqlDataAdapter("select * from products;select * from customers", New
SqlConnection(ConnectionString))
Dim DataSet As New DataSet
adap.Fill(DataSet)
How will you pass the customers data
to a data grid named as "dGrid"?
Answers:
• dGrid.Fill(DataSet.Tables(1))
• dGrid.Fill(DataSet.Tables(2))
• dGrid.DataSource = DataSet.Tables(1)
• dGrid.DataSource = DataSet.Tables(2)
57. You have created an SqlCommand
object as shown below by passing the sql query and the connection object. Dim
cmd as New SqlCommand("Select CategoryID, CategoryName FROM
Categories", con) Which of the following methods would be used by you to
get data?
Answers:
• cmd.ExecuteScalar()
• cmd.ExecuteNonQuery()
• cmd.ExecuteReader()
• cmd.Execute()
58. Premium Corporation is running an
insurance business. They are planning to create a website to automate the
business. An aspx page, Sales.aspx will display the sales generated by an
executive. The sales will be displayed in a datagrid. The executives can change
some fields like the address or phone numbers of clients, and they can add new
sales also. Which of the following will you prefer to use for this?
Answers:
• DataReader
• DataAdapter
• Command object's ExecuteNonQuery
• DataReader with Command object's
ExecuteNonQuery
• None of the above
59. A banking application is online.
As soon as Martin finished his session, Lisa logged on and did some banking.
The connection string created for each of them is as follows:
String ConnStr=
"Server=BankServer;Database=BankDB;User=Martin;Password=gilbo123;"
String ConnStr=
"Server=BankServer;Database=BankDB;User=Lisa;Password=kari75;"
Which of the following statements will
be correct in case the connection pooling is also switched on?
Answers:
• There is a possibility of Lisa using
the same connection object as created for Martin from the connection pool
• Lisa can not use someone else's
connection from the connection pool
• Lisa can pick any other idle
connection from the connection pool
• None of the above
60. Which of the following methods
ensures optimum use of Connection Pooling?
Answers:
• By using current user's login for
authentication and getting the connection
• By using a common account login for
authentication and getting the connection
• By using a current user's login for
authentication and using 'common account login' for getting the connection
• None of the above
61. You have defined a command named
'cmdA' and an open connection named 'con'. You created a new transaction:
Dim trans As SqlClient.SqlTransaction
= Nothing
How will you assign the command to the
transaction and begin the transaction?
Answers:
• cmdA.Transaction = trans
cmdA.ExecuteNonQuery()
• trans.BeginTransaction()
cmdA.Transaction = trans cmdA.ExecuteNonQuery()
• trans = con.BeginTransaction()
cmdA.Transaction = trans cmdA.ExecuteNonQuery()
• trans = con.OpenTransaction()
cmdA.Transaction(trans) cmdA.ExecuteNonQuery()
62. Read the following statements:
DataRow oDetailsRow =
oDS.Table["OrderDetails"].NewRow();
oDetailsRow["ProductId"] =
1;
oDetailsRow["ProductName"] =
"Product 1";
What is wrong with this code?
Answers:
• Table is not a collection of DataSet
• Name of the column can not be passed
in the Columns collection
• NewRow is not a method of the Tables
collection
• None of the above
63. Which of the following statements
is correct with regard to transaction?
Answers:
• A transaction can have multiple
command objects assigned to it
• A transaction can have only one
command object assigned to it
• One command object must be executed
before assigning another command to the transaction
• A transaction ends with
EndTransaction() on connection object
64. Which of the following statements
is incorrect with regard to a CommandBuilder object?
Answers:
• It creates insert, update, and
delete queries on the fly
• It creates efficient queries in
terms of performance
• A unique column must be selected as
a part of the select query
• It can't work with queries having
joins
65. You are developing a website that
has four layers. The layers are: user interface (web pages), business objects,
data objects, and the database. You want to pass data from the database to
controls on a web form. What should you do?
Answers:
• Populate the data objects with data
from the database. Populate the controls with values retrieved from the data
objects
• Populate the business objects with
data from the database. Populate the controls with values retrieved from the
business objects
• Populate the data objects with data
from the database. Populate the business objects with data from the data
objects. Populate the controls with values retrieved from the business objects
• Bind the controls directly to the
database
66. Two users, Monique and James are using
ADO.NET MIS system. The data refresh time in the system is set to 15 minutes.
James changed the mailing address of a customer named Majda, and updated the
database. Before database refresh, Monique also updated the same customers
address as per her pending requests folder. Monique and James are using
SqlCommandBuilder class for construction of SQL statements. What will happen
when Monique saves the changes?
Answers:
• Changes made by Monique will be
saved by the database
• Changes made by Monique will be
ignored and nothing unusual happens
• DBConcurrencyException will be
thrown
• DBException will be thrown
67. Premium Finance Corp is running a
home loans business. They are planning to create a website to automate the
business. An aspx page, Sales.aspx will show the sales made by an executive
through a datagrid. The data is not editable. Which of the following options
you will choose to extract data?
Answers:
• DataReader
• DataAdapter
• Command object's ExecuteScalar
• None of the above
68. Which of the following statements
is true with regard to DataRow and DataRowView?
Answers:
• The DataRowView object is a wrapper
for the reference to the DataRow object
• The DataRow object can be accessed
from a DataRowView
• Both are safe for multithreaded read
operations
• All of the above
69. BrainGrip has a class called
DBConnectivity. Every page of the site is using this class to get the
connection object. You are using SQL Server 2005.
Imports System.Data.OleDB
Imports System.Web
Namespace BrainGrip
Class DatabaseConnectivity
Private oConn As New OleDbConnection()
Public Function GetConnection(ByVal
sDbPath As String) As OleDbConnection
oConn.ConnectionString =
"Provider=Microsoft.jet.oledb.4.0;Data Source=" & sDbPath
oConn.Open()
GetConnection = oConn
End Function
End Class
End Namespace
When this class is compiled, it
produces an exception. Which part of the code would be the most likely cause of
the exception?
Answers:
• Imports System.Data.OleDB
• Class DatabaseConnectivity
• Private oConn As New
OleDbConnection()
• oConn.ConnectionString
• None of the above
70. Which of the following is not
correct about DataReader?
Answers:
• Provides a forward-only and
read-only row set of data from a data source
• Its CursorType property is
adOpenForwardOnly
• Its LockType property is
adLockReadOnly
• None of the above
71. Asynhronous execution is supported
in ADO.NET 2.0 for ExecuteReader, ExecuteScalar, and ExecuteNonQuery.
Answers:
• True
• False
72. Which of the following is capable
of returning multiple rows and multiple columns from the database?
Answers:
• ExecuteReader
• ExecuteXmlReader
• Adapter.fill
• All of the above
73. Read the following statement:
DataTable.Select (String, String)
Here, the first parameter accepts a
criteria for filtration, what does the second parameter do?
Answers:
• Specifies the sort order
• Accepts another criteria
• Specifies the column name which
should be searched
• Header of output
74. Read the following statements:
DataRow oDetailsRow =
oDS.Tables["OrderDetails"].Row();
oDetailsRow["ProductId"] =
1;
oDetailsRow["ProductName"] =
"Product 1";
What is wrong in this code?
Answers:
• The name of the table can not be
passed in the Tables collection
• The name of the column can not be
passed in the Columns collection
• Row is not a method of the Tables
collection
• None of the above
75. Which of the following options is
ideally suited for managing database connections?
Answers:
• Pass the open connection objects
between the methods
• Close the connection as soon as
database operation is done
• Open a global connection and keep on
using it without reopening
• Within a transaction, a connection
should be closed in each method and reopened in the other
76. Read the following statements:
Dim dr As DataRow
Dim objCustReader As
Data.SqlClient.SqlDataReader
Dim dtCustomers As DataTable
With dtCustomers.Columns.Add(New
DataColumn("Customer ID")
End With
What is wrong in above code?
Answers:
• Add is not a method of the Columns
collection
• Column collection should be used
instead of columns collection
• The Data Type of the column is a
required parameter of 'Add' method
• None of the above
77. When users edit data in your
program, the code runs to completion without error, but no data changes appear
in the database. You test the update query and the connection string that you
are passing to the procedure, and they both work correctly. What changes do you
need to make to your code to ensure that data changes appear in the database?
Answers:
• Add the following two lines of code
before calling the Update method: �� Dim cb As New
OleDb.OleDbCommandBuilder(da) ��
cb.GetUpdateCommand()
• Add the following line of code
before calling the Update method: ��
da.UpdateCommand.Connection.Open()
• Delete this line of code: ��
dataTable.AcceptChanges()
• Delete this line of code: ��
da.Dispose()
78. You have added some rows to the
existing datatable in the dataset. Which of the following methods would you
invoke?
Answers:
• DataSet.Merge(NewRows[])
• DataSet.Add(NewRows[])
• DataSet.AddRows(NewRows[])
• DataSet.Include(NewRows[])
79. Which of the following was not
among the main design goals behind ADO NET?
Answers:
• To provide seamless support for XML
• To support COM directly
• To provide an expandable and
scalable data access architecture for the revolutionary n-tier programming
model
• To extend the current capabilities
of ADO
80. Which of the following are invalid
values of a Dataset's SchemaSerializationMode property?
Answers:
• CreateSchema
• DeleteSchema
• IncludeSchema
• ExcludeSchema
• None of the above
81. You must create a stored procedure
to retrieve the following details for the given customer:
CustomerName, Address, PhoneNumber
Which of the following is an ideal
choice to get the result?
Answers:
• Return the result as dataset using
data adapter
• Return the result as dataset using
command object
• Return the result as three out
parameters and command object
• All of the above
82. Read the following statements:
OleDbDataAdapter
oOrderDetailsDataAdapter;
OleDbCommandBuilder
oOrderDetailsCmdBuilder = New
OleDbCommandBuilder(oOrderDetailsDataAdapter);
oOrderDetailsDataAdapter.FillSchema(oDS,
SchemaType.Source);
What is wrong in this code?
Answers:
• The parameters are incorrect for the
FillSchema method
• OleDbCommandBuilder has no
constructor
• oOrderDetailsDataAdapter has not
been instantiated
• None of the above
83. The DataSet object can extract
data from an XML file. The ReadXML method accepts the source as a parameter and
returns a value from the xmlReadMode enumeration. Which of the following is an
invalid option of XmlReadMode?
Answers:
• ReadSchema
• InferSchema
• IgnoreSchema
• Fragment
• DiffGramSchema
84. Which of the following command
types are provided by an oledb and sql provider?
Answers:
• StoredProcedure,Text, TableDirect
• StoredProcedure,Query, TableDirect
• Procedure,Text,Table,Query
• Procedure,Query, TableDirect
85. Which of the following are used
for database connections between SQL Server and ASP.NET?
Answers:
• SqlInfoMessageEvent
• SqlParameterCollection
• SqlRowUpdatingEvent
• SqlClientPermissionAttribute