SQL Server Questions and Answers – ADO.NET

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “ADO.NET”.

1. To use the .NET Framework Data Provider for SQL Server, an application must reference the _____________ namespace.
a) System.Data.Client
b) System.Data.SqlClient
c) System.Data.Sql
d) None of the mentioned
View Answer

Answer: b
Explanation: System.Data.SqlClient provides access to versions of SQL Server, which encapsulates database-specific protocols.

2. Point out the correct statement.
a) Using the System.Data.SqlClient, you can fill a memory-resident DataSet that you can use to query and update the database
b) System.Data.SqlClient includes a tabular data stream (TDS) parser to communicate directly with SQL Server
c) SqlBulkCopyColumnMapping lets you efficiently bulk load a SQL Server table with data from another source
d) None of the mentioned
View Answer

Answer: b
Explanation: The.NET Framework Data Provider for SQL Server describes a collection of classes used to access a SQL Server database in the managed space.

3. Valid Code for Creating a SqlConnection Object would be ____________
a)

advertisement
advertisement
SqlConnection conn = NEW SqlConnection(
   "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

b)

SqlConnect conn = NEW SqlConnection(
   "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

c)

advertisement
SqlConnection conn = NEW SqlConnect(
   "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

d) All of the mentioned
View Answer

Answer: a
Explanation: A SqlConnection is an object, just like any other C# object. The SqlConnection object instantiated above uses a constructor with a single argument of type string.
advertisement

4. Code snippet for having a named instance of SQL Server would be ___________
a) “Server=localhost\sqlexpress”
b) “Server=local\sqlexpress”
c) “Server=host\sqlexpress”
d) “Ser=localhost\sqlexpress”
View Answer

Answer: a
Explanation: An instance of the SqlConnection class in .NET Framework is supported by the Data Provider for SQL Server Database.

5. Point out the wrong statement.
a) The goal of dotConnect for SQL Server is to enable developers to maintain database applications
b) dotConnect for SQL Server combines connected and disconnected data access models in single SqlDataTable component
c) dotConnect for SQL Server supports new ADO.NET features and technologies as soon as they are released
d) None of the mentioned
View Answer

Answer: a
Explanation: The goal of dotConnect for SQL Server is to enable developers to write efficient and flexible database applications. The dotConnect for SQL Server assemblies are implemented using optimized code and advanced data access algorithms.

6. Which of the following is enumeration for ADO.net with SQL Server?
a) SqlInfo
b) SqlBulkCopyOptions
c) SqlNotification
d) All of the mentioned
View Answer

Answer: b
Explanation: Bitwise flag that specifies one or more options to use with an instance of SqlBulkCopy.

7. Syntax for closing and opening the connection in ADO.net is _______________
a) sqlConn.Open() and sqlConn.close()
b) sqlConn.open() and sqlConn.Close()
c) sqlConn.Open() and sqlConn.Close()
d) none of the mentioned
View Answer

Answer: c
Explanation: The Close method rolls back any pending transactions and releases the Connection from the SQL Server Database.

8. Which of the following gives trusted Connection from a CE device?
a)

connetionString="Data Source=ServerName; 
Initial Catalog=DatabaseName;Integrated Security=SSPI;
User ID=myDomain\UserName;Password=Password;

b)

connetionString="Data Source=ServerName; 
Integrated Security=SSPI;User ID=myDomain\UserName;P
assword=Password;

c)

connetionString="Data Source=ServerName; 
Initial Catalog=DatabaseName;User ID=myDomain\UserName;
Password=Password;

d) All of the mentioned
View Answer

Answer: a
Explanation: Code snippet will work only on CE device.

9. The main features of dotConnect for SQL Server includes ___________
a) Extra data binding capabilities
b) Ability of monitoring query execution
c) Supports the latest versions of SQL Server
d) All of the mentioned
View Answer

Answer: d
Explanation: dotConnect for SQL Server includes base-class-based provider model, provider factories, connection string builder, metadata schemas, asynchronous commands, pooling enhancements, batch update support, provider-specific types, server enumeration, database change notification support and so on.

10. __________object is used to fill a DataSet/DataTable with query results in ADO.net.
a) DataReader
b) Dataset
c) DataAdapter
d) DataTables
View Answer

Answer: c
Explanation: A DataAdapter object can be thought of as the adapter between the connected and disconnected data models.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.