(Interview) Microsoft Technologies Interview Questions (VB .Net)

Microsoft Technologies Interview Questions

[VB .Net Interview Questions]


What are collection objects in VB.net ?

VB.Net implements a special object called Collection object that acts as a container for objects of all types. Collection can hold other objects as well as non object data. A Collection has four methods: -         Add: This method adds a member to collection. Along with data one can also specify a key value by which the data can be referenced. -         Count: This returns the total number of items in the collection object. -         Item: Retrieves an item from the collection. An item can be retrieved either using the index or a key if specified. -         Remove: Removes an item from the collection.  e.g. Dim students As New Collection students.Add (?john?, ?1?); //The second argument is a key to object students.Add (?paul?, ?2?);

What is the significance of the ?finalize? method ?

In order to understand the ?finalize? method one needs to understand the concept of garbage collection.  The job of freeing up the memory allocated to objects is that of a garbage collector. When the garbage collector determines that an object is no longer referenced it automatically runs a special destructor function called ?Finalize?. However we have no way to determine when the garbage collector will call the Finalize method. We can only be sure that it will be called at some time after the last reference to the object is released. Finalize is a protected method i.e. it can be called from the class or derived classes however it cannot be called from outside of the class. If a class has a Finalize method it should explicitly call the Finalize of its base class as well.  Overrides Protected Sub Finalize ()             ?Cleanup code goes here             BaseClass.Finalize End Sub

What are assemblies ? How does one use assemblies in a VB.net project ?

Assemblies are used to specify a logical unit or building block for .net applications. A .net application contains one or more assemblies. Every assembly has version properties that include a major and a minor version, revision as well as a build number. Thus all elements of an assembly are versioned as a unit. The specifications in an assembly are referred as the assembly?s manifest. To use an assembly in VB.Net project one has to follow two steps: - Add a reference of the assembly to the project. A default assembly containing the System namespace is by default added to the project. Access the members or members of the namespace in the assembly using the fully qualified class name.

How does the ?Err? object look like ?

Error handling that evolve around the various On Error.. statements are referred to as unstructured error handling. The build in object Err is used in this type of error handling. This object has several properties and methods as listed below: Properties:  Description: a short description of the error HelpContext: context ID for the help topic associated with the error HelpFile: fully qualified file name if any Number: Number associated with the error Source: a string that specifies the object that generated the error. Method: Clear: Clears the set values of all properties of the error object. Raise: Generates a runtime error and sets the properties of the Err object to the values supplied in the method call

Have you worked with ADO.net? Can you explain to me in brief ?

Yes I have certainly worked on ADO.Net. ADO.net encompasses two groups of classes: content components and managed provider components. The content components include DataSet class and other supporting classes as DataTable, DataRow, DataColumn and DataRelation. The DataSet class is a lightweight cache of a particular database from the data store.  It allows reading and writing of data and schema in XML. ADO.Net involves disconnected datasets because it is geared towards a distributed architecture. All tables and relations in a DataSet are exposed through the DataSet tables and Relations properties.  E.g. Using System; Using System.Data;  DataSet ds = new DataSet(?MyDS?); Ds.Tables.Add (?Order?); Ds.Tables[?Order?].Columns.Add(?OrderNo? Type.GetType(?System.Int32?));  The DataSet tightly integrates with XML using the methods WriteXml, ReadXml, WriteXmlSchema and ReadXmlSchema

What is the use of namespaces? Can you give me an example ?

The concept of namespaces plays a very crucial role in .net framework. It is a concept parallel to the concept of packages in java. In general, a namespace is a logical grouping of types for the purpose of identification. e.g. let?s say in an organization there are three people with name Paul Smith each individual in a different role and responsibilities. To resolve this ambiguity we can define three namespaces based on their roles as Secretary, Manager and Operator and then reference each Paul as Secretary.Paul and Manager.Paul and Operator.Paul. This is the concept of namespace.