Tag: vb

Questions Related to vb

How do you create a Read only Property in VB.NET

  1. Using Only Get..EndGet with in property definition

  2. Using Only Set..EndSet with in property definition

  3. Using both Get and Set


Correct Option: A

The constructors in VB.Net is similar to which event in previous versions of VB

  1. Class_Load

  2. Class_Terminate

  3. Class_Initialize


Correct Option: C

Which interface allows to implement the Dispose method to do cleanup work

  1. Idestructor

  2. Icleanup

  3. Idisposable


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of resource cleanup in object-oriented programming.

Option A) Idestructor - This option is incorrect because the IDestructor interface does not exist in .NET or C#. A destructor is a special method used to clean up resources and is defined within a class, not an interface.

Option B) ICleanup - This option is incorrect because the ICleanup interface does not exist in .NET or C#. There is no predefined interface specifically for cleanup purposes.

Option C) IDisposable - This option is correct because the IDisposable interface in .NET allows a class to implement the Dispose method, which is responsible for releasing unmanaged resources such as file handles or database connections. The Dispose method is typically used for cleanup operations.

The correct answer is C) Idisposable. This option is correct because the IDisposable interface allows a class to implement the Dispose method for cleanup work.

How do you call non shared methods of a class

  1. Directly invoking the method name

  2. Invoking the method through the instance of that class

  3. None of the above


Correct Option: B
Explanation:

To call non-shared methods of a class, the user needs to know the concept of object-oriented programming and the difference between shared and non-shared methods. Non-shared methods are specific to an instance of a class, while shared methods are accessible by all instances of a class.

Now, let's go through each option and explain why it is right or wrong:

A. Directly invoking the method name: This option is incorrect because invoking a non-shared method directly through the method name will result in a compilation error. Non-shared methods require an instance of the class to be created first before they can be accessed.

B. Invoking the method through the instance of that class: This option is correct. To call a non-shared method, you need to create an instance of the class and then call the method through that instance. This allows the method to access the instance's specific data and perform actions specific to that instance.

C. None of the above: This option is incorrect because option B is the correct way to call non-shared methods.

Therefore, the answer is: B. Invoking the method through the instance of that class.

  1. Using Inherits Keyword

  2. Private interfaces can not be implemented

  3. Using Implements Keyword


Correct Option: B
  1. System.Runtime.Interopservices

  2. System.XML

  3. System. Data


Correct Option: A
  1. DataReader

  2. Dataset

  3. DataAdapter


Correct Option: B
Explanation:

To answer this question, the user should be familiar with the concept of typed datasets and their relationship to other classes in the .NET framework.

The correct answer is:

B. Dataset

Explanation:

In the .NET framework, the base class for typed datasets is the Dataset class. A typed dataset is a dataset that is derived from the Dataset class and includes additional features such as strongly-typed data tables and data columns.

A. DataReader is not the base class for TypedDataset. The DataReader class is used for reading data from a database and does not have a direct relationship to typed datasets.

C. DataAdapter is also not the base class for TypedDataset. The DataAdapter class is used for retrieving and updating data from a database, but it is not the base class for typed datasets.

Therefore, the correct answer is B. Dataset.