Scenario: You are working with an Oracle database and need to handle NULL values gracefully while reading data. Which method of the OracleDataReader would you use for this purpose?

  • GetValue, to retrieve the value from the database without considering if it's NULL or not, thus potentially causing errors if not handled properly.
  • HasRows, to check if the result set returned by the query contains any rows, which is unrelated to handling NULL values.
  • IsDBNull, to check if the value retrieved from the database is NULL, allowing for proper handling of NULL values in the application logic.
  • ReadNull, to explicitly read NULL values from the database, enabling better control over how they are handled in the application.
The IsDBNull method of OracleDataReader allows for seamless handling of NULL values by checking if a retrieved value is NULL before processing it further. This helps in avoiding runtime errors and ensures smooth execution of the application logic. Other methods like GetValue do not provide the same level of control over NULL values and may lead to unexpected behavior if not handled properly.

In ADO.NET, what does a Data Filter allow you to do with a DataView?

  • Aggregate rows
  • Filter rows
  • Group rows
  • Sort rows
A Data Filter in ADO.NET allows you to filter rows in a DataView based on specified criteria. This means you can display only the rows that meet certain conditions, such as those with specific values in certain columns or rows that satisfy a particular expression. Data Filters provide a way to customize the view of data and present only relevant information to the user.

Which ADO.NET class is commonly used to execute SELECT statements and retrieve data from a database?

  • SqlCommand
  • SqlConnection
  • SqlDataAdapter
  • SqlDataReader
The SqlDataAdapter class in ADO.NET is commonly used to execute SELECT statements and retrieve data from a database. It acts as a bridge between a dataset and a data source for retrieving and saving data.

To enable connection pooling, you need to set the "Pooling" attribute in the connection string to ___________.

  • FALSE
  • No
  • TRUE
  • Yes
The "Pooling" attribute in the connection string should be set to "True" to enable connection pooling. This allows the .NET framework to manage connection pooling efficiently.

In LINQ to Objects, is it possible to query in-memory collections like arrays and lists?

  • Depends on the Collection Size
  • No
  • Sometimes
  • Yes
Yes, LINQ to Objects enables querying in-memory collections such as arrays and lists. It provides a powerful and convenient way to manipulate data structures within the application's memory, offering functionalities like filtering, sorting, and projecting data from these collections.

Which namespace is commonly used for LINQ in C#?

  • System.Collections
  • System.Data
  • System.Linq
  • System.Xml
The System.Linq namespace is commonly used for LINQ in C#. It contains classes and interfaces that support LINQ query operations for various data sources such as collections, arrays, XML, and databases.

To add a new row to a DataTable, you can use the ___________ method.

  • AddNewRow()
  • CreateRow()
  • InsertRow()
  • NewRow()
The NewRow() method of the DataTable class is used to create a new DataRow with the same schema as the DataTable. This method creates a new DataRow instance but does not add it to the DataRow collection. It simply returns a reference to the new DataRow, which you can then manipulate and add to the DataTable using the Add() method.

In ADO.NET, how can you handle multiple result sets returned by a SELECT statement?

  • Using the SqlCommand.ExecuteReader() method
  • Using the SqlConnection.Open() method
  • Using the SqlDataAdapter.Fill() method
  • Using the SqlDataReader.NextResult() method
In ADO.NET, you can handle multiple result sets returned by a SELECT statement using the SqlDataReader.NextResult() method. This method advances the SqlDataReader to the next result set if available. It allows you to iterate through multiple result sets returned by the same command execution.

In LINQ to Entities, what is the purpose of the "Where" clause in a query?

  • Filters the sequence to include only elements that satisfy a specified condition
  • Groups the elements in the sequence by a specified key
  • Joins two sequences based on matching keys
  • Orders the sequence based on a specified key
The "Where" clause in a LINQ to Entities query is used to filter the sequence of entities to include only those elements that satisfy a specified condition. It allows you to specify conditions that must be met by the entities returned by the query, enabling precise data retrieval.

Scenario: You want to improve the performance of your ADO.NET application. What feature of ADO.NET can you leverage to reduce the overhead of opening and closing database connections?

  • Command Timeout
  • Connection Pooling
  • Data Binding
  • DataReader
Connection Pooling in ADO.NET helps in managing and reusing database connections, reducing the overhead of opening and closing connections frequently. It maintains a pool of connections that can be reused, thus improving application performance.