A scoop of wisdom and a bottle of VB.NET questions

Yesterday, my boss asked me if i could prepare a set of questions that could specifically evaluate the exposure of a person to Visual Basic and .NET. Though at the first sight it looks like why we need to focus on VB, can't it be any programming language, OOP, Design Principles, some philosophy ? The answer looks like NO. I think that's where the difference is between 2005 and today, 2020. A lot of jobs in the software to me looks like adapting and using technologies that are quiet mature and does most of the work. The role of engineer is to use these technologies and if needed write some business logic in a procedure or function which doesn't warrant a great SOLID design (or) any known engineering principles, because those are already embedded into the tool / technology already and the point of customizations are well organized where we need to write some code. With this context, it looks like what we need from engineers to work on this is two things.

  1. Know the technology / platform that we use , it's uses and limitations. (e.x Airflow, PowerBI, Azure Data Factory, SQL Server Integration Services). Have a support plan that will help when we don't know things, LoL (This is becoming more and more common)
  2. If you have to customize, know the classes and methods that need to be used and some basics of the language to write the customization.

In this article i am going to focus on the customization part, where we want engineers to do the customization and for that they need to know how to achieve certain things in VB.NET.


  • What is option strict and option explicit ? When do you use them
  • What is a jagged array in VB.NET. When  will use you a jagged array. Given two jagged array create one jagged array without losing dimension and it's data.
  • Can you inherit one structure from another (struct data type). Does structure has any default base class ? Why in your opinion we need a structure at all. can't we have class to solve everything.
  • Does the following code work ? Don't look into syntax. Specifically about the statement where we compare the enum data myRainbow< yourRainbow. If it doesn't work , Why ? . If it works , Why ?
Public Enum Rainbow
End Enum

Dim myRainbow As Rainbow  
Dim yourRainbow As Rainbow  
myRainbow = Rainbow.Blue
yourRainbow = Rainbow.Violet
If myRainbow < yourRainbow Then
   //If succeeds
End If
  • Is the following program a valid construct. What should we do to make it a standard construct.  Discuss if Line 1 is valid, if yes, why.  In line 8 what would shared mean ?
1.   Public Class [Public]
2.     Public Shared Sub SayHello(  ) 
3.        Console.WriteLine("hello, world") 
4.     End Sub
5.   End Class
7.   Public Class SomeOtherClass
8.      Public Shared Sub SomeOtherMethod(  ) 
9.        [Public].SayHello( ) 
10.     End Sub
11.  End Class
  • How do you invoke the method in the following inner class. Can you write the piece of code to call thte SomeMethod.
Public Class OuterClass
   Public Class InnerClass 
      Public Sub SomeMethod( )  
         Console.WriteLine("Hello from SomeMethod!")
      End Sub
   End Class 
End Class
  • If a piece of VB code throws multiple exception, how will you wrap it inside a try, catch block. The code throws different exception types. Some exceptions are base class of other exceptions.
  • What is the differernce between OnErrorr and Structured Exception Handling

Object Oriented programming & Design

  • Create a abstract class using VB.NET. What are the constructs that we use.
  • Design a simple base and derived class in VB.NET with one method. The method must be overridden in the derived class. The derived class method should call the base class method as the first statement and run the statements in the derived method.
  • Implement a simple singleton design pattern in VB.NET. The code doesn't need to be multi-threaded. The singleton object must be accessible across all modules

.NET Framework

  • What is the difference between Dispose() and finalize method ?
  • If you are using a Hashtable data structure for storing a collection of objects, what are the important methods that need to be implemented on the object, that will form the collection ? What is the strongly typed equivalent of a hashtable ?


Question 1

Given a situation where you have to query two different databases and combine the results and return it, how will you do it in ADO.NET.
Example :
Database 1 -> Table 1 -> (id, name)
Database 2 -> Table 1 -> (id, address)
where id is the same value in both table. Write a method that uses ADO.NET classes to retrieve data  and return it as a List <Employee> where Employee class looks like the following
class Employee
int id;
string name;
string Address;

Validate the correctness of the solution.
Validate how errors are handled.
Validate on how objects are setup and disposed.
Validate how correct the solution is.

Question 2

Assume that the database has a table called Numbers, as follows.


Index Number
1 12
2 45
3 17
4 14
5 21

Implement the following function in VB.NET to sort the elements in the above table. The sort should be done only using database insert, delete and update statements in the database. The sort should not be in-memory.

public Function Sort()
/// Code to sort the entries in the table
End Function  

.NET Framework

  • What is garbage collection and why is it useful. Consider the following program. Will the program run without issues. What is the impact of running this in a 32-bit machine and 64-bit machine.
public Function Sort()
  Dim a as List<Double>
  Dim b as List<Int32>
For i = 1 to 2147483647
End Function  
  • What is CLR, what are the different functions of CLR ? When do we need CLR , is it during compile time (or) runtime ? In a machine, do we have an instance of CLR for every process (or) is it for only one process ?
  • What is JIT, and why do we need JIT in the first place. Can we disable the JIT process ? Is it an essential step (or) something that can be ignored ?
  • If all languages (vb, c#) are compiled to MSIL during compilation, can one dll have code written from multiple languages ? E.x Can one project have both c# and vb code ?