0

VB (Visual Basic) .Net Quiz

Description: VB (Visual Basic) .Net Quiz
Number of Questions: 15
Created by:
Tags: .net vb
Attempted 0/15 Correct 0 Score 0

How many levels of compilation happens in .NET Framework

  1. One

  2. Two

  3. Three


Correct Option: B

AI Explanation

To answer this question, we need to understand the compilation process in the .NET Framework.

The .NET Framework uses a two-step compilation process.

The first step is the compilation of source code into an intermediate language (IL) known as Microsoft Intermediate Language (MSIL) or Common Intermediate Language (CIL). This step is performed by the compiler, which converts the source code into IL instructions.

The second step is the Just-In-Time (JIT) compilation, which occurs at runtime. The IL code is compiled into machine code specific to the target platform. This compilation is performed by the Common Language Runtime (CLR), which is responsible for executing .NET applications.

Therefore, the correct answer is B) Two, as there are two levels of compilation in the .NET Framework.

Most of the underlying integration of .NET is done through XML

  1. True

  2. False


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) True - This option is correct. In the .NET framework, XML is commonly used for various purposes, including configuration files, data exchange, and serialization. XML is used extensively for integration purposes in .NET applications.

Option B) False - This option is incorrect. XML is indeed used for the underlying integration of .NET.

The correct answer is A) True. This option is correct because XML is widely used for integration in the .NET framework.

An Assemblyinfo file in a VB.NET project will have blank as file extesion.

  1. .config

  2. .vb

  3. .cs


Correct Option: B

AI Explanation

To answer this question, we need to understand the purpose of an Assemblyinfo file in a VB.NET project and the file extension it typically has.

The Assemblyinfo file is a metadata file that contains information about an assembly, such as its version number, copyright information, and other assembly attributes. This file is automatically generated when you create a new VB.NET project.

In a VB.NET project, the Assemblyinfo file has the file extension ".vb". This file contains VB.NET code that specifies the assembly attributes for the project.

Let's go through each option to understand why it is correct or incorrect:

Option A) .config - This option is incorrect because the .config file is used for configuration settings and is not specific to the Assemblyinfo file.

Option B) .vb - This option is correct because the Assemblyinfo file in a VB.NET project has the file extension ".vb". This file contains the assembly attributes in VB.NET code.

Option C) .cs - This option is incorrect because the .cs file extension is used for C# source code files, not VB.NET Assemblyinfo files.

The correct answer is Option B. The Assemblyinfo file in a VB.NET project will have the file extension ".vb" because it contains VB.NET code for assembly attributes.

Every type supported by CTS is derived from

  1. System .Object

  2. System .Type

  3. System .Data


Correct Option: A

AI Explanation

To answer this question, you need to understand the inheritance hierarchy in C#.

In C#, all types are derived from the System.Object class. This means that every type supported by the Common Type System (CTS) in C# is ultimately derived from System.Object.

Let's go through each option to understand why it is correct or incorrect:

Option A) System.Object - This option is correct because all types in C# are derived from System.Object.

Option B) System.Type - This option is incorrect. While System.Type is a class in C# that represents type information, it is not the base class for all types.

Option C) System.Data - This option is incorrect. System.Data is a namespace in C# that contains classes related to data access, but it is not the base class for all types.

The correct answer is A) System.Object. This option is correct because all types in C# are derived from System.Object.

Which of the following Types will have data of fixed size

  1. Value Type

  2. Reference Type

  3. None


Correct Option: A

What is the significance of Option Explicit statement when it is set to On

  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

AI Explanation

To answer this question, we need to understand the significance of the "Option Explicit" statement and what it does when set to "On".

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

This option is correct. When the "Option Explicit" statement is set to "On", it requires that all variables be explicitly declared with a specific data type before they are used. This helps to prevent typographical errors and ensures that variables are properly defined before use. If a variable is used without being declared, it will result in a compile-time error.

Option B) Specifies whether strings should be compared as binary:

This option is incorrect. The "Option Explicit" statement does not affect how strings are compared. It is used for enforcing variable declaration, not for string comparisons.

Option C) Specifies that variables should be initialized before use:

This option is incorrect. The "Option Explicit" statement does not enforce variable initialization. It only enforces variable declaration, ensuring that variables are declared before they are used.

Therefore, the correct answer is option A) Specifies that any variable name is declared (with type) before use.

  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

How do you terminate code execute with in a VB.NET method

  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.

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.

How do we implement private interfaces

  1. Using Inherits Keyword

  2. Private interfaces can not be implemented

  3. Using Implements Keyword


Correct Option: B

AI Explanation

To answer this question, you need to understand how interfaces work in programming.

In most programming languages, an interface is a contract that defines a set of methods that a class must implement. These methods can be accessed by other classes that use the interface. However, an interface itself cannot be instantiated, meaning you cannot create an object of an interface type.

In the context of private interfaces, it is important to note that the concept of private interfaces may vary depending on the programming language. Some languages may not support private interfaces at all, while others may have different mechanisms to achieve the desired level of privacy.

Now let's go through each option to understand why it is correct or incorrect:

Option A) Using Inherits Keyword - This option is incorrect because the "inherits" keyword is typically used for class inheritance, not for implementing interfaces.

Option B) Private interfaces cannot be implemented - This option is correct because in many programming languages, interfaces are meant to be public contracts that define the methods a class must implement. The concept of private interfaces, where only certain classes can implement them, is not supported in many languages.

Option C) Using Implements Keyword - This option is incorrect because the "implements" keyword is typically used to indicate that a class is implementing an interface. However, the concept of private interfaces, where only certain classes can implement them, is not supported in many languages.

Therefore, the correct answer is B) Private interfaces cannot be implemented. This option is correct because in many programming languages, interfaces are meant to be public contracts and cannot be made private.

- Hide questions