(B)What is garbage collection?
Garbage collection is a CLR feature which automatically manages memory. Programmers forget
to release the objects while coding ..... laziness ( Remember in VB6 where one of the good
practices is to set object to nothing).CLR automatically releases objects when they are no longer
referenced and in use.CLR runs on non-deterministic to see the unused objects and cleans them.
One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. Therefore, we should not put code into a class destructor to release resources.
(I) Can we force garbage collector to run ?
System.GC.Collect() forces garbage collector to run.This is not recommended but can be used if situations arises.
(B)What is reflection?
All .NET assemblies have metadata information stored about the types defined in modules.This
metadata information can be accessed by mechanism called as “Reflection”.System.Reflection can
be used to browse through the metadata information.
Using reflection you can also dynamically invoke methods using System.Type.Invokemember.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Pobjtype As Type
Dim PobjObject As Object
Dim PobjButtons As New Windows.Forms.Button()
Pobjtype = PobjButtons.GetType()
For Each PobjObject In Pobjtype.GetMembers
LstDisplay.Items.Add(PobjObject.ToString())
Next
End Sub
End Class
(P)What are different type of JIT ?
JIT compiler is a part of the runtime execution environment.
In Microsoft .NET there are three types of JIT compilers:
√ Pre-JIT. Pre-JIT compiles complete source code into native code in a single compilation
cycle. This is done at the time of deployment of the application.
√ Econo-JIT. Econo-JIT compiles only those methods that are called at runtime.
However, these compiled methods are removed when they are not required.
√ Normal-JIT. Normal-JIT compiles only those methods that are called at runtime.
These methods are compiled the first time they are called, and then they are stored in
cache. When the same methods are called again, the compiled code from cache is
used for execution.
(B) What are Value types and Reference types ?
Value types directly contain their data are either allocated on the stack or allocated in-line in a
structure.
Reference types store a reference to the value's memory address, and are allocated on the heap.
Reference types can be self-describing types, pointer types, or interface types.
Variables that are value types each have their own copy of the data, and therefore operations on
one variable do not affect other variables. Variables that are reference types can refer to the same
object; therefore, operations on one variable can affect the same object referred to by another
variable.All types derive from the System.Object base type.
(B) What is concept of Boxing and Unboxing ?
Boxing permits any value type to be implicitly converted to type object or to any interface type
implemented by value type.Boxing is process in which a object instances created and copying
value types value in to that instance.
Unboxing is vice versa of boxing operation where the value is copied from the instance in to
appropriate storage location.
Below is sample code of boxing and unboxing where integer data type is converted in to object
and then vice versa.
Dim x As Integer
Dim y As Object
x = 10
‘ boxing process
y = x
‘ unboxing process
x = y
(B) What’s difference between VB.NET and C# ?
Well this is the most debatable issue in .NET community and people treat there languages like
religion.Its a subjective matter which language is best.Some like VB.NET’s natural style and some
like professional and terse C# syntaxes.Both use the same framework and speed is also very much
equivalents . But still lets list down some major differences between them :-
Advantages VB.NET :-
√ Has support for optional parameters which makes COM interoperability much easy.
√ With Option Strict off late binding is supported.Legacy VB functionalities can be
used by using Microsoft.VisualBasic namespace.
√ Has the WITH construct which is not in C#.
√ The VB.NET part of Visual Studio .NET compiles your code in the background.
While this is considered an advantage for small projects, people creating very large
projects have found that the IDE slows down considerably as the project gets larger.
Advantages of C#
√ XML documentation is generated from source code but this is now been incorporated
in Whidbey.
√ Operator overloading which is not in current VB.NET but is been introduced in
Whidbey.
√ The using statement, which makes unmanaged resource disposal simple. √ Access to Unsafe code. This allows pointer arithmetic etc, and can improve
performance in some situations. However, it is not to be used lightly, as a lot of the
normal safety of C# is lost (as the name implies).This is the major difference that you
can access unmanaged code in C# and not in VB.NET.
(I)What’s difference between System exceptions and Application
exceptions?
All exception derives from Exception Base class. Exceptions can be generated programmatically
or can be generated by system. Application Exception serves as the base class for all application specific exception classes. It derives from Exception but does not provide any extended functionality.
You should derive your custom application exceptions from Application Exception.
Application exception are used when we want to define user defined exception. While system
exception are all which are defined by .NET.
(I)What is CODE Access security?
CAS is part of .NET security model that determines whether or not a piece of code is allowed to
run and what resources it can use while running. Example CAS will allow a application to read but
now write and delete rights are given to the application.
(I)What is a satellite assembly?
In multilingual application in .NET to support multilingual functionality you can have modules
which are customized for localization.These assemblies are called as satellite assemblies. You can
distribute these assemblies separately than the core modules.