VB.NET Interview Questions and Answers (91) - Page 2

What is the keyword used in VB to carry out the work of virtual keyword of C#?

The Overridable keyword. It declare a method to support polymorphism.
Equivalent keyword of new in VB?

Shadow keyword is used to hide a method from a base class.
To define abstract class in VB which keyword is used?

MustInherit keyword is used to create an abstract class in VB.
To define abstract method which keyword is used in VB?

MustOverride keyword is used to define an abstract method in VB.
Can we Add New Row into a Grid Using Binding Source?

NOTE: This is objective type question, Please click question title for correct answer.
AddNew() method of BindingSource Class will add a blank row or with some data?

NOTE: This is objective type question, Please click question title for correct answer.
How can we find the index of current selection in BindingSource Class?

Using bindingSource1.Position we can find the index of currently selected item.
Here bindingSource1 is the object of BindingSource Class.
Can we insert a blank row using BindigSource Class?

Yes, we can create a blank row using AddNew() Method. but if we have any checkbox that we are binding with binding source then we can't insert blank row we need to add some value for those column with whcih we are binding checkbox.
How can we Move to Next and Previous Record using BindingSource Class

bindingSource1.MoveNext() to move to Next record and
bindingSource1.MovePrevious() to move to previous record.
How to apply filter using BindingSouce?

Suppose you have table with column col1, col2, col3, col4 and you want to filter the record where col1 is equal to Lakhan and col2 like G
bindingSource1.Filter="col1 = 'Lakhan%' AND col2 LIKE 'G%'"

here bindingSource1 is the object of BindingSource Class.
What are the new features in Visual Basic 10?

1.Multi-Line Statement Lambdas
2.Sub Lambdas
3.Auto-implemented Properties
4.Collection Initializers
5.Array Literals
Why Option Strict is used so far?

Option Strict is used to enable type checking at design time and prevents type mismatch bugs.
What is Optional Explicit in VB.net ?

When a variable is assigned with Option Explicit the variable must and should be declared .

Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear. If you do not use the Option Explicit statement, all undeclared variables are of Object type.

Usage :

Option Explicit On

What is the Important aspect before using Objects in VB.Net .

Object creation should be made applicable to the absolute class where it is from and place exact path for it only then the objects will be working otherwise the objects will not loaded properly and the method wont work .
What is the Syntax of get and set properties in VB.net?

The Syntax is :

Public Property MyExample As Integer

' Retrieves number.
Return number
End Get
' Assigns to number.
number = value
End Set
End Property

What for " MustInherit " keyword is used in VB.net ?

If a particular class is preceeded with the keyword MustInherit means ,

. We cannot create an object to that particular class.

. If we want to create an Abstract class in VB.net we use that keyword.

. If a class is being a MustInherrit class we can use that class only when it is inherited.
Module Module1 Sub Main() Dim arr(3, 3) As Integer End Sub End Module What is the total number of elements in this array?

NOTE: This is objective type question, Please click question title for correct answer.
What is the use of Option Infer statement in VB?

It is used in Visual Basic to determine the data type of a local variable declared without an as clause on the basis of the value assigned to the variable at

compile time.

(type inferencing in VB)

example: Option Infer on (default)
dim a=45
Take the mouse over variable a
a's data type is integer( see in tooltip)

Option Infer off
Take the mouse over variable a
a's data type is Object( see in tooltip)

a's data type is object
In VB.NET, can we write like this ? If VariableName > 7 Or < 10 Some Code here

NOTE: This is objective type question, Please click question title for correct answer.
What is the exact difference between Functions and Subs in VB.NET ?

Functions return a value, and Subs don't.

Substring() is a Function, because you want some sort of answer back. You assign the answer to the Substring() function to a variable.

A Sub is some code or job that you want VB to get on with it and execute. An example is closing a form down and unloading it with Me.Close(). You don't need to return a value, here; you just want VB to close your form down.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories