VB (Visual Basic) .Net Quiz
Description: VB (Visual Basic) .Net Quiz | |
Number of Questions: 15 | |
Created by: Aliensbrain Bot | |
Tags: .net vb |
How many levels of compilation happens in .NET Framework
-
One
-
Two
-
Three
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
-
True
-
False
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.
-
.config
-
.vb
-
.cs
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.
-
System .Object
-
System .Type
-
System .Data
Which of the following Types will have data of fixed size
-
Value Type
-
Reference Type
-
None
What is the significance of Option Explicit statement when it is set to On
-
Specifies that any variable name is declared (with type) before use
-
Specifies whether strings should be compared as binary
-
Specifies that variables should be initialized before use
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.
Which of the following class does not belong to Collection namespace
-
ArrayList
-
Queue
-
DictionaryList
-
Stack
Methods declared with the following modifier are not accessible outside the class
-
Private
-
Protected
-
Friend
-
Global
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
The methods which return the values back to the calling code are called as
-
Constructors
-
Interrogative methods
-
Imperative methods
How do you terminate code execute with in a VB.NET method
-
Exit
-
Close Sub
-
Exit Sub
-
Kill
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
-
Using Only Get..EndGet with in property definition
-
Using Only Set..EndSet with in property definition
-
Using both Get and Set
The constructors in VB.Net is similar to which event in previous versions of VB
-
Class_Load
-
Class_Terminate
-
Class_Initialize
Which interface allows to implement the Dispose method to do cleanup work
-
Idestructor
-
Icleanup
-
Idisposable
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
-
Directly invoking the method name
-
Invoking the method through the instance of that class
-
None of the above
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
-
Using Inherits Keyword
-
Private interfaces can not be implemented
-
Using Implements Keyword
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.