VB.Net Interview Questions
Looking to change your career or for a career in VB.Net? Then, you have landed up in the right place. As the organizations are involved in creating a wide range of applications as per the client requirements and satisfaction, there is a high demand for different technologies. With this, the requirement for professionals in the technologies has also gone higher than expected. Many opportunities are on the way for different technologies in the current era of living.
VB.Net is also one of the programming languages that is used for application development using the .Net framework. To attain the best career, we have curated the frequently asked interview questions in VB.Net which includes the question and answers in one place and helps you review at great ease. I am sure these questions will help you grab the opportunity by being successful in the interview. Let’s get started!
Q1) What do you know about VB.Net? Briefly explain.
Ans: Vb.net is referred to as one of the programming languages which is available in Visual Studio. Net. VB.Net also contains different features of visual basic, also called as an event-based programming language. VB.Net also includes the different object-oriented concepts. In simple terms, VB.Net is a programming language that is an extension of Visual Basic in order to make it compliant with the .Net Framework. Also, VB.Net is called a fully Object Oriented programming language which is different from Visual Basic and everything in VB.Net consists of only an object.
As it is compliant with the .Net Framework, VB.Net is flexible to make use of the different Framework Class Libraries that are provided by .Net Framework. VB.Net is used in order to create the software interface and codes by the programmers and is also referred to as the combination of the various components that are being used on the forms which also have some specific actions and attributes.
Q2) What do you understand by the term namespace? Can you tell us which namespace is recommended to use for accessing the data?
Ans: A namespace is referred to as an organized way of representing Classes, interfaces, Structures that are present in .NET language. Namespaces are hierarchically structured indexes of a class library,which are available to all .NET Languages. In simple terms, the namespace is used for grouping the classes logically. The System.Data namespace is the namespace that is used for the accessing and management of the data from the required data sources. This namespace deals only with the data from the database that is specified.
Do you want to Master VB.Net? Then enroll in "VB.Net Training" This course will help you to master VB.Net
Q3) What is an assembly? Why is it used? List out the different types of assembly?
Ans: An assembly is considered as one of the elements in the .NET application. It is also called the primary unit of all .NET applications. The assembly can be represented in two different file types. It can be either as a DLL or executable file. Assembly is of two different types. They are:
Private: A private assembly is normally used by a single application and it will be stored in the directory of the application.
Public: A public assembly is also called a shared assembly. A public assembly can be used by many applications.It will be stored in Global Assembly Cache(GAC) which is allowed to be shared by many applications
Q4) What do you know about garbage collection? List out the different types of generators in the garbage collectors?
Ans: Garbage collection is also called by another terminology named automatic memory management. Automatic memory management is responsible for the automatic recycling of memory which is dynamically allocated. Garbage collection will be performed by a Garbage collector which will be recycling the memory if it is proved that the memory will stay unused.
There are three different types of generations in garbage collectors.
Generation 0: The generation 0 garbage collector will help in identifying a newly created object which has never been marked for the collection.
Generation 1: The Generation 1 garbage collector will help in identifying an object that has been marked as a collection but has not been removed.
Generation 2: The Generation 2 garbage collector will help in identifying an object which has survived more than one sweep of the Garbage collector.
Q5) Briefly explain CLS and CTS?
CLS: CLS stands for Common Language Specification. CLS is referred to as a subset of CTS and it is used for uniting all languages under one single umbrella. CLs also extends to provide its extensible support to all the .NET language into a single unit.
CTS: CTS stands for Common Type System. CTS is used for communicating between the languages. For example, if VB has an Integer data type and C++ has a long data type and these data types will not be compatible with each other.
Q6) Briefly explain the differences between VB, VB.Net, C#?
Primary differences between C# and VB.Net:
The Optional Parameters are accepted in VB.Net, and also are not case sensitive, nothing will be used in order to release unmanaged resources, and also provide its support of both structured and unstructured error handling in VB.Net.
The Optional Parameters are not accepted in C# and are case sensitive, ‘Using’ is used in order to release the unmanaged resources along with the unstructured error handling.
Primary Differences between VB and VB.Net:
VB is referred to as a platform-dependent, backward-compatible, exception Handling by ‘On Error…..Goto’, Interpreted, It will not allow the development of multi-threaded applications.
VB.Net is considered as platform Independent however, VB.Net is not backward compatible, Compiler Language, Exception Handling by ‘Try….Catch’, it also allows the development of multi-threaded applications.
Q7) Briefly explain about the terms meta data and JIT?
Ans: Metadata: In simple terms, Metadata is considered as the data about the content of the data. The metadata is usually found in the catalog of libraries. In generic terms, metadata is used for analyzing data of databases and can also be used for other purposes as well.
JIT: JIT stands for Just in Time compiler. The JIT compiler can be used as a part of the runtime execution environment. There are three different types of JIT available and they are:
1.Pre-JIT: In the Pre-JIT, the compilation takes place at the time of deployment of an application.
2.Econo-JIT: The compilation takes place when methods are called during the runtime
3.Normal JIT: The normal JIT is responsible for performing the compilation of the called methods at runtime and they will get compiled when called for the first time.
Q8) Illustrate the differences between a dataset and recordset?
Ans: A DataSet is used for representing the complete relational database in the memory, in the form of tables, relations, and views.A DataSet is specifically designed to ensure that the work is performed without any continued connection to the original data source.The Data in a DataSet can be loaded in bulk, rather than being loaded on demand.A dataset does not include the concept of cursor types.
The DataSets do not maintain any current record pointer You can use For Each loops in order to move along with the data.You are allowed to store many edits in a DataSet, and also write them to the original data source in a single operation.
By using the Data set, you are allowed to retrieve data from databases like SQL Server , and Oracle and also help them in managing one dataset, with a recordset this doesn't seem to be not possible.
The dataset is represented using XML while the recordset will make use of COM.
Recordset will not be allowed to be transmitted on HTTP while Dataset is allowed.
Q9) Briefly explain about the different types of threading models n Vb.net?
Ans: There are different types of threading models that are available, let us look into the Threading models that are common to win32 based environments.
SingleThreaded: It includes only one thread within the process, and it is responsible for performing all the work for the process. The process must be patient to wait for the completion of the current execution of the thread before it can start performing another action.
Apartment Threading (Single Threaded Apartment): Apartment threading includes multiple threads within the application. In a single-threaded apartment (STA), each thread is associated in a separate apartment under the process. The process can have various numbers of apartments that are capable of sharing the data through a proxy. The application will be defining when and for how long the thread in each apartment should perform the execution. All the requests will be serialized through the Windows message queue such that only a single apartment is allowed to be accessed at a time and thus only a single thread will be executed at any one time.
Free Threading (Multi-Threaded Apartment): Free threaded applications are specifically limited to the different programming languages such as C++ until the release of Microsoft .NET. The free threaded/Multi-Threaded Apartment (MTA) model has a single apartment created under a process rather than multiple apartments. This single apartment is responsible for holding multiple threads rather than just a single thread. There is no requirement of a message queue because all of the threads are a part of the same apartment and are allowed to share data without any proxy.
The developer must ensure that thread synchronization as part of the coding to make sure that the threads will not simultaneously access the same resources.
Q10) What are Option Strict and Option Explicit?
Ans: .Net generally is flexible to provide its support for the implicit conversion of any data type. To ensure that the data loss does not take place during the data type conversion, Option Strict keyword is used. It makes sure of the compile-time notification of the different types of conversions.
Option Explicit is the keyword that is specifically used in a file in order to explicitly declare all the variables by using declare keywords like Public, Dim, Private or Protected. If an undeclared variable name is included, an error will definitely occur during the compile time.
Q11) Briefly explain the internal keyword and new keyword in the .Net framework?
INTERNAL Keyword: An INTERNAL keyword is referred to as one of the access specifiers which will be only visible in a given assembly, which would be in a DLL file. The Internal keyword is responsible for forming a single binary component and it will be visible throughout the assembly.
New Keyword: New keyword is basically used along with the constructor in which it could be used either as a modifier or an operator. If it is used as a modifier, it will be hiding the inherited members from the base class member. If it is used as an operator, it will be creating an object in order to invoke the constructors.
Q12) Define a hashtable?
Ans: Hashtable is considered as a set to be items that includes the key and value pairs. Keys are referred to as indexes and also a quick search can be performed for the values by searching using the keys.
Q13) Describe what Authentication and Authorization means? What are the types of Authentication?
Ans: Authentication is referred to the process of obtaining the credentials (Usernames and passwords) from the users and verify the user’s identity. Authorization is the process of providing access to authenticated resources. Authentication leads to Authorization. There are three types of Authentication and they are:
- Windows Authentication
- Forms Authentication
- Passport Authentication
Q14) What is CLR?
Ans: CLR stands for Common Language Runtime and it is referred to as the heart of the .NET framework. The primary responsibility of the runtime is to take care of the execution of the code in the program. CLR takes care of the following functionalities.
- Code Access Security
- Code Verification
- IL (Intermediate Language)
- Garbage Collection
Q15) Illustrate the differences between systems. String and System.StringBuilder classes?
Ans: System. string class is a non-updatable class and it is flexible to allow you to create a new string object instead of using or updating the same. Also, the updation in the same string object is possible for String. StringBuilder class. Hence, the operation on string builder is found to be faster and more efficient when compared to the string class.
Q16) What is a Delegate?
Ans: A delegate is referred to as an object that will be referring to a method. Once a delegate is assigned to a method, it will be behaving in the same way as that method.
Example: public delegate int perform multiplication(int a, int c);
Q17) What is meant by a nested class?
Ans: A nested class is a class that can be declared within the scope of another class. These nested classes are considered within the scope of an enclosed class and will be available within that scope or class.
Q18) What is the purpose of the Async keyword in VB.NET?
Ans: The Async keyword in VB.Net is used for indicating that the lambda expression or the method that it modifies is said to be asynchronous. Such methods are called as async methods. The caller of an async method is allowed to resume its work without waiting for the async method to complete.
Q19) What do you understand by the term Code Security?
Ans: The .NET framework is flexible and compatible to provide the security features in order to secure code from unauthorized users. There are two different types of security in .NET. They are:
Role-based security: Responsible for authorizing the user
Code access security: Ensures to provide protection to the system resources from the unauthorized calls
Q20) Which DLL can be used for Microsoft .NET runtime? How many classes a DLL can contain? Illustrate the differences between thread and process?
Ans: Mscoree.dll is the DLL that can be used for Microsoft .NET runtime. A DLL can contain an unlimited number of classes. A Thread is responsible for executing more than one program at a time while a Process is responsible for executing a single program at a time.
Q21) What is the difference between value and reference types?
Ans: Value types are used for storing the data directly and it will be allocated to the stack. Reference types will be storing a reference to the value’s memory address and will be allocated to the heap.
Q22) What is Globalization?
Ans: Globalization refers to the process of making an application internationalized and also includes localization of the application to other languages or cultures. The culture here refers to the combination of Language(English) and the location like the US or UK.
Q23) What is an Enumerator?
Ans: An Enumerator or Enum is referred to as a value type that consists of a set of constants that are given to the set of the list. Enumeration comes into the picture when the definition is required for more than one number.
Q24) What is the use of Option explicit?
Ans: Whenever the Option Explicit is termed as ON, the variable has to be compulsorily declared. If it is turned OFF, then the variables can be used without any declaration.
Q25) Illustrate the differences between Dispose and Finalize()?
Finalize (): The Finalize method is called by Garbage collector which allows us to make use of unmanaged resources. There are some other resources like window handles, database connections will be handled by iDisposable interface.
Dispose(): The Dispose method will be handled by IDisposable interface in order to explicitly release the unused resources. Dispose is also called even if the other references to the object are alive.
Q26) What is the ReDim keyword and briefly explain the purpose of using it?
Ans: A Redim keyword is exclusively used for arrays and it is used in order to make the changes to the size of one or more dimensions of an array that has already been declared. Redim keyword is also capable of freeing up or adding elements to an array whenever needed.
Q27) Illustrate the differences between classes and modules in VB.Net?
Ans: Modules are considered as the VB counterparts to C# static classes. When you design a class that is solely used only for the helper functions and extension methods and also you do not want to include inheritance and instantiation, you can then use a Module.
In simple terms, a Module is not really subjective and it’s not deprecated. You will need to use a module whenever it is required or it’s appropriate. .NET Framework itself uses the modules many times (System.Linq.Enumerable, for instance). In order to declare an extension method, it is recommended to use modules.
Modules are by no means deprecated and are most commonly used in the VB language. It is the only way for an instance to implement an extension method in VB.Net.
There is one significant difference that exists between Modules and Classes with Static Members. Any method that is defined on a Module will be globally accessible as long as the Module is available in the current namespace. A Module always allows you to define global methods. This is one scenario that a class with only shared members cannot do.
Q28) Briefly explain what is a jagged array in VB.Net?
Ans: A Jagged array is considered an array of arrays. Each and every entry in the array is another array that is capable of holding any number of items.
Q29) Briefly explain what is a deep copy?
Ans: A Deep copy refers to the creation of a new object and then copying the fields that are non-static of the current object to the new object.
Q30) What is TRACE in VB.Net?
Ans: A TRACE in VB.Net is providing the flexibility to allow the user to view how the code has been executed in detail. This tells you and helps you understand how the code is functioning.
By this time, you might have got an idea of the different questions being asked in the interview. I would definitely recommend reviewing once again if required and bookmark this article for your reference. I am sure you will grab a higher position as a professional in the near coming future. All the best!