Tag: .net

Questions Related to .net

Which of the following Types will have data of fixed size

  1. Value Type

  2. Reference Type

  3. None


Correct Option: A
  1. Specifies that any variable name is declared (with type) before use

  2. Specifies whether strings should be compared as binary

  3. Specifies that variables should be initialized before use


Correct Option: A
  1. ArrayList

  2. Queue

  3. DictionaryList

  4. Stack


Correct Option: C
  1. Private

  2. Protected

  3. Friend

  4. Global


Correct Option: A
Explanation:

To answer this question, the user needs to know about access modifiers in object-oriented programming and their purpose in controlling the scope of class members.

A. Private: This option is correct. Private methods are only accessible within the class they are declared in. They cannot be accessed by other classes, even if they inherit from the same parent class.

B. Protected: This option is incorrect. Protected methods are accessible within the class they are declared in and any subclasses that inherit from the parent class. They cannot be accessed by external classes.

C. Friend: This option is incorrect. Friend methods are a C++ specific feature that allow one class to access the private members of another class. They are not available in other programming languages.

D. Global: This option is incorrect. Global methods are available to all classes and can be accessed from anywhere in the program.

Therefore, the answer is: A

  1. Constructors

  2. Interrogative methods

  3. Imperative methods


Correct Option: B
  1. Exit

  2. Close Sub

  3. Exit Sub

  4. Kill


Correct Option: C
Explanation:

To terminate code execution within a VB.NET method, you can use the "Exit Sub" statement.

Explanation of options:

A. Exit: The "Exit" keyword is used to exit a loop or block of code, but it cannot be used to terminate a method. It is not the correct option in this scenario.

B. Close Sub: This is not a valid statement in VB.NET. It is not the correct option.

C. Exit Sub: The "Exit Sub" statement is used to immediately exit from a subroutine (method) in VB.NET. It allows you to terminate the execution of the method and return control to the calling code. This is the correct option.

D. Kill: The "Kill" statement is used to delete a file in VB.NET and is not related to terminating code execution within a method. It is not the correct option.

Therefore, the correct answer is: C. Exit Sub

  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.

  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.