Top VB.Net Interview Questions & Answers


1. What is Metadata?
Metadata is termed as “Data about content of the data” and it is found in the catalog of libraries. Practically, it is used at back side of book to see the necessary topic.

2. What is the difference between VB and VB.Net?
Following are the differences between VB and VB.Net:
VB
VB.Net
Platform dependent
Platform Independent
VB is backward compatible
VB.Net is not backward compatible
Interpreted
Compiler Language
Exception Handling by ‘On Error…..Goto’
Exception Handling by ‘Try….Catch’
Cannot develop multi-threaded applications
Can develop multi thread applications


3. What is the difference between C# and VB.Net?
    Following table gives differences between C# and VB.Net:
VB.Net
C#
Optional Parameters are accepted
Optional Parameters are not accepted
Not case sensitive
Case Sensitive
Nothing is used to release unmanaged resources
‘Using’ is used to release unmanaged resources
Support of Both structured and unstructured error handling
Unstructured error handling

4. What is namespace?
    A namespace is an organized way of representing Class, Structures and interfaces present in .NET language. Namespaces are hierarchically structured index of a class library, available to all .NET Languages.               

5. Which namespace are used for accessing the data? 
System.Data namespace is used for accessing and managing data from the required data source. This namespace deals only with the data from the specified database. 

6. What is JIT?
    JIT is termed as Just in Time compiler which is used as a part of runtime execution environment. There are three types of JIT and they are:
·          Pre-JIT – Compiles at the time of deployment of an application
·          Econo-JIT – Compiles called methods at runtime
·          Normal JIT – Compiles called methods at runtime and they get compiled first time when called 

7. What is an assembly and its use?
    An assembly is one of the elements of a .NET application and it termed as a primary unit of all .NET applications. This assembly can be either DLL or executable file.

8. What is strong name in .NET assembly?
Strong Name is an important feature of .Net and it is used to identify shared assembly uniquely. Strong name has solved the problem of creating different object with same name and it can be assigned with the help of Sn.exe.
9. What are the different types of assembly?
There are two types of assembly –
·          Private – A private assembly is normally used by a single application and it is stored in application’s directory.
·          Public – A public assembly or shared assembly is stored in Global Assembly Cache(GAC) which can be shared by many applications 

10. What is the difference between Namespace and Assembly?
Assembly is physical grouping of all units and Namespace logically groups classes. Namespace can have multiple assemblies.
11. What is INTERNAL keyword in .Net Framework?
INTERNAL keyword is one of the access specifier which will be visible in a given assembly i.e. in a DLL file. This forms a single binary component and it is visible throughout the assembly. 

12. What are Option Strict and Option Explicit?
.Net generally allows implicit conversion of any data types. In order to avoid data loss during data type conversion, Option Strict keyword is used and it ensures compile time notification of these types of conversions.
Option Explicit is the keyword used in a file to explicitly declare all variables using declare keywords like Dim, Private, Public or Protected. If undeclared variable name persists, an error occurs at compile time.
13. What is the use of New Keyword?
New keyword is used with the constructor in which it can be used as a modifier or an operator. When it is used as a modifier, it hides inherited member from the base class member. When it is used as an operator, it creates an object to invoke constructors.
1
Dim frm As New Form1 frm.show()

14. What is ReDim keyword and its use?
Redim keyword is exclusively used for arrays and it is used to change the size of one or more dimensions of an array that has been already declared. Redim can free up or add elements to an array whenever required.


Dim intArray(7, 7) As Integer
ReDim Preserve intArray(7, 8)
ReDim intArray(7, 7)

15. What is jagged array in VB.Net?
             Jagged array is nothing but an array of arrays. Each entry in the array is another array that can hold any number of items.
16. What is Manifest?
A Manifest is a text file that is used to store metadata information of .NET assemblies. File type of Manifest can be saved as a type PE. Assembly Name, Version, Culture and key token can be saved as a Manifest.
17. What are all the differences between Dispose and Finalize()?
Finalize method is called by Garbage collector which helps us to make free of unmanaged resources. There are some other resources like window handles, database connections are handled by iDisposable interface.
Dispose method is handled by IDisposable interface to explicitly release unused resources. Dsipose can be called even if other references to the object are alive.
18. What is Garbage Collection?
Garbage collection is also known as automatic memory management, which is used for automatic recycling of dynamically allocated memory. Garbage collection is performed by Garbage collector which will recycle memory if it is proven that memory will be unused.
19. What are the types of generations in garbage collector?
There are three types of generations in garbage collector.
Generation 0 – This identifies a newly created object that has been never marked for collection.
Generation 1 – This identifies an object which has been marked as collection but not removed.
Generation 2 – This identifies an object that has survived more than one sweep of the Garbage collector.
20. What is the use of Option explicit?
Variable must be compulsorily declared when the Option Explicit is termed as ON. If it is OFF, variables can be used without declaration.
21. What is the difference between System.String and System.StringBuilder classes?
System.string class is non-updatable and it will create new string object instead of updating the same. But updation in the same string object is possible for String. Stringbuilder class. So, the operation on string builder is faster and efficient than the string class.
22. What is the difference between int and int32?
Int32 represent 32-bit signed integer whereas int is not a keyword used in VB.Net. 
23. What is hashtable?
Hashtable is set to be items with key and value pairs. Keys are referred as indexes and quick search can be performed for values by searching through the keys.
24. What are nested classes?
A class that can be declared within the scope of another class. These classes are considered within the scope of the enclosed class and are available within that class or scope.
25. What is Enumerator?
An Enumerator or Enum is a value type with a set of constants given to the set of the list. Enumeration is used when definition is required for more than one number.
26. What is Delegate?
A delegate is defined as an object that can refer to a method. Whenever a delegate is assigned to a method, it behaves exactly like that method.
Example:
public delegate int performaddition(int z, int b);

27. What is Globalization?
Globalization is nothing but making the application  Internationalize and localizing the application to other languages or cultures. Culture is nothing but a combination of Language(English) and the location like US or UK.
28. What is the difference between Dataset and Datareader?

DataReader
Dataset
Datareader has read only access to the data and it is set to be forward only.
Dataset can hold more than one table from the same data source. It even stores relationships between tables.
Datareader cannot persist contents as it is read only
Dataset can persist contents
Datareader is connected architecture
Dataset is disconnected architecture

 29. What is the difference between value and reference types?
Value types directly store the data and it is allocated to stack. Reference type store a reference to the value’s memory address and are allocated to heap.
30. What is TRACE in VB.Net?
TRACE allows the user to view how the code has been executed in detail. This tells how the code is working.
31. What is Authentication and Authorization?
Authentication is the process of obtaining credentials from the users and verifying the user’s identity. Authorization is the process of giving access to the authenticated resources. Authentication leads to Authorization.
32. What are the types of Authentication?
There are three types of Authentication and they are –
·          Windows Authentication
·          Forms Authentication
·          Passport Authentication
33. What is Global Assembly Cache (GAC)?
GAC is used where shared .NET assembly resides. It is used in the following criteria:
·          If .Net assembly has special security requirements
·          If .Net application has to be shared with other applications
34. What is CLR?
    CLR is abbreviated as Common Language Runtime and it forms heart of the .NET framework. It is the responsibility of runtime to take care of the code execution of the program. CLR takes care of the following:
·          Garbage Collection
·          Code Verification
·          Code Access Security
·          IL (Intermediate Language)
35. What is CTS?
CTS is Common Type System which is used to communicate smoothly between the languages. For example, if VB has Integer data type and C++ has long data type and these data types are not compatible.
In order to be compatible, CTS can be used as an interface between two languages.
36. What is CLS?
Common Language Specification is a subset of CTS and it is used to unite all languages in to one umbrella. This extends to support all the .NET language into one unit.
37. What is Managed code?
Managed Code is used to run inside the CLR environment and it is called as .NET run time. All Intermediate Language (IL) are set to be Managed code.
38. What is serialization in .Net?
Serialization is defined as a process of converting an object to stream of bytes. This is used mainly to transport objects.
39. How many languages are supported by .Net?
Following are the languages supported by VB.Net:
·          C#
·          VB.Net
·          COBOL
·          Perl
40. What is the difference between Convert.tostring and i.tostring method?
Convert.tostring handles Null and i.tostring does not handle null.
41. What are the two main parts of .NET?
They are – Common Language Runtime (CLR) and .NET Framework class library.
42. What is the difference between thread and process?
Thread is used to execute more than one program at a time.  Whereas, Process executes single program at a time.
43. What is strong typing and weak typing?
Strong type is checking the types of variables at compile time and weak type is checking the types of system as late as possible which is nothing but run time.
44. How many .NET languages can a single .NET DLL contain?
Only one language will be supported by one DLL.
45. What is the class that allows an element to be accessed using Unique key?
Hash table is the collection class that allows an element to be accessed using Unique key.
46. What is Code Security?
.NET framework provides security features to secure code from unauthorized users. There are two types of security in .NET:
·          Role based security – Authorizes User
·          Code access security – Protects system resources from unauthorized calls
47. Which DLL Is used for Microsoft .NET run time?
Mscoree.dll is used for Microsoft .NET runtime DLL.
48. How many classes a DLL can contain?
Unlimited number of classes can be present in a DLL.
49. How can we store decimal data in .NET?
BinaryWriter is used to store decimal data in .NET.
50. What is deep copy?
Deep copy is nothing but creating a new object and then copying the non-static fields of the current object to new object. 

Top VB.Net Interview Questions & Answers


1. What is Metadata?
Metadata is termed as “Data about content of the data” and it is found in the catalog of libraries. Practically, it is used at back side of book to see the necessary topic.

2. What is the difference between VB and VB.Net?
Following are the differences between VB and VB.Net:
VB
VB.Net
Platform dependent
Platform Independent
VB is backward compatible
VB.Net is not backward compatible
Interpreted
Compiler Language
Exception Handling by ‘On Error…..Goto’
Exception Handling by ‘Try….Catch’
Cannot develop multi-threaded applications
Can develop multi thread applications


3. What is the difference between C# and VB.Net?
    Following table gives differences between C# and VB.Net:
VB.Net
C#
Optional Parameters are accepted
Optional Parameters are not accepted
Not case sensitive
Case Sensitive
Nothing is used to release unmanaged resources
‘Using’ is used to release unmanaged resources
Support of Both structured and unstructured error handling
Unstructured error handling

4. What is namespace?
    A namespace is an organized way of representing Class, Structures and interfaces present in .NET language. Namespaces are hierarchically structured index of a class library, available to all .NET Languages.               

5. Which namespace are used for accessing the data? 
System.Data namespace is used for accessing and managing data from the required data source. This namespace deals only with the data from the specified database. 

6. What is JIT?
    JIT is termed as Just in Time compiler which is used as a part of runtime execution environment. There are three types of JIT and they are:
·          Pre-JIT – Compiles at the time of deployment of an application
·          Econo-JIT – Compiles called methods at runtime
·          Normal JIT – Compiles called methods at runtime and they get compiled first time when called 

7. What is an assembly and its use?
    An assembly is one of the elements of a .NET application and it termed as a primary unit of all .NET applications. This assembly can be either DLL or executable file.

8. What is strong name in .NET assembly?
Strong Name is an important feature of .Net and it is used to identify shared assembly uniquely. Strong name has solved the problem of creating different object with same name and it can be assigned with the help of Sn.exe.
9. What are the different types of assembly?
There are two types of assembly –
·          Private – A private assembly is normally used by a single application and it is stored in application’s directory.
·          Public – A public assembly or shared assembly is stored in Global Assembly Cache(GAC) which can be shared by many applications 

10. What is the difference between Namespace and Assembly?
Assembly is physical grouping of all units and Namespace logically groups classes. Namespace can have multiple assemblies.
11. What is INTERNAL keyword in .Net Framework?
INTERNAL keyword is one of the access specifier which will be visible in a given assembly i.e. in a DLL file. This forms a single binary component and it is visible throughout the assembly. 

12. What are Option Strict and Option Explicit?
.Net generally allows implicit conversion of any data types. In order to avoid data loss during data type conversion, Option Strict keyword is used and it ensures compile time notification of these types of conversions.
Option Explicit is the keyword used in a file to explicitly declare all variables using declare keywords like Dim, Private, Public or Protected. If undeclared variable name persists, an error occurs at compile time.
13. What is the use of New Keyword?
New keyword is used with the constructor in which it can be used as a modifier or an operator. When it is used as a modifier, it hides inherited member from the base class member. When it is used as an operator, it creates an object to invoke constructors.
1
Dim frm As New Form1 frm.show()

14. What is ReDim keyword and its use?
Redim keyword is exclusively used for arrays and it is used to change the size of one or more dimensions of an array that has been already declared. Redim can free up or add elements to an array whenever required.


Dim intArray(7, 7) As Integer
ReDim Preserve intArray(7, 8)
ReDim intArray(7, 7)

15. What is jagged array in VB.Net?
             Jagged array is nothing but an array of arrays. Each entry in the array is another array that can hold any number of items.
16. What is Manifest?
A Manifest is a text file that is used to store metadata information of .NET assemblies. File type of Manifest can be saved as a type PE. Assembly Name, Version, Culture and key token can be saved as a Manifest.
17. What are all the differences between Dispose and Finalize()?
Finalize method is called by Garbage collector which helps us to make free of unmanaged resources. There are some other resources like window handles, database connections are handled by iDisposable interface.
Dispose method is handled by IDisposable interface to explicitly release unused resources. Dsipose can be called even if other references to the object are alive.
18. What is Garbage Collection?
Garbage collection is also known as automatic memory management, which is used for automatic recycling of dynamically allocated memory. Garbage collection is performed by Garbage collector which will recycle memory if it is proven that memory will be unused.
19. What are the types of generations in garbage collector?
There are three types of generations in garbage collector.
Generation 0 – This identifies a newly created object that has been never marked for collection.
Generation 1 – This identifies an object which has been marked as collection but not removed.
Generation 2 – This identifies an object that has survived more than one sweep of the Garbage collector.
20. What is the use of Option explicit?
Variable must be compulsorily declared when the Option Explicit is termed as ON. If it is OFF, variables can be used without declaration.
21. What is the difference between System.String and System.StringBuilder classes?
System.string class is non-updatable and it will create new string object instead of updating the same. But updation in the same string object is possible for String. Stringbuilder class. So, the operation on string builder is faster and efficient than the string class.
22. What is the difference between int and int32?
Int32 represent 32-bit signed integer whereas int is not a keyword used in VB.Net. 
23. What is hashtable?
Hashtable is set to be items with key and value pairs. Keys are referred as indexes and quick search can be performed for values by searching through the keys.
24. What are nested classes?
A class that can be declared within the scope of another class. These classes are considered within the scope of the enclosed class and are available within that class or scope.
25. What is Enumerator?
An Enumerator or Enum is a value type with a set of constants given to the set of the list. Enumeration is used when definition is required for more than one number.
26. What is Delegate?
A delegate is defined as an object that can refer to a method. Whenever a delegate is assigned to a method, it behaves exactly like that method.
Example:
public delegate int performaddition(int z, int b);

27. What is Globalization?
Globalization is nothing but making the application  Internationalize and localizing the application to other languages or cultures. Culture is nothing but a combination of Language(English) and the location like US or UK.
28. What is the difference between Dataset and Datareader?

DataReader
Dataset
Datareader has read only access to the data and it is set to be forward only.
Dataset can hold more than one table from the same data source. It even stores relationships between tables.
Datareader cannot persist contents as it is read only
Dataset can persist contents
Datareader is connected architecture
Dataset is disconnected architecture

 29. What is the difference between value and reference types?
Value types directly store the data and it is allocated to stack. Reference type store a reference to the value’s memory address and are allocated to heap.
30. What is TRACE in VB.Net?
TRACE allows the user to view how the code has been executed in detail. This tells how the code is working.
31. What is Authentication and Authorization?
Authentication is the process of obtaining credentials from the users and verifying the user’s identity. Authorization is the process of giving access to the authenticated resources. Authentication leads to Authorization.
32. What are the types of Authentication?
There are three types of Authentication and they are –
·          Windows Authentication
·          Forms Authentication
·          Passport Authentication
33. What is Global Assembly Cache (GAC)?
GAC is used where shared .NET assembly resides. It is used in the following criteria:
·          If .Net assembly has special security requirements
·          If .Net application has to be shared with other applications
34. What is CLR?
    CLR is abbreviated as Common Language Runtime and it forms heart of the .NET framework. It is the responsibility of runtime to take care of the code execution of the program. CLR takes care of the following:
·          Garbage Collection
·          Code Verification
·          Code Access Security
·          IL (Intermediate Language)
35. What is CTS?
CTS is Common Type System which is used to communicate smoothly between the languages. For example, if VB has Integer data type and C++ has long data type and these data types are not compatible.
In order to be compatible, CTS can be used as an interface between two languages.
36. What is CLS?
Common Language Specification is a subset of CTS and it is used to unite all languages in to one umbrella. This extends to support all the .NET language into one unit.
37. What is Managed code?
Managed Code is used to run inside the CLR environment and it is called as .NET run time. All Intermediate Language (IL) are set to be Managed code.
38. What is serialization in .Net?
Serialization is defined as a process of converting an object to stream of bytes. This is used mainly to transport objects.
39. How many languages are supported by .Net?
Following are the languages supported by VB.Net:
·          C#
·          VB.Net
·          COBOL
·          Perl
40. What is the difference between Convert.tostring and i.tostring method?
Convert.tostring handles Null and i.tostring does not handle null.
41. What are the two main parts of .NET?
They are – Common Language Runtime (CLR) and .NET Framework class library.
42. What is the difference between thread and process?
Thread is used to execute more than one program at a time.  Whereas, Process executes single program at a time.
43. What is strong typing and weak typing?
Strong type is checking the types of variables at compile time and weak type is checking the types of system as late as possible which is nothing but run time.
44. How many .NET languages can a single .NET DLL contain?
Only one language will be supported by one DLL.
45. What is the class that allows an element to be accessed using Unique key?
Hash table is the collection class that allows an element to be accessed using Unique key.
46. What is Code Security?
.NET framework provides security features to secure code from unauthorized users. There are two types of security in .NET:
·          Role based security – Authorizes User
·          Code access security – Protects system resources from unauthorized calls
47. Which DLL Is used for Microsoft .NET run time?
Mscoree.dll is used for Microsoft .NET runtime DLL.
48. How many classes a DLL can contain?
Unlimited number of classes can be present in a DLL.
49. How can we store decimal data in .NET?
BinaryWriter is used to store decimal data in .NET.
50. What is deep copy?
Deep copy is nothing but creating a new object and then copying the non-static fields of the current object to new object.