This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1Which of the following events is/are exposed by the Data table object?
Option D
In ADO.NET, the DataTable object represents an in-memory table of data. One of its powerful features is that it exposes events which allow you to monitor and respond to changes in its data. The main events include:
| EVENT NAME | TRIGGERED WHEN | USED FOR |
|---|---|---|
| RowChanging | Before a row is changed (added, modified, or deleted). | Allows validation or cancellation of changes before they are applied. |
| RowChanged | After a row has been successfully changed. | Perform tasks like logging or updating related data after a change. |
| RowDeleting | Before a row is deleted. | Allows checking or preventing deletion before it happens. |
| RowDeleted | After a row has been deleted. | Take actions after a row is removed. |
| ColumnChanging | Before a column value in a row is modified. | Allows validation or cancellation of the column change. |
| ColumnChanged | After a column value in a row has been modified. | Perform tasks after a column value is updated. |
| TableNewRow | When a new row is created in the table. | Initialize default values or perform setup when a new row is added. |
Q: 2Which of the following is not a feature of ADO.NET?
Option B
ADO.NET stands for ActiveX Data Objects .NET. It is a data-access technology in the .NET Framework that allows applications to connect to, retrieve, manipulate, and work with data from various data sources.
Some important characteristics associated with ADO.NET include interoperability, scalability, and maintainability. Reachability is not considered a standard feature of ADO.NET.
Characteristics of ADO.NET:
| Characteristic | Description |
|---|---|
| Interoperability | Allows applications to work with different data sources and technologies. |
| Scalability | Supports applications that need to handle increasing users, data, and workload. |
| Maintainability | Provides a structured approach that makes data-driven applications easier to develop and maintain. |
| Disconnected Data Access | Allows applications to work with data without maintaining a continuous connection to the database. |
| Data Accessibility | Provides classes and objects for connecting to, retrieving, and manipulating data from various sources. |
Q: 3What is the name of the .NET collection class that enables an element to be accessed using a unique key?
Option B
In .NET, Hashtable is a collection class that stores elements as key-value pairs. Each element can be accessed using a unique key rather than its numerical index.
For example, if employee records are stored with employee IDs as keys, a particular employee can be retrieved directly using that ID.
E.g.:
Hashtable employees = new Hashtable();
employees.Add(101, "Suresh");
employees.Add(102, "Banjara");
Console.WriteLine(employees[101]);
OUTPUT
Suresh
Here, 101 is the unique key, and "Suresh" is its associated value.
You have reached the end of this topic. Continue learning with the next topic below.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.