VB.Net Interview Questions and Answers
Question - 101 : - How Do You Declare Static Variable And How It Is Declared And What Is Its Lifetime?
Answer - 101 : -
Static variables are declare through the Static Var1 as Integer The scop of the Var1 is within the module where its is Defined.
Question - 102 : - How Does You Get Record No From 5 To 15 From A Dataset Of 100 Records?
Answer - 102 : -
dim dRow as data.datarow
for i as interger = 5 to 15
drow = dSet.Tables(0).Rows(i)
'process row
next i
Question - 103 : - What Is The Difference Between Dataset And Recordset?
Answer - 103 : -
A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
-A DataSet is designed to work without any continuing connection to the original data source.
-Data in a DataSet is bulk-loaded, rather than being loaded on demand.
-There's no concept of cursor types in a DataSet.
-DataSets have no current record pointer You can use For Each loops to move through the data.
-You can store many edits in a DataSet, and write them to the original data source in a single operation.
-Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
[1)With Data set you can retrive data from database like oracle and SQL Server and manage them in one dataset, with recordset this is not possible.
2)All representation of Dataset is using XML while recordset uses COM.
3)Recordset can not be transmitted on HTTP while Dataset can be.]
Question - 104 : - Why Datareader Is Useful?
Answer - 104 : -
Data reader is useful when we just want to acccess datas from the database not when we want to perform DML operations. and It is useful when we want to perform forward only reading of datas.It wont requires any large volume of resources in the Front end. [Datareader is read only or forward only. So it is very fast to fetch the data from database.]
Question - 105 : - How Does You Call And Execute A Sp In .net?
Answer - 105 : -
Using command object we can execute a SP. Instead of sql query we have to pass the SP Name.
[command.connection =connectionstring
command.commandType=commandType.storedProcedure
command.commandtext="sp_name"
command.executenonquery()]
Question - 106 : - What Is Dll Hell?
Answer - 106 : -
1.Adding of a new virtual method to a class exported from a DLL can cause the following problems:
-If class already has a virtual method B and we are adding a new one named A before it, then we are changing the table of virtual methods. Now the first virtual method in the table will be A but not B and the client program which calls B will fail without recompilation as the call of B will cause the call of A and this is another method which possibly has other parameters and return type.
-When a class doesn?t have virtual methods and none of its base classes have, then adding of a new virtual method to it or to its base class will cause adding of the pointer for the table of virtual methods. This will cause change in the class size. So the error will occur after a client program will allocate memory for the class (an amount of memory that was required before the class has been changed) and will try to modify some of the class' fields explicitly or implicitly. In this case, as the pointer to the table of virtual method is added to the beginning of the class, all addresses of the class fields are shifted and thus we will get an abnormal client program behavior or a runtime error.
-In case when a class has virtual methods or any of its parent classes has, we can’t add virtual methods to classes exported from the DLL if they participate in the inheritance. We can?t add virtual methods not only to the beginning of the class declaration but also to the end of it. The problem is in shifting in the table of virtual methods. Note that even if you add a new virtual method to the end of the class declaration then the child’s virtual methods will be shifted.
2.Adding of a new field (of any kind) to a class declaration can cause following problems:
1.Adding of a new field to the end of a class causes class size to change as in the case of adding of a virtual method to a class that didn?t have any. The client program will allocate less memory than it is required for a new class and this will cause referencing to the memory out of the class scope.
2.Adding of a new field between existing ones is even worse. It will case all addresses of fields after the new one to be shifted and a client application will work with the incorrect addresses while working with the fields that are situated after the new field. We also have the problem as in the previous point here.
Question - 107 : - What Is Versioning In .net?
Answer - 107 : -
main advantage of .net is versioning and solve very critical problem.
.net maintain one application with more then one version and also solve DLL HELL problem because it can run same application with different version at a same time[.Net have an Assembly. It gives the Portable Execution file.The main use of assembly is to maintain the Dll and exe's.
So sometimes the programmer confused to which is modified code.That time the assembly provide the Version.That is called versioning. It is start from 1.0.*,.......]
Question - 108 : - What Is An Indexed Property?
Answer - 108 : -
you include the index parameter in the Property statement. In this example, the test_number parameter is the index for the Scores property.
Public Class Student
' The private array of scores.
Private m_Scores(9) As Integer
' The indexed Score property procedures.
Public Property Score(ByVal test_number As Integer) As _ Integer
Get
Return m_Scores(test_number)
End Get
Set(ByVal Value As Integer)
m_Scores(test_number) = Value
End Set
End Property
End Class
Question - 109 : - What Is The Root Namespace For All Types?
Answer - 109 : -
Imports system.
Question - 110 : - What Is The Relation Between Garbage Collector And Finalize And Destructor?
Answer - 110 : -
here the GC calls an object's FINALIZE method immediately before it collects an object that is no longer referred by the application.
GC doesn’t actually run finalize method when the GC finds a FINALIZE method it queues the obj up for the finalizer to execute the objects method[GC checks for those resources which are no longer used by the process. To release the memory from these resources and in order to regain the memory heap GC initiates destructors to destroy such instances of the program. Before the destructor void an instance variable finalize routine gets executed. This routine performs whatever is to be done before the object return to void state or prior to release of any unused resources.]