Vb.Net Interview

1 what is VB.NET?

Answer: Vb.net is an object oriented language which supports the concepts like class, object, inheritance and polymorphism etc. Vb.net is used to develop various kind of applications like console applications, windows applications and web applications etc.

2 is VB.NET updated version of VB or not? Specify.

Answer: Vb.net is an updated version of the Visual Basic language that target the Microsoft .NET Framework. Vb.net can access all the libraries of .NET framework because it is implemented by the .NET framework.

3 Write features of VB.NET? Answer:
  • It is easy to understand.
  • It is Object-Oriented.
  • It provides the supports Graphical User Interface.
  • It is most popular language to develop the windows application.
  • It is user-friendly language
  • It is a structured language.
4 What is design window in VB.NET IDE?

Answer: It is the place where we can design the interface for the form by adding or organizing controls on the form. In this box, just we have to drag and drop the controls from the tool box and these will be appeared on this design view, we can also create the GUI components manually using the custom code.

5 what is solution explorer?

Answer: Solution Explorer present at the upper-right corner of the IDE which displays all the form, modules and other files contained in the application. Here all the folders and files are present related to the project and we can also add or remove any file from here manually.

6 what is properties window?

Answer: Properties window present below the solution explorer. Properties window displays all the properties of a form or control.

7 How to save VB.NET project?

Answer: You can save a project by any of the following ways:

  • Click on File-> Save All
  • OR
  • Click on the buttonfrom the standard toolbar.

This will open a “Save Project” dialog box in front of you as given in the following diagram:

Now provide the name for your location and also select the location where you want to save your project. Solution name would be same as the Name. At last click on the Save button this will save your project at the specified location.

8 How to execute project in VB.NET?

Answer: You can execute a project by any of the following ways:

  • Select Debug-> Start Debugging from menu bar.
  • OR
  • Click on the buttonfrom the standard toolbar.
  • Or
  • Press key F5.
9 What is CLR?

Answer: CLR is a very important part of the .NET framework which is basically used for executing the application written in any .NET language. It provides the common way to compile the code for language which we use

10 what is MSIL?

Answer: MSIL is a machine independent code. In second compilation process MSIL file is executed and CLR transforms it into machine code.

11 what is base class library?

Answer: Base class library is also an important part of .NET framework which can be used by the all.NET languages. It provides a common library which contains common functions, methods and classes which are same for all .NET languages.

12 what is keyword in VB.NET?

Answer: Every programming language contains some predefined words reserved for its use. These words are known as keywords. One cannot use these keywords as the identifier. Identifier is a name given to the several entities in a program.

13 what is identifiers in VB.NET?

Answer: Identifiers are the name given to the various programming elements like variables, array, functions and structures etc. In simple words, identifiers are used to give the name for elements or it is used to identify the elements of the program which we use in the program uniquely.

14 what is data type?

Answer: While creating a program we have to store the data entered by the user. The data that is entered by the user can be of any type. The type of the stored data is determined by the “Data Types”.

15 how to declare variable on VB.NET?

Answer: The basic syntax to declare a variable in VB.NET is as follows:

Syntax
[] [access-specifiers] [{ [Shared][Shadows]| [Static] }] [ReadOnly] Dim [withEvents] variableList

16 what is attributelist?

Answer: It defines a list of attributes that apply to the variables. Multiple attributes are seprated by commas.

17 what is access-specifiers?

Answer: access-specifiers determined the visibility of a variable in a program. These can be: Public, Protected, Friend, Private and Protected Friend.

18 what is static variable in VB.NET?

Answer: Static variables retain their value even after the termination of the procedure in which they are declared.

19 what is shared variable in VB.NET?

Answer: Shared variables are not associated with a specific object of a class but can be shared by all objects of a class.

20 what is shadows keyword in VB.NET?

Answer: Shadows keyword makes a variable a shadow of an identically named programming element in a base class and an element that is modified with keyword Shadow is unavailable in the derived class that shadow it.

21 what is readOnly in VB.NET?

Answer: ReadOnly variables can only be read. They cannot be written.

22 why we use Dim in VB.NET?

Answer: It is a keyword used to declare a variable.

23 what is withEvents in VB.NET?

Answer: This specifies that the variable is used to responds the events caused by the instance that are assigned to a variable.

24 what is New in VB.NET?

Answer: It is used to create a new instance of an object immediately.

25 how to declare variable and initialization with one statement in VB.NET?

Answer: You can initialize a variable at the time of declaration as given below:

Dim a1 As Integer=5

26 what is constant in VB.NET?

Answer: Constants are also the name given to the data values stored in memory like variable but the value of constant cannot be changed at the time of execution means when we don’t want to change the value of variable or want to same value at various place then we have to use constants. It is used to represent the fixed value which cannot be changed at runtime or cannot vary in the program after assigning the value to it at first time.

27 what is data type conversion in VB.NET?

Answer: Data Type conversion is a process to convert a data type to another data type.VB.NET provides various conversion functions which are useful for conversion between incompatible data types.

28 what is working of CBool function in VB.NET?

Answer: CBool Function is used to convert a data type to Boolean data type

Syntax
CBool (expression)

29 what is the working of CByte function in VB.NET?

Answer: CByte Function is used to convert a data type to Byte data type.

Syntax
CByte (expression)

30 what is the working of CChar function in VB.NET?

Answer: CChar Function is used to convert a data type to Char data type.

Syntax
CChar (expression)

31 what is the working of CDate function in VB.NET?

Answer: CDate Function is used to convert a data type to Date data type.

Syntax
CDate (expression)

31 what is the working of CDbl function in VB.NET?

Answer: CDbl Function is used to convert a data type to Double data type.

Syntax
CDbl (expression)

32 what is the working of CInt function in VB.NET?

Answer: CInt Function is used to convert a data type to Integer data type

Syntax
CInt (expression)

33 what is the working of CLng function in VB.NET?

Answer: CLng Function is used to convert a data type to Long data type.

Syntax
CLng (expression)

34 what is operator in VB.NET?

Answer: Operators take one or more operand as input and give a result after applying operation over them. Like in "a+b", 'a' and 'b' are the operands and '+' is an operator which performs the add operation on 'a' and 'b' operands.

35 what is arithmetic operator?

Answer: Arithmetic operators are the operators which perform the mathematical operation between two operands or it can be more than two operands.

36 what is Is operator in VB.NET?

Answer: Is : it is used to compare two objects reference variable references and it tells if both objects references refer to the same object and it is not performing object comparisons. If first object and 2nd object refer the exact same object instance then it will return true otherwise false.

37 what is IsNot operator in VB.NET?

Answer: IsNot: it is used to compare two objects reference variable references and it tells if both objects references refer to the different objects. If first object and 2nd object refer the exact same object instance then it will return true otherwise false.

38 what is the use of Like operator in VB.NET?

Answer: Like: it is used for checking the pattern string.

39 what is AndAlso operator in VB.NET?

Answer: This is logical AND operator. It works only on Boolean value. It is used to perform short-circuiting.

40 what is OrElse operator in VB.NET?

Answer: This is the logical OR operator. It works only on Boolean value. It is used to perform short-circuiting.

41 what is \= in VB.net?

Answer: It is called as Divide AND assignment operator, first It divides left operand with the right operand and assigns the result to left operand and it returns Integer division as result.

42 what is ^= in VB.NET?

Answer: It is called as Exponentiation and assignment operator. First It raises the left operand to the power of the right operand and assigns the result to left operand means it is used to calculate the power.

43 what is AddressOf in VB.net?

Answer: AddressOf : it is used to return the address of the procedure.

44 what is Await in vb.net?

Answer: This operator is applied to an operand in an asynchronous method or lambda expression to suspend the execution of the method till the awaited task completes.

45 what is decision making statement in VB.NET?

Answer: Decision Making Statement allows user to choose one path from the two or more execution path on the basis of condition or we can say that these statements provide the facility to select one option from the given option on the behalf of some condition. If the condition is true then one set of statement will be executed and if the condition is false another set of statement will be executed.

46 what is the syntax of If statement in VB.NET?

Answer: Here is the syntax of if statement given below:

If condition Then
Statement –block a;
End if
Statement-block b;

47 how to show message in VB.NET? Answer:
Using MessageBox.Show(“Your message”)

48 what is nested if?

Answer: A nested If is a statement that is the target of another If or Else statements. When we use If, if..Then..ElseIf..Else, If..Then..Else statements inside the other If, ElseIf or Else statements that is known as nested If statements. When we use if statement inside if then it is called as nested if statements.

49 what is select case in VB.NET?

Answer: The Select…Case statement in VB.NET is used to select and execute one of the many groups of statements on the basis of the value of the expression in the condition. This statement is a multi-way branch statement.

50 what is loop in VB.NET?

Answer: Loops are such block of statements that are repeatedly executed for certain number of times on the basis of specific condition.

51 what is For .. Next in VB.NET?

Answer: For..Next Loop is used to execute a group of statements repeatedly for a specified number of times. For..Next loop enables the user to execute a block of statement repeatedly until a certain condition gets false.

52 what is Do loop in VB.NET?

Answer: Do loop is used to execute a group of statements repeatedly as long as the condition is true or until the condition becomes true. The basic syntax of the Do Loop is given below:

Do {while | Until} condition
[Statements]
[Exit Do]
[Statements]
Loop

53 what is While .. End loop in VB.NET?

Answer: While…End While Loop repeatedly executes a set of statement as long as a specified condition is true. While statement always checks the condition first before executing the statements present in loop-body. When the control reaches the End While statement, the control is passed back to the While statement. If condition is still true, the statements inside the loop body are executed else exits the loop.

54 what is console application?

Answer: Console Applications are command-line based applications which read characters from the console and write character to the console and are executed in DOS Version.

55 what is WriteLine method?

Answer: WriteLine method of the Console class is used to display a message on the console.

56 what is ReadLine method?

Answer: ReadLine method of the Console class is used to read the next line of characters from the console.

57 what is array in vb.net?

Answer: An Array is a set of values that are logically related to each other. The individual values of an array are called the elements of array.

58 how to declare array in VB.NET? Answer:
  • Dim keyword is used to declare an array.
  • array-name can be any meaningful name given to the array.
  • size of an array determines the number of elements present in the array.
  • data-type represents the data-types of elements of an array.
  • Here are some examples of declaration of an array:
  • Dim highestmarks(20) As Double
    Dim name(20) As String
    Dim length(10) As Integer

59 how to initialize array in vb.net?

Answer: You can also initialize an array element while declaring the array:

Dim name() As String={“Ram”,”Siya”,”Manoj”,”Shivam”}

Dim length() As Integer={10,20,25,67}

60 what is jagged array?

Answer: An array of array is known as Jagged Array.

61 how to declare jagged array?

Answer: You can declare a jagged array as follows:

Dim length As Integer()()= New Integer(3)(){}

62 give example of jagged array? Answer:
Module Module1
Sub Main()
Dim length()() As Integer = New Integer(3)() {}
length(0) = New Integer() {0, 0}
length(1) = New Integer() {1, 1}
length(2) = New Integer() {2, 2}
Dim i, j As Integer
For i = 0 To 2
For j = 0 To 1
Console.WriteLine("length[{0}][{1}]:{2}", i, j, length(i)(j))
Next j
Next i
Console.ReadLine()
End Sub
End Module

63 what is dynamic array?

Answer: Dynamic Array is a type of array that can be dimensioned and re-dimensioned dynamically by using ReDim statement.

64 what is enumeration?

Answer: The most basic user defined data type is Enumeration. It arranges a list of items in a sequence and associates a symbolic number to each element.

65 why we use Enum keyword?

Answer: In VB.NET we use Enum keyword to declare Enumeration.

66 what is class in VB.NET?

Answer: A class is a user-defined data type. It is the base of object-oriented programming language. A class contains variable and methods inside its body.

67 why we use class keyword?

Answer: Class is defined using the keyword class.

68 what is object?

Answer: Object is instance of class which can access all the members of class.

69 How to declare object in VB.net 2010?

Answer: The syntax for declaring an object in VB.NET 2010 is as follows:

Dim object-name As New class-name()

70 how to access class method and variables using object?

Answer: we can access the member of class through the object. The syntax for accessing the members of class through the object is as follows:

Object-name.Variable-name
Object-name.method-name()

71 what is the scope of friend modifier?

Answer: Friend member is accessible in the classes of the same assembly.

72 what is windows form?

Answer: Windows Forms are the interface that is used for designing the visual interface for a Windows application. We can add the controls and any other items from the toolbox to window form by dragging and dropping them or by double clicking on them.

73 what is control in vb.net?

Answer: A control is a component which can be used to take input from the user or can be used to display some information to the user.

74 what is Lable control?

Answer: Label Control is used to display the text in a non-editable format. The text displayed by the Label control can only be changed at run time of the application or design time of the form.

75 what is ComboBox?

Answer: A ComboBox control displays a list of items in a drop-down list. ComboBox control is a combination of a text box in which a user can enter a drop-down list from where the user can select an item.

76 what is ListBox?

Answer: A ListBox control is used to display items in the form of a list where we can make selections. The ListBox control is same like ComboBox control.

77 what is CheckBox?

Answer: The CheckBox control is a small rectangle with a corresponding text displayed at the right side of it. This text works as a Label for the checkbox. When you want the user to have multiple options to choose from the existing list you use the CheckBox control.

78 why we use PictureBox control?

Answer: PictureBox control is used to add the picture on the Windows form.

79 what is timer control?

Answer: Timer controls are controls that are used to generate periodic events. These controls are called components and they do not appear in a Window at run time.

80 what is menu control in VB.Net?

Answer: A menu control provides a list of options to the user to choose from. It hides these options when they are not needed and thus saves the space in the Windows application.

81 what is MenuStrip control?

Answer: MenuStrip Control is used to display menus in a Windows Application.

82 what is exception?

Answer: An exception can be considered as an error which is caused due to a run time error in a program.

83 what is exception handling?

Answer: If we want that the program remains continue executing the remaining code, we have to Catch the exception object thrown by the error condition and display an appropriate message for taking corrective action. This process is known as the exception handling.

84 what is try block?

Answer: The code that may be throw exception which we want to handle is put in the Try block. It is followed by one and more Catch block.

85 what is catch block?

Answer: The code to handle the thrown exception is put in the Catch block just after the Try block.

86 what is Finally block?

Answer: Finally block is always executed whether the exception is thrown or not by the Try block.

87 what is Throw statement?

Answer: Any method can throw the exception using Throw statement when any unexpected event is occur.

88 what is standard exception?

Answer: The exceptions which are pre-defined and provide us with the help of some classes called Exception classes by .NET Class Library are known as Standard Exceptions.

89 write the working of Try-Catch block?

Answer: The piece of code to handle the exception is written in the Try-Catch block. When a program starts executing, the program control enters the Try block. If all the statements present in Try block successfully executed, then the program control leaves the Try-Catch block. If any statement fails to execute, the execution of remaining statements is stopped and the program control goes to the Catch block for handling the exception.

90 what is user define exception?

Answer: Sometimes a situation is arises that we have to handle an exception for which there is no exception class defined in the .NET class library. In that cases we are called the classes as user-defined classes and the exception handled by these classes are known as user-defined exceptions.

91 Give one example program of user define exception? Answer:
Module Module1
Sub Main()
Dim x, y As Integer
x = 3
y = 15000
Try
Dim z As Single
z = Convert.ToString(x / y)
If z < 0.001 Then
Throw New myexception("number is very small")
End If
Catch ex As myexception
Console.WriteLine("exception caught")
Console.WriteLine(ex.message)
Finally
Console.WriteLine("Control entered in Finally block")
Console.Read()
End Try
End Sub
Class myexception
Inherits Exception
Public Sub New()
End Sub
Public Sub New(ByVal message As String)
MyBase.New(message)
End Sub
Public Sub New(ByVal message As String, ByVal inner As Exception)
MyBase.New(message, inner)
End Sub
End Class
End Module

92 what is sub procedure?

Answer: It is like a function but it cannot return any value. It is known as sub procedures in VB.NET. We use sub keyword to define the sub procedure.

93 how to make a constructor in VB.NET?

Answer: We can make constructor like

Public Sub New()
Statements it is default constructor
End Sub

94 what is overloading in VB.NET?

Answer: Overloading refers to use of same thing for different purpose. VB.NET provides the concept of overloading where we provides more than one definition for a single function or operator.

95 what is function overloading in VB.NET?

Answer: In Function overloading we can create number of functions with the same name but either number of arguments or type of arguments must be different.

96 what is inherits keyword?

Answer: It is used for inheritance to inherit any class.

97 what is encapsulation?

Answer: Encapsulation is simple concept which prevents the access to data that is not essential. It is a process of binding the variable and methods together required by an object in a single unit that is class.

98 what are advantages of encapsulation? Answer:
  • It provides data security.
  • It provides the abstraction between objects and its clients.
  • It provides the security from the unwanted access.
99 what is abstraction in VB.NET?

Answer: Abstraction is the process of providing the essential features of an object without providing its background details or explanation.

100 give one example of abstraction in real world?

Answer: When we use ATM machine to withdraw money then there is only screen is displayed in-front of us. Here we have to enter the detail about pin and we enter into the account to get money; but here there is no internal details are shown to user such as which languages are used to develop the ATM system, how machine gets the input etc.