HomeProgrammingMost Commonly Asked Vb.Net Interview Questions & Answers

Most Commonly Asked Vb.Net Interview Questions & Answers

Best VB.NET interview questions you can be asked

(Last Updated: Sep. 2018) There are limitless opportunities for coders who know to program in Microsoft’s Visual Basic.NET. If you’re preparing for a VB.NET interview, we have compiled this list of most important vb.net interview questions for experienced as well as freshers. Master these VB net questions to crack your interview and acquire a bright career as a VB.NET developer.



We’ve categorized vb.net interview questions and answers as: for fresher and for experience coders for your convenience. But, especially if you are experienced, the interviewer may ask anything, even a fundamental question. So, make sure you practice all these interview questions on VB.NET.

VB.NET interview questions and answers for Re-Freshers

Q: Compare VB and VB.Net?


Object-based language True object-oriented language
Platform Dependent Platform Independent
Interpreter based Compiled language
Doesn’t support Multithreaded applications Support Multithreaded applications
Backward compatible  Not backward compatible
Exception Handling by ‘On Error…..Goto’ Exception Handling by ‘Try….Catch’

Q: Compare C# and VB.Net.


Doesn’t accept optional parameters Accepts optional parameters
Case sensitive Not case sensitive
‘Using’ to free unmanaged resources Nothing is used to free unmanaged resources
Unstructured error handling Support structured and unstructured error handling

Q: What are the benefits of using the VB.NET programming language?


  • It is totally object-oriented.
  • VB.Net handles pointers indirectly and helps develop more secure and stable applications.
  • Managed code execution runs under the Common Language Runtime (CLR) that results in robust and secure applications.
  • It supports optional parameters which make COM interoperability very easy.
  • In VB.NET, the CLR takes care of garbage collection. It releases resources as soon as an object is no more in use. So, developers need not worry about memory management.
Microsoft VB Net logo

Q: What is Object-Oriented Programming Approach?

A: Object Oriented Programming (OOP) divides programs into modules by creating partitioned memory area for functions and data that can be used as templates for creating copies of those modules when required.

OOP approach allows decomposition of a problem into numerous entities called Objects. It then builds data and functions around these objects.

Q: What is the difference between a class and an object?

A: A class is the definition of an object. It describes all properties, states, methods and behaviors of all objects defined within a class.

Object is an instance of a class. There can be multiple instances of objects based on the one class with different properties.

Q: What is the entry point method of VB.NET program?

A: Public Sub Main() indicates the entry point of VB.Net program.

Q: Explain Listbox, ComboBox, and PictureBox controls.

A: ListBox control represents a Windows control to display a list of items.

ComboBox control represents a Windows combo box control.

PictureBox control represents a Windows picture box control to display an image.

Q: What is the use of assembly?

A: An assembly is an element of a .NET application and often known as a primary unit of all .NET applications. The assembly can be either DLL or executable file.

Q: Explain different types of assembly.

A: There are two types of assembly: Private and Public.

Private – A single application normally uses a private assembly. Private Assembly is saved in the application’s directory with a strong name.

Shared – A shared or public assembly is stored in the Global Assembly Cache (GAC) with a strong name. It can be shared and used by multiple applications.

Q: What is a strong name in .NET assembly?

A: Strong Name is used to identify shared assembly uniquely. With Strong Name, developers don’t need to create a different object with the same name. Strong Name can be assigned using Sn.exe.

Q: What are the shared methods and shared variables?

A: One can invoke Shared Methods without creating an object of the class.

The shared method declares shared variables, which is not associated with any specific instance of a class or structure. It is available to all instances of the class or structure.

Q: What are Option Strict and Option Explicit in .Net Framework?

A: .NET allows implicit conversion of any data types. To prevent data loss during this conversion, Option Strict keyword is used to ensure compile-time notification of data type conversions.

Option Explicit keyword is used in a file to explicitly declare all variables using declare keywords like Public, Dim, Private, or Protected.

Q: What is the INTERNAL keyword in.Net Framework?

A: INTERNAL keyword is an access specifier which forms a single binary component and remains visible throughout a given assembly in a DLL file.

Q: In how many ways a function can return value in VB.NET?

A: A function can return a value to its calling code in two ways −

  • Using the return statement.
  • Assigning the value to the function name.

Q: Is it possible to create a function in VB.NET that can accept a varying number of arguments?

A: The params keyword is used to specify a method parameter which accepts a varying number of arguments.

Q: What is a nested class?

A: A nested class is a class declared within another class. Nested classes are considered and used within the scope of the class in which it is nested.

Q: What is Delegate?

A: A delegate is an object that can refer to a method. When a delegate is assigned to a method, it behaves exactly like that method.

Q: Write down a query to display student IDs with maximum marks in two subjects


Select stu_id from table1 where sub1=(select max(sub1)from table1)and sub2=(select max(sub2)from table1)

Q: Write down the source code to display the picture in a button click event.

A: Suppose, we want to display a GIF image of the Football World Cup 2018, then the code will be:

PictureBox1.Image = Image.FromFile(“C:worldcup18_football.gif”)

Q: What is JIT?

A: JIT stands for Just in Time Compiler. It is used as a part of the runtime execution environment.

There are three types of JIT in VB.NET:

Pre-JIT: Compiles during the application deployment.

Normal: Compiles called methods at runtime for the first time

Econo-JIT: Compiles called methods

Q: What is Late Binding and Early Binding?

A: Late Binding is runtime binding. Early binding is compile-time binding as compilation is done before executing an application.

Q: What is the difference between exit() and end() and how do we use them?


Exit() is used to exit from the loop.

End() stops the execution of the page, function, or procedure in which it is declared.

Q: Explain the difference between DataSet and DataTable.

A: Dataset can store multiple tables, but a data table can store one table only.

Q: What is TRACE class in VB.Net?

A: TRACE class allows users to view the code execution process in detail. It helps coders to know how the code is working. It is used for debugging and bug fixing.

VB.NET interview questions and answers for Experienced

Q: What is the difference between Server-side and Client-side code?

A: Server-side code executes on the server. It happens by submitting the page. Events triggered by the specified controls are executed on the server side.

And, the client-side code executes in the clients’ browser without submitting the page.

For example, in ASP.NET, a web control, like asp: button, the click event of the button executes on the server. Hence, the event handler for this click event is a part of the server-side code.

We can also attach client-side events, like JavaScript events, to be executed in the client’s browsers.

Q: How will you implement inheritance using VB.NET/C#?

A: To implement a class using inheritance, we start with an existing class from which we drive the new, inherited subclass. This existing or base class can be a part of the .NET system class library framework, some other application, or .NET assembly. We can also create it as a part of our existing application.

Once we get a base class, we implement one or more subclasses. Each subclass automatically inherits all methods, events, and properties of its base class. We can add new, unique methods, events and properties to the base class to extend its functionality.

A subclass can replace the methods and properties of the base class with its own new ones. It results in overriding the original behavior of the base class with new behavior.

In VB.NET, we can use implements keyword for inheritance and in C#, we use the sign (::) between subclass and base class.

Q: How will you store and retrieve images in SQL server database through VB.net?

A: Image files can be stored on SQL server in the form of a byte. So, the image is converted to a byte stream using the IO. Memory Stream. You can save this stream of the byte in a table with image data type.

Q: Differentiate Web.Config and Machine. Config.

A: The settings in the web.config file are applied only to that particular web application. On the other hand, the settings of the machine.config files are applied to the entire asp.net application.

Q: Define a read-only property in a class module.


Public Class YourClass
Private username As String
Private yourNumber As Decimal

Public Sub New(breed As String)
yourName = breed
End Sub

Public ReadOnly Property Name() As String
Return yourName
End Get
End Property

Q: What is Garbage Collection?

A: Garbage Collection is an automatic memory management procedure used for automatic recycling if dynamically allocated memory. It is performed by Garbage collector which recycles memory if it is proven that memory will be unused.

Q: Explain different types of generations in the garbage collector.

A: There are three types of generation in a garbage collector:

Generation 0 –Identifies a newly created object that has been never marked for collection.

Generation 1 –Identifies an object which has been marked as a collection but not removed.

Generation 2 – Identifies an object that has faced multiple sweeps of Garbage collector.

Q: Differentiate between Dispose and Finalize().

A: Finalize method is used to free unmanaged recourses held by an object before the object is destroyed. It belongs to Object class and is called by Garbage Collector. There are performance costs associated with Finalize method since it doesn’t clean the memory immediately and called by GC automatically.

Dispose method is used for releasing unmanaged resources whenever required. It belongs to IDisposable Interface. It is triggered by user code and the class which is implementing dispose of method. There are no performance costs associated with Dispose method.

Q: Explain jagged array in VB.Net with an example.

A: In short, a jagged array is an array of arrays.

Each entry in the jagged array is another array that can hold any number of items.

We use the following code to declare a jagged array named ‘grades’ of six Integers:

Dim grades As Integer()() = New Integer(6)(){}

Q: What is the Difference between System.String and System.StringBuilder classes?

A: System.string is a non-updatable class. It creates a new string object instead of updating the same.

System.StringBuilder class lets you updated the same string object.

Q: Differentiate between int and int32.

A: Int32 represent 32-bit signed integer whereas it is not a keyword used in VB.Net.

Q: What is the hashtable in VB.Net?

A: Hashtable is a set of items, each with a key/value pair. Keys serve as indexes and are used to perform a quick search for any value on the hashtable.

Q: How do you cast in VB.NET? Are all of the following similar?



CType(var, String)

DirectCast(var, String)

TryCast(var, String)

A: No, all of these are slightly different.

TOSTRING()gives you the string representation of an object, regardless of its type. Use this cast if var is not a string already.

CSTR(var)is the VB string cast operator. It is basically the same as CType.

CTYPE(var, String) converts the given type into a string, using the provided conversion operators.

DIRECTCAST(var, String) up-casts an object into a string. Use it for an object variable that is a string. It’s the same as (string)var in C#.

TryCast(var, String) is like DirectCast, but it returns nothing if the variable is not convertible into a string, instead of throwing an exception. It’s the same as var as a string in C#.

Q: Explain how to remove Handlers at Runtime.

A: Remove Handler myobj.myEvent, AddressOf MyEventHandler

Q: What do you mean by Serialization and Deserialization and its use?

A: Serialization is the process to store the vb.net for data into an XML file. DeSerialization is the process of loading data from XML file to vb.net form.

Q: What is  namespace and how it is used for accessing the data?

A: Namespace is an organized representation of Class, Structures and interfaces in .NET language. Namespaces are a hierarchically structured index of a class library, available to all .NET Languages.

System.Data namespace is used for accessing data from the required data source. This namespace accesses and manages the data only from the specified database.

Q: How do we create a constant in VB.NET?

A: Using the Const statement.

The Const statement is used at module, class, structure, procedure, or block level to be used in place of literal values.

Q: What LINQ is?

LINQ stands for Language Integrated Query and came with Visual Studio 2008. It is a set of features, which adds new standard query operators to allow data manipulation regardless of the data source and extends query capabilities to the .NET language syntax. In short, it bridges the gap between objects and data.

Q: Explain INTERNAL keyword in .Net Framework.

A: INTERNAL keyword is an access specifier that is visible in a given assembly that is, in a DLL file. It creates a single binary component and remains visible throughout the assembly.

Q: What is the use of Name keyword?

A: New keyword is used with the constructor that allows it to be used as a modified or an operator. When used as a modifier, it hides inherited member from the base class member. And, when used as an operator, it forms an object that invokes the constructor.

Dim frm As New Form1 frm.show()

Q: Explain ReDim keyword.

A: Redim keyword is exclusively used to change the size of dimensions of any declared arrays. It can free up or add elements to an array whenever required.

For example:

Dim intArray(8, 8) As Integer

ReDim Preserve intArray(8, 9)

ReDim intArray(8, 8)

Q: What is Manifest?

A: A Manifest is a text file used to store metadata of .NET assemblies. We can save the Manifest File type as a type PE. Assembly Name, Culture, Version and the key token can be stored as a Manifest.

Bonus Tips:

Further go through your past VB.NET assignments and practice as much as you can. If you are a fresher, the interviewer will not ask very complex questions. Just make your basic concepts very strong. Second, be confident during the interview.

Good luck!

(Below are some more references that have great Q & A if you need more practice)


I started out going to college for Business administration but soon found out that Coding would be a great way to have a sustainable career! I made coder's eye as my personal journey on learning how to code and sharing my Findings along the way. My vision with CE now is to be a way to help beginners that want to learn code but don't know where to start.