• +91 9723535972
  • info@interviewmaterial.com

VB.Net Interview Questions and Answers

VB.Net Interview Questions and Answers

Question - 1 : - What do u mean by Redim in VB.NET ?

Answer - 1 : - In vb.net we use Redim and erase to manipulate Array. Once we declare an array the size set to array its makes limited to that range but with the help of redim we used to change the array size. Redim arr(6) we can also used preserve to save these values. Redim Preserve arr(6)

Question - 2 : - What is branching logic control in vb.net ?

Answer - 2 : - Function and subroutines are the answer.The diffrence in two of them is function send information back from where it is called means function can return a value but subroutines can not do this.

Question - 3 : - What is the difference between VB and VB.NET ?.

Answer - 3 : - Object-based language and Does not support inheritance also ADO.Net does not give support for disconnected data architecture and there is No interoperability function and No support for threading. On the other hand VB.NET is Object-Oriented Programming language and ADO.Net gives support for disconnected data architecture also provides interoperability and Its uses managed code and supports threading also provides access to third-party controls like COM, DCOM .

Question - 4 : - What is DataType conversion in VB.NET ?

Answer - 4 : - Convert one variable type to another one is called datatype conversion we can also caleed this casting in VB.NET some automatically conversion is also there. Cbool CByte CChar Cdate CDec CDbl CInt CLng CObj CShort CSng CStr CType Asc.

Question - 5 : - Write the role of New keyword ?

Answer - 5 : - New is used to initialize a new object. We sets a variable to any dattype with help of New keyword .The New keyword gives a value to the variable.We can also uses new keyword to initialize an object variable. Example:- dim obj as new SqlDataAdapter.

Question - 6 : - What is the difference between DataTable and DataSet ?.

Answer - 6 : - Dataset: Represents an in-memory cache of data we can also say data set is a collection of data table it is based on xml format ,it is used for data storing in cache as a disconnected recordset dataset is using data manipulation in cache wthout connection to database. DataTable: Represents one table of in-memory data data table can have one table only or we can say Data table is a collection of record's that consist the single table ..

Question - 7 : - Are COM objects managed or unmanaged?

Answer - 7 : -   Since COM objects were written before .NET, apparently they are unmanaged. Any code not written in the Microsoft .NET framework environment is UNMANAGED. So naturally COM+ is unmanaged because it is written in Visual Basic 6.

Question - 8 : - So can a COM object talk to a .NET object?

Answer - 8 : - Yes, through Runtime Callable Wrapper (RCW) or PInvoke.

Question - 9 : - How does VB.NET/C# achieve polymorphism? 

Answer - 9 : -   Polymorphism is also achieved through interfaces. Like abstract classes, interfaces also describe the methods that a class needs to implement. The difference between abstract classes and interfaces is that abstract classes always act as a base class of the related classes in the class hierarchy. For example, consider a hierarchy-car and truck classes derived from four-wheeler class; the classes two-wheeler and four-wheeler derived from an abstract class vehicle. So, the class 'vehicle' is the base class in the class hierarchy. On the other hand dissimilar classes can implement one interface. For example, there is an interface that compares two objects. This interface can be implemented by the classes like box, person and string, which are unrelated to each other. C# allows multiple interface inheritance. It means that a class can implement more than one interface. The methods declared in an interface are implicitly abstract. If a class implements an interface, it becomes mandatory for the class to override all the methods declared in the interface, otherwise the derived class would become abstract. Can you explain what inheritance is and an example of when you might use it? The savingaccount class has two data members-accno that stores account number, and trans that keeps track of the number of transactions. We can create an object of savingaccount class as shown below.         savingaccount s = new savingaccount ( "Amar", 5600.00f ) ; From the constructor of savingaccount class we have called the two-argument constructor of the account class using the base keyword and passed the name and balance to this constructor using which the data member's name and balance are initialised. We can write our own definition of a method that already exists in a base class. This is called method overriding. We have overridden the deposit( ) and withdraw( ) methods in the savingaccount class so that we can make sure that each account maintains a minimum balance of Rs. 500 and the total number of transactions do not exceed 10. From these methods we have called the ba

Question - 10 : - How would you implement inheritance using VB.NET/C#?

Answer - 10 : - When we set out to implement a class using inheritance, we must first start with an existing class from which we will derive our new subclass. This existing class, or base class, may be part of the .NET system class library framework, it may be part of some other application or .NET assembly, or we may create it as part of our existing application. Once we have a base class, we can then implement one or more subclasses based on that base class. Each of our subclasses will automatically have all of the methods, properties, and events of that base class ? including the implementation behind each method, property, and event. Our subclass can add new methods, properties, and events of its own - extending the original interface with new functionality. Additionally, a subclass can replace the methods and properties of the base class with its own new implementation - effectively overriding the original behavior and replacing it with new behaviors. Essentially inheritance is a way of merging functionality from an existing class into our new subclass. Inheritance also defines rules for how these methods, properties, and events can be merged. In VB.NET we can use implements keyword for inheritance, while in C# we can use the sign ( :: ) between subclass and baseclass

NCERT Solutions


Share your email for latest updates


Our partners