Infosys VB .NET Technical Interview Questions and Answers
Infosys interviews often include questions from the Microsoft .NET stack, and while C# is more common, VB .NET is still relevant for projects where legacy codebases are maintained or migrated. If you are preparing for a VB .NET technical round at Infosys, expect a mix of fundamental concepts, OOPS principles, syntax-based queries, and real-world application scenarios.
Here is a complete set of Infosys VB .NET interview questions and answers to help you prepare with confidence.
1. Basic VB .NET Questions
Q1. What is VB .NET? How is it different from VB6?
VB .NET is an object-oriented programming language developed by Microsoft as part of the .NET framework. Unlike VB6, it:
-
Supports full OOPS concepts (inheritance, polymorphism, encapsulation).
-
Runs on the .NET CLR (Common Language Runtime).
-
Provides cross-language integration with other .NET languages like C#.
Q2. What are the main features of VB .NET?
-
Complete OOPS support.
-
Automatic memory management (Garbage Collection).
-
Exception handling support.
-
Event-driven programming.
-
Integration with ADO.NET for database operations.
Q3. What is the difference between Value Types and Reference Types in VB .NET?
-
Value Types (e.g., Integer, Boolean, Double) store data directly in memory.
-
Reference Types (e.g., String, Arrays, Objects) store references (addresses) pointing to memory locations.
Q4. What is the difference between Dim
, Static
, and Const
in VB .NET?
-
Dim
→ Declares a variable (lifetime depends on scope). -
Static
→ Variable retains its value between function calls. -
Const
→ Used to declare constants whose values cannot be changed.
Q5. How is error handling done in VB .NET?
VB .NET uses Try…Catch…Finally for structured error handling. Example:
Try
Dim x As Integer = 10 / 0
Catch ex As Exception
Console.WriteLine("Error: " & ex.Message)
Finally
Console.WriteLine("Execution completed")
End Try
2. Intermediate VB .NET Questions
Q6. What are Properties in VB .NET?
Properties are members that provide a controlled way of accessing class fields.
Private _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Q7. Explain the concept of Inheritance in VB .NET.
Inheritance allows a class to derive features from another class using the Inherits
keyword.
Class Animal
Public Sub Speak()
Console.WriteLine("Animal sound")
End Sub
End Class
Class Dog
Inherits Animal
End Class
Q8. What is the difference between Overloads
, Overrides
, and Overridable
keywords?
-
Overloads → Defines multiple methods with the same name but different parameters.
-
Overridable → Marks a method that can be overridden in a derived class.
-
Overrides → Used in a child class to provide a new implementation of a base class method.
Q9. What is the difference between ByVal
and ByRef
in VB .NET?
-
ByVal
→ Passes a copy of the variable (changes don’t affect the original). -
ByRef
→ Passes the actual reference (changes affect the original).
Q10. How does Garbage Collection work in VB .NET?
The CLR automatically manages memory by freeing objects that are no longer referenced. It uses generational garbage collection (Gen 0, Gen 1, Gen 2) to optimize performance.
3. Advanced VB .NET Questions
Q11. What are Delegates in VB .NET?
Delegates are object-oriented references to methods, similar to function pointers in C. They allow methods to be passed as parameters.
Delegate Sub PrintDelegate(ByVal msg As String)
Sub ShowMessage(ByVal msg As String)
Console.WriteLine(msg)
End Sub
Dim d As PrintDelegate = AddressOf ShowMessage
d("Hello Infosys")
Q12. What are Events in VB .NET?
Events are built on top of delegates and are used for communication between objects. Example: button click in Windows Forms.
Q13. What is the difference between Early Binding and Late Binding?
-
Early Binding → Object type is known at compile time. (faster, type-safe).
-
Late Binding → Object type is resolved at runtime using reflection.
Q14. Explain ADO.NET in VB .NET.
ADO.NET is a data access technology used to interact with databases.
-
Connected Architecture → Uses
SqlDataReader
. -
Disconnected Architecture → Uses
DataSet
andDataAdapter
.
Q15. How do you implement multithreading in VB .NET?
By using the System.Threading
namespace. Example:
Imports System.Threading
Sub PrintNumbers()
For i As Integer = 1 To 5
Console.WriteLine(i)
Next
End Sub
Dim t As New Thread(AddressOf PrintNumbers)
t.Start()
4. Real-World VB .NET Questions (Infosys Focused)
Q16. Write a VB .NET program to reverse a string.
Dim str As String = "Infosys"
Dim arr() As Char = str.ToCharArray()
Array.Reverse(arr)
Console.WriteLine(New String(arr))
Q17. Write a VB .NET program to check if a number is prime.
Dim n As Integer = 17
Dim isPrime As Boolean = True
For i As Integer = 2 To Math.Sqrt(n)
If n Mod i = 0 Then
isPrime = False
Exit For
End If
Next
Console.WriteLine(If(isPrime, "Prime", "Not Prime"))
Q18. How do you connect a VB .NET application to SQL Server?
Using SqlConnection
:
Imports System.Data.SqlClient
Dim con As New SqlConnection("Data Source=.;Initial Catalog=TestDB;Integrated Security=True")
con.Open()
Console.WriteLine("Connected to Database")
con.Close()
Q19. What is the difference between Windows Forms and Web Forms in VB .NET?
-
Windows Forms → Desktop-based applications.
-
Web Forms → Browser-based applications, run on IIS.
Q20. How do you implement Exception Handling in ADO.NET operations?
Always use Try…Catch…Finally
around database connections, and close connections in Finally
.
Final Thoughts
Infosys VB .NET interviews usually test how comfortable you are with OOPS concepts, ADO.NET for database access, error handling, and writing small working programs. If you’re preparing, focus on:
-
Core VB .NET syntax and keywords.
-
OOPS implementation (inheritance, polymorphism).
-
Database connectivity using ADO.NET.
-
Practical coding problems (string, arrays, math problems).
With consistent practice, you’ll be able to handle both theoretical and coding-based VB .NET interview questions with confidence.
Tags: Infosys VB .Net Technical Interview Questions And Answers