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
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
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)
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)
SqlConnection conn = NEW SqlConnect( "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");
d) All of the mentioned
View Answer
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.
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
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
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
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
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
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
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
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.
- Check SQL Server Books
- Practice Programming MCQs
- Check Information Technology Books
- Apply for Programming Internship